added endpoint for direct routing to prep for fancy viewing page

pull/20/head
tycrek 3 years ago
parent e0d766d141
commit edf2ffbfab
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -251,8 +251,15 @@ function startup() {
vibrant: fileData.vibrant,
};
// If the client is Discord, send an Open Graph embed
// If the client is a social bot (such as Discord or Instagram), send an Open Graph embed
if (req.useragent.isBot) return res.type('html').send(new OpenGraph(getTrueHttp(), getTrueDomain(), resourceId, requiredItems).build());
else res.redirect(`${req.url}/direct`);
});
// Direct resource
app.get('/:resourceId/direct*', (req, res) => {
const { resourceId } = req.ass;
const fileData = data[resourceId];
// Return the file differently depending on what storage option was used
const uploaders = {

@ -41,7 +41,7 @@ class OpenGraph {
}
build() {
let resourceUrl = !s3enabled ? (this.http + this.domain + "/" + this.resourceId + getSafeExt(this.type)) : getS3url(this.randomId, this.type);
let resourceUrl = !s3enabled ? (this.http + this.domain + '/' + this.resourceId + '/direct' + getSafeExt(this.type)) : getS3url(this.randomId, this.type);
return Mustache.render(html, {
homepage,
version,

Loading…
Cancel
Save