added Discord compat mode

pull/12/head
tycrek 4 years ago
parent 327cb99fb8
commit dff7600c91
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -7,6 +7,7 @@ This project is still very young, so don't expect *everything* to be perfect yet
- ✔️ Token authorization via HTTP `Authorization` header
- ✔️ Upload images, videos, files
- ✔️ Discord compatibility mode for video embed
- ❌ Thumbnail support
- ✔️ Delete support
- ❌ Multiple database types (JSON, Mongo, MySQL, PostgreSQL, etc. Currently uses JSON)

@ -7,7 +7,7 @@ try {
}
// Load the config
const { host, port, domain, useSsl, resourceIdSize, resourceIdType } = require('./config.json');
const { host, port, domain, useSsl, resourceIdSize, resourceIdType, discordMode } = require('./config.json');
//#region Imports
const fs = require('fs-extra');
@ -66,8 +66,9 @@ function startup() {
let http = ('http').concat(useSsl ? 's' : '').concat('://');
let trueDomain = domain.concat((port != 80 || port != 443) ? `:${port}` : '');
let discordCompat = (discordMode && req.file.mimetype == 'video/mp4') ? '.mp4' : '';
res.type('json').send({
resource: `${http}${trueDomain}/${resourceId}`,
resource: `${http}${trueDomain}/${resourceId}${discordCompat}`,
delete: `${http}${trueDomain}/delete/${req.file.filename}`
});
});

@ -14,7 +14,8 @@ const config = {
domain: 'upload.example.com',
useSsl: true,
resourceIdSize: 12,
resourceIdType: 'zws'
resourceIdType: 'zws',
discordMode: false
};
// Schema for setup prompts
@ -57,6 +58,12 @@ const setupSchema = {
require: false,
pattern: /(original|zws|random)/gi,
message: 'Must be one of: original, zws, random'
},
discordMode: {
description: 'Discord Mode (will automatically attach .mp4 to your video URLs so Discord embeds them properly)',
type: 'boolean',
default: config.discordMode,
required: false
}
}
};

Loading…
Cancel
Save