diff --git a/public/css/app.css b/public/css/app.css index 864564c..34c8586 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -73,3 +73,16 @@ .image { width: 100%; } + +div.nonmedia { + height: 100px; + width: 100%; +} + +div.nonmedia p { + color: #444; + font-size: 20px; + font-weight: 400; + line-height: 100px; + text-align: center; +} diff --git a/routes/index.js b/routes/index.js index ac6aab6..2463501 100644 --- a/routes/index.js +++ b/routes/index.js @@ -33,18 +33,28 @@ const storage = multer.diskStorage({ } }); -const fileFilter = function(req, file, cb) { - if (file.mimetype == "image/png" || file.mimetype == "image/jpg" || file.mimetype == "image/jpeg" || file.mimetype == "image/gif" || file.mimetype == "image/webp" - || file.mimetype == "video/mp4" || file.mimetype == "video/mov" || file.mimetype == "video/webm" - || file.mimetype == "audio/mpeg" || file.mimetype == "audio/ogg") { - cb(null, true) - } else { - cb(null, false); - //return cb(new Error('Only media files allowed')); - } - } +let allowedMimeTypes = [ + 'image/png', + 'image/jpg', + 'image/jpeg', + 'image/gif', + 'image/webp', + 'video/mp4', + 'video/mov', + 'video/webm', + 'audio/mpeg', + 'audio/ogg' +] -let upload = multer({ storage: storage, fileFilter: fileFilter }); +const fileFilter = function(req, file, cb) { + if (allowedMimeTypes.includes(file.mimetype)) { + cb(null, true); + } else { + cb(null, false); + } +} + +let upload = multer({ storage: storage /**, fileFilter: fileFilter**/ }); //maybe make this a env variable? function fetchMedia(req, res, next) { db.all('SELECT * FROM media', (err, rows) => { diff --git a/views/index.ejs b/views/index.ejs index 9756034..995777d 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -1,70 +1,74 @@ - - - - Embedder - - - + + + + Embedder + + + <% function extension(string) { - return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2); +return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2); } %> - - -
- -
-

Embedder

-
- -
-

Upload a file, copy paste, or drag n' drop into the dashed region

- -

-

Click the file to copy the url

-
-
-
- <% if (Count > 0) { %> -
- -
- <% } %> -
- - - + + +
+ +
+

Embedder

+
+ +
+

Upload a file, copy paste, or drag n' drop into the dashed region

+ +

+

Click the file to copy the url

+
+
+
+ <% if (Count > 0) { %> +
+ +
+ <% } %> +
+ + +