62 lines
1.1 KiB
JavaScript
62 lines
1.1 KiB
JavaScript
const path = require('path');
|
|
const checkRole = require('../access/checkRole');
|
|
|
|
module.exports = {
|
|
slug: 'media',
|
|
labels: {
|
|
singular: 'Media',
|
|
plural: 'Media',
|
|
},
|
|
access: {
|
|
read: () => true,
|
|
},
|
|
upload: {
|
|
staticURL: '/media',
|
|
staticDir: path.resolve(__dirname, '../media'),
|
|
adminThumbnail: 'mobile',
|
|
imageSizes: [
|
|
{
|
|
name: 'tablet',
|
|
width: 640,
|
|
height: 480,
|
|
crop: 'left top',
|
|
},
|
|
{
|
|
name: 'mobile',
|
|
width: 320,
|
|
height: 240,
|
|
crop: 'left top',
|
|
},
|
|
{
|
|
name: 'icon',
|
|
width: 16,
|
|
height: 16,
|
|
},
|
|
],
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'alt',
|
|
label: 'Alt Text',
|
|
type: 'text',
|
|
required: true,
|
|
localized: true,
|
|
},
|
|
{
|
|
name: 'sizes',
|
|
fields: [
|
|
{
|
|
name: 'icon',
|
|
access: {
|
|
read: ({ req: { user } }) => {
|
|
const result = checkRole(['admin'], user);
|
|
return result;
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
timestamps: true,
|
|
};
|