added audio support

pull/29/head
tycrek 3 years ago
parent 055fdefc5c
commit b9d6a8d0be
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -20,7 +20,7 @@
## Features ## Features
- ✔️ Token authorization via HTTP `Authorization` header - ✔️ Token authorization via HTTP `Authorization` header
- ✔️ Upload images, videos, gifs, files - ✔️ Upload images, videos, gifs, audio, files
- ✔️ Fancy embeds on Discord - ✔️ Fancy embeds on Discord
- ✔️ Seamless inline video embeds on Discord - ✔️ Seamless inline video embeds on Discord
- ✔️ Personal upload log via customizable Discord Webhooks - ✔️ Personal upload log via customizable Discord Webhooks

@ -117,7 +117,7 @@ if (require.main === module) {
required: false required: false
}, },
mediaStrict: { mediaStrict: {
description: 'Only allow uploads of media files (images, videos)', description: 'Only allow uploads of media files (images, videos, audio)',
type: 'boolean', type: 'boolean',
default: config.mediaStrict, default: config.mediaStrict,
required: false required: false

@ -12,7 +12,7 @@ const { s3enabled, s3endpoint, s3bucket, s3accessKey, s3secretKey, saveAsOrigina
const { CODE_UNSUPPORTED_MEDIA_TYPE } = require('./MagicNumbers.json'); const { CODE_UNSUPPORTED_MEDIA_TYPE } = require('./MagicNumbers.json');
const ID_GEN_LENGTH = 32; const ID_GEN_LENGTH = 32;
const ALLOWED_MIMETYPES = /(image)|(video)\//; const ALLOWED_MIMETYPES = /(image)|(video)|(audio)\//;
const s3 = new aws.S3({ const s3 = new aws.S3({
endpoint: new aws.Endpoint(s3endpoint), endpoint: new aws.Endpoint(s3endpoint),

@ -1,4 +1,4 @@
img, video { img, video, audio {
border-left-width: 4px; border-left-width: 4px;
border-left-style: solid; border-left-style: solid;
border-radius: 4px; border-radius: 4px;

@ -20,7 +20,7 @@
margin-right: 16px; margin-right: 16px;
} }
img, video { img, video, audio {
max-height: 50vh; max-height: 50vh;
} }

@ -9,7 +9,7 @@ html
if color !== null if color !== null
style: include css/img.css style: include css/img.css
style. style.
img, video { border-color: #{color}; } img, video, audio { border-color: #{color}; }
// Open Graph (https://ogp.me/) // Open Graph (https://ogp.me/)
meta(property='og:type' content=ogtype) meta(property='og:type' content=ogtype)
@ -29,6 +29,8 @@ html
video#media(controls loop muted playsinline preload='metadata')&attributes(resourceAttr) video#media(controls loop muted playsinline preload='metadata')&attributes(resourceAttr)
else if fileIs.image else if fileIs.image
img#media(decoding='async')&attributes(resourceAttr) img#media(decoding='async')&attributes(resourceAttr)
else if fileIs.audio
audio#media(controls loop preload='metadata')&attributes(resourceAttr)
else else
code!=title code!=title
figcaption figcaption

Loading…
Cancel
Save