mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 19:49:37 +02:00
Option to open links in the same tab. Api upload icon. Render image icon instead of MDI. Dockerfile client dependencies fix.
This commit is contained in:
parent
e3ed429da1
commit
6c067bee31
18 changed files with 214 additions and 13 deletions
27
middleware/multer.js
Normal file
27
middleware/multer.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const fs = require('fs');
|
||||
const { join } = require('path');
|
||||
const multer = require('multer');
|
||||
const uuid = require('uuid');
|
||||
|
||||
const storage = multer.diskStorage({
|
||||
destination: (req, file, cb) => {
|
||||
cb(null, './data/uploads');
|
||||
},
|
||||
filename: (req, file, cb) => {
|
||||
cb(null, Date.now() + '--' + file.originalname);
|
||||
}
|
||||
})
|
||||
|
||||
const supportedTypes = ['jpg', 'jpeg', 'png'];
|
||||
|
||||
const fileFilter = (req, file, cb) => {
|
||||
if (supportedTypes.includes(file.mimetype.split('/')[1])) {
|
||||
cb(null, true);
|
||||
} else {
|
||||
cb(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
const upload = multer({ storage, fileFilter });
|
||||
|
||||
module.exports = upload.single('icon');
|
Loading…
Add table
Add a link
Reference in a new issue