From b9d6a8d0bed5bb24cb0b605daf59efd3b407e68b Mon Sep 17 00:00:00 2001 From: tycrek Date: Wed, 7 Jul 2021 16:28:35 -0600 Subject: [PATCH] added audio support --- README.md | 2 +- setup.js | 2 +- storage.js | 2 +- views/css/img.css | 2 +- views/css/view.css | 2 +- views/view.pug | 4 +++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a0a85b9..6b859ca 100755 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ ## Features - ✔️ Token authorization via HTTP `Authorization` header -- ✔️ Upload images, videos, gifs, files +- ✔️ Upload images, videos, gifs, audio, files - ✔️ Fancy embeds on Discord - ✔️ Seamless inline video embeds on Discord - ✔️ Personal upload log via customizable Discord Webhooks diff --git a/setup.js b/setup.js index c9b0455..5612369 100755 --- a/setup.js +++ b/setup.js @@ -117,7 +117,7 @@ if (require.main === module) { required: false }, mediaStrict: { - description: 'Only allow uploads of media files (images, videos)', + description: 'Only allow uploads of media files (images, videos, audio)', type: 'boolean', default: config.mediaStrict, required: false diff --git a/storage.js b/storage.js index b0fb9f0..ce5c9c9 100644 --- a/storage.js +++ b/storage.js @@ -12,7 +12,7 @@ const { s3enabled, s3endpoint, s3bucket, s3accessKey, s3secretKey, saveAsOrigina const { CODE_UNSUPPORTED_MEDIA_TYPE } = require('./MagicNumbers.json'); const ID_GEN_LENGTH = 32; -const ALLOWED_MIMETYPES = /(image)|(video)\//; +const ALLOWED_MIMETYPES = /(image)|(video)|(audio)\//; const s3 = new aws.S3({ endpoint: new aws.Endpoint(s3endpoint), diff --git a/views/css/img.css b/views/css/img.css index 9f741ab..bb1a0f6 100644 --- a/views/css/img.css +++ b/views/css/img.css @@ -1,4 +1,4 @@ -img, video { +img, video, audio { border-left-width: 4px; border-left-style: solid; border-radius: 4px; diff --git a/views/css/view.css b/views/css/view.css index 13668c1..5231cc6 100644 --- a/views/css/view.css +++ b/views/css/view.css @@ -20,7 +20,7 @@ margin-right: 16px; } -img, video { +img, video, audio { max-height: 50vh; } diff --git a/views/view.pug b/views/view.pug index 5cc0784..bd9b39e 100644 --- a/views/view.pug +++ b/views/view.pug @@ -9,7 +9,7 @@ html if color !== null style: include css/img.css style. - img, video { border-color: #{color}; } + img, video, audio { border-color: #{color}; } // Open Graph (https://ogp.me/) meta(property='og:type' content=ogtype) @@ -29,6 +29,8 @@ html video#media(controls loop muted playsinline preload='metadata')&attributes(resourceAttr) else if fileIs.image img#media(decoding='async')&attributes(resourceAttr) + else if fileIs.audio + audio#media(controls loop preload='metadata')&attributes(resourceAttr) else code!=title figcaption