sanity-plugin-r2-files
Version:
Store Sanity media files in Cloudflare R2 Bucket
40 lines (39 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.credentialsFields = exports.schemaConfig = void 0;
const icons_1 = require("@sanity/icons");
exports.schemaConfig = {
title: 'Media file hosted in Cloudflare R2 Bucket',
customFields: ['fileKey', 'baseUrl'],
};
exports.credentialsFields = [
{
name: 'workerUrl',
title: 'Cloudflare Worker URL',
description: 'URL of the Cloudflare Worker that handles the signed URL requests for uploading files to the R2 Bucket.',
icon: icons_1.PinIcon,
type: 'url',
validation: (Rule) => Rule.required(),
},
{
name: 'folder',
title: 'Folder',
description: "Folder to store files inside the R2 Bucket. If none provided, will upload files to the R2 Bucket's root. Creates one if it doesn't exist.",
icon: icons_1.FolderIcon,
type: 'string',
},
{
name: 'url',
title: 'Public URL',
description: 'Public Url of the bucket. Either enable R2.dev Subdomain or configure custom domain.',
icon: icons_1.ApiIcon,
type: 'url',
},
{
name: 'secret',
title: 'Secret',
description: 'Secret for validating the signed URL request (optional)',
icon: icons_1.EyeClosedIcon,
type: 'string',
},
];