aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes/uploads
diff options
context:
space:
mode:
authorPitu <[email protected]>2020-05-11 00:19:10 +0900
committerPitu <[email protected]>2020-05-11 00:19:10 +0900
commitb886fda0793b8a26de58cd462acf6676a0a8e7ed (patch)
tree07fcc32486b7654bf3ba173cef4061dc7cb6f12e /src/api/routes/uploads
parentfix: remove uuid from user registration (diff)
downloadhost.fuwn.me-b886fda0793b8a26de58cd462acf6676a0a8e7ed.tar.xz
host.fuwn.me-b886fda0793b8a26de58cd462acf6676a0a8e7ed.zip
chore: cleanup and todo
Diffstat (limited to 'src/api/routes/uploads')
-rw-r--r--src/api/routes/uploads/uploadPOST.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/api/routes/uploads/uploadPOST.js b/src/api/routes/uploads/uploadPOST.js
index d35b9fc..d611175 100644
--- a/src/api/routes/uploads/uploadPOST.js
+++ b/src/api/routes/uploads/uploadPOST.js
@@ -11,6 +11,7 @@ const upload = multer({
files: 1
},
fileFilter: (req, file, cb) => {
+ // TODO: Enable blacklisting of files/extensions
/*
if (options.blacklist.mimes.includes(file.mimetype)) {
return cb(new Error(`${file.mimetype} is a blacklisted filetype.`));
@@ -22,6 +23,20 @@ const upload = multer({
}
}).array('files[]');
+/*
+ TODO: If source has transparency generate a png thumbnail, otherwise a jpg.
+ TODO: If source is a gif, generate a thumb of the first frame and play the gif on hover on the frontend.
+ TODO: If source is a video, generate a thumb of the first frame and save the video length to the file?
+ Another possible solution would be to play a gif on hover that grabs a few chunks like youtube.
+
+ TODO: Think if its worth making a folder with the user uuid in uploads/ and upload the pictures there so
+ that this way at least not every single file will be in 1 directory
+
+ - Addendum to this: Now that the default behaviour is to serve files with node, we can actually pull this off. Before this, having files in
+ subfolders meant messing with nginx and the paths, but now it should be fairly easy to re-arrange the folder structure with express.static
+ I see great value in this, open to suggestions.
+*/
+
class uploadPOST extends Route {
constructor() {
super('/upload', 'post', { bypassAuth: true });