From 9c7241d145fbbf3b6a9118509b61edc724017552 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Tue, 3 Nov 2020 22:51:29 +0700 Subject: [PATCH] Allow filtering audio files with is:audio For now only support FLAC, MP3, WAV and WMA More extensions will come at a later date --- controllers/uploadController.js | 3 ++- controllers/utilsController.js | 1 + src/js/dashboard.js | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/controllers/uploadController.js b/controllers/uploadController.js index 1c5c8e0..26e3383 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -894,7 +894,8 @@ self.list = async (req, res) => { }, typeIs: [ 'image', - 'video' + 'video', + 'audio' ], flags: {} } diff --git a/controllers/utilsController.js b/controllers/utilsController.js index d39aeb0..ef8edaa 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -29,6 +29,7 @@ const self = { imageExts: ['.gif', '.jpeg', '.jpg', '.png', '.svg', '.tif', '.tiff', '.webp'], videoExts: ['.3g2', '.3gp', '.asf', '.avchd', '.avi', '.divx', '.evo', '.flv', '.h264', '.h265', '.hevc', '.m2p', '.m2ts', '.m4v', '.mk3d', '.mkv', '.mov', '.mp4', '.mpeg', '.mpg', '.mxf', '.ogg', '.ogv', '.ps', '.qt', '.rmvb', '.ts', '.vob', '.webm', '.wmv'], + audioExts: ['.flac', '.mp3', '.wav', '.wma'], thumbsSize: config.uploads.generateThumbs.size || 200, ffprobe: promisify(ffmpeg.ffprobe), diff --git a/src/js/dashboard.js b/src/js/dashboard.js index c2e6d0b..91e4212 100644 --- a/src/js/dashboard.js +++ b/src/js/dashboard.js @@ -93,7 +93,7 @@ const page = { imageExts: ['.gif', '.jpeg', '.jpg', '.png', '.svg', '.tif', '.tiff', '.webp'], videoExts: ['.3g2', '.3gp', '.asf', '.avchd', '.avi', '.divx', '.evo', '.flv', '.h264', '.h265', '.hevc', '.m2p', '.m2ts', '.m4v', '.mk3d', '.mkv', '.mov', '.mp4', '.mpeg', '.mpg', '.mxf', '.ogg', '.ogv', '.ps', '.qt', '.rmvb', '.ts', '.vob', '.webm', '.wmv'], - audioExts: ['.flac', '.mp3', '.wma'], + audioExts: ['.flac', '.mp3', '.wav', '.wma'], isSomethingLoading: false, fadingIn: null, @@ -1148,8 +1148,9 @@ page.uploadFiltersHelp = element => { This key can also be specified more than once, where their order will decide the sorting steps. Finally, there are type-is keys to refine by types. - You can use is:image and is:video to list images and videos respectively. - This will only use image/video extensions whose thumbnails can be generated by the safe. + You can use is:image, is:video, and is:audio to list images, videos, audios respectively. + This will only use image, video and audio extensions that are whitelisted internally in the safe. + For images and videos specifically, they will be the ones whose thumbnails can be generated by the safe. Negation sign works for this key as well. Mixing inclusion and exclusion is not allowed (i.e. is:image -is:video, since the second key is redundant).