IPFS provider for Strapi uploads.
# using yarn
yarn add strapi-provider-upload-ipfs
# using npm
npm install strapi-provider-upload-ipfs --save
./config/plugins.js
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: "strapi-provider-upload-ipfs-storage",
providerOptions: {
grpc: env("IPFS_GRPC"),
http: env("IPFS_HTTP"),
},
},
},
// ...
});
.env
IPFS_GRPC=""
IPFS_HTTP=""
Due to the default settings in the Strapi Security Middleware you will need to modify the contentSecurityPolicy
settings to properly see thumbnail previews in the Media Library. You should replace strapi::security
string with the object bellow instead as explained in the middleware configuration documentation.
./config/middlewares.js
module.exports = [
// ...
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", "https:"],
"img-src": [
"'self'",
"data:",
"blob:",
"dl.airtable.com",
"*.ipfs.dweb.link", // ipfs.tech
"*.ipfs.cf-ipfs.com", // cloudflare.com
"*.ipfs.w3s.link", // web3.storage
],
"media-src": [
"'self'",
"data:",
"blob:",
"dl.airtable.com",
"*.ipfs.dweb.link", // ipfs.tech
"*.ipfs.cf-ipfs.com", // cloudflare.com
"*.ipfs.w3s.link", // web3.storage
],
upgradeInsecureRequests: null,
},
},
},
},
// ...
];
(c)
Alex Baker