strapi-provider-upload-ipfs-client

1.3.0 • Public • Published

Strapi Provider Upload IPFS

strapi-provider-upload-ipfs-storage

IPFS provider for Strapi uploads.

Installation

# using yarn
yarn add strapi-provider-upload-ipfs

# using npm
npm install strapi-provider-upload-ipfs --save

Providers Configuration

./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=""

Security Middleware Configuration

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

Package Sidebar

Install

npm i strapi-provider-upload-ipfs-client

Weekly Downloads

1

Version

1.3.0

License

MIT

Unpacked Size

6.89 kB

Total Files

5

Last publish

Collaborators

  • logasja