diff --git a/app/imports/api/files/UserImages.js b/app/imports/api/files/UserImages.js new file mode 100644 index 00000000..ead7271b --- /dev/null +++ b/app/imports/api/files/UserImages.js @@ -0,0 +1,18 @@ +import { createS3FilesCollection } from '/imports/api/files/s3FileStorage.js'; + +const UserImages = createS3FilesCollection({ + collectionName: 'userImages', + storagePath: Meteor.isDevelopment ? '/DiceCloud/userImages/' : 'assets/app/userImages', + onBeforeUpload(file) { + // Allow upload files under 10MB + if (file.size > 10485760) { + return 'Please upload with size equal or less than 10MB'; + } + // Allow common image extensions + if (/gif|png|jpe?g|webp/i.test(file.extension || '')) { + return 'Please upload an image file only'; + } + } +}); + +export default UserImages; diff --git a/app/imports/ui/layouts/Sidebar.vue b/app/imports/ui/layouts/Sidebar.vue index fdd4fcb9..9c050890 100644 --- a/app/imports/ui/layouts/Sidebar.vue +++ b/app/imports/ui/layouts/Sidebar.vue @@ -96,6 +96,7 @@ {title: 'Library', icon: 'mdi-library-shelves', to: '/library', requireLogin: true}, //{title: 'Tabletops', icon: 'api', to: '/tabletops', requireLogin: true}, //{title: 'Friends', icon: 'people', to: '/friends', requireLogin: true}, + {title: 'Files', icon: 'mdi-file-multiple', to: '/my-files'}, {title: 'Feedback', icon: 'mdi-bug', to: '/feedback'}, {title: 'About', icon: 'mdi-sign-text', to: '/about'}, {title: 'Patreon', icon: 'mdi-patreon', href: 'https://www.patreon.com/dicecloud'}, diff --git a/app/imports/ui/pages/Files.vue b/app/imports/ui/pages/Files.vue new file mode 100644 index 00000000..6a86d226 --- /dev/null +++ b/app/imports/ui/pages/Files.vue @@ -0,0 +1,75 @@ + + + + + \ No newline at end of file diff --git a/app/imports/ui/router.js b/app/imports/ui/router.js index f8fe9442..4295e83a 100644 --- a/app/imports/ui/router.js +++ b/app/imports/ui/router.js @@ -30,6 +30,7 @@ const TabletopToolbar = () => import('/imports/ui/tabletop/TabletopToolbar.vue') const TabletopRightDrawer = () => import('/imports/ui/tabletop/TabletopRightDrawer.vue'); const Admin = () => import('/imports/ui/pages/Admin.vue'); const Maintenance = () => import('/imports/ui/pages/Maintenance.vue'); +const Files = () => import('/imports/ui/pages/Files.vue'); // Not found const NotFound = () => import('/imports/ui/pages/NotFound.vue'); @@ -199,8 +200,8 @@ RouterFactory.configure(router => { meta: { title: 'Register', }, - },{ - path: '/account', + }, { + path: '/account', components: { default: Account, }, @@ -208,7 +209,16 @@ RouterFactory.configure(router => { title: 'Account', }, beforeEnter: ensureLoggedIn, - },{ + }, { + path: '/my-files', + components: { + default: Files, + }, + meta: { + title: 'Files', + }, + beforeEnter: ensureLoggedIn, + }, { path: '/feedback', components: { default: Feedback, diff --git a/app/package-lock.json b/app/package-lock.json index 1569bc53..85fabfac 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -2564,6 +2564,11 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "pretty-bytes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.0.0.tgz", + "integrity": "sha512-6UqkYefdogmzqAZWzJ7laYeJnaXDy2/J+ZqiiMtS7t7OfpXWTlaeGMwX8U6EFvPV/YWWEKRkS8hKS4k60WHTOg==" + }, "prism-media": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.1.tgz", @@ -2788,7 +2793,7 @@ }, "signal-exit": { "version": "3.0.2", - "resolved": false, + "resolved": "", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "simpl-schema": { diff --git a/app/package.json b/app/package.json index 5f0787c2..456bbc3d 100644 --- a/app/package.json +++ b/app/package.json @@ -40,6 +40,7 @@ "nearley": "^2.19.1", "ngraph.graph": "^19.1.0", "ngraph.path": "^1.4.0", + "pretty-bytes": "^6.0.0", "qrcode": "^1.5.0", "request": "^2.88.2", "simpl-schema": "^1.12.0",