feat: simple, but not stupid, uploader for IPFS
This is a simple but not stupid implementation of an upload system for attachments using IPFS.
This requires to have a PUSH Gateway configured in your localhost server, where Pleroma runs too, we will call this PUSH-G. We will call the Public GET Gateway as GET-G.
Example config:
config :pleroma, Pleroma.Uploaders.IPFS,
post_gateway_url: "http://localhost:5001/",
get_gateway_url: "https://ipfs.mydomain.com/{CID}"
The parameter get_gateway_url
expects a cid
placeholder to be replaced by the real Content ID. So you can try to adjust to your Gateway configuration. Other examples:
- "https://{CID}.ipfs.mydomain.com"
- "ipfs://{CID}"
To simplify the process, the uploader appends to the POST URL the ?cid-version=1
parameter. Why this choice? Because by using the cid version 1, we can allow more Gateway configurations. If we use the standard CID version, 0 to understand, only this one would work: https://ipfs.mydomain.com/{CID}
I'm looking forward to your feedback. Happy Hacking.