diff options
| author | Pitu <[email protected]> | 2020-05-11 00:19:10 +0900 |
|---|---|---|
| committer | Pitu <[email protected]> | 2020-05-11 00:19:10 +0900 |
| commit | b886fda0793b8a26de58cd462acf6676a0a8e7ed (patch) | |
| tree | 07fcc32486b7654bf3ba173cef4061dc7cb6f12e /src/api/routes/uploads | |
| parent | fix: remove uuid from user registration (diff) | |
| download | host.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.js | 15 |
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 }); |