From 6e75a3b09395618c7272ff552a98edb04ad79f4f Mon Sep 17 00:00:00 2001 From: tycrek Date: Tue, 6 Apr 2021 00:37:17 -0600 Subject: [PATCH] i have no idea if this will work --- ass.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ass.js b/ass.js index 10daba5..13f7c5e 100755 --- a/ass.js +++ b/ass.js @@ -68,17 +68,17 @@ function startup() { let resourceId = req.params.resourceId.split('.')[0]; let isMp4Req = req.params.resourceId.split('.')[1] == 'mp4'; let isBot = req.useragent.isBot == 'discordbot'; - let element = req.query['element']; + let redirect = req.query['redirect']; isBot = true; - if (data[resourceId] && data[resourceId].mimetype == 'video/mp4' && !isMp4Req && isBot) return res.redirect(req.url + '.mp4'); + if (data[resourceId] && data[resourceId].mimetype == 'video/mp4' && !isMp4Req && isBot && redirect) return res.redirect(req.url + '.mp4'); let fileData = fs.readFileSync(path(data[resourceId].path)); + if (data[resourceId] && data[resourceId].mimetype == 'video/mp4' && !isMp4Req && isBot && !redirect) + res.type('html').send(generateDiscordMp4Response(req.url + '?redirect=true')); if (data[resourceId] && (element || (!isBot || !isMp4Req))) res.header('Accept-Ranges', 'bytes').header('Content-Length', fileData.byteLength).type(data[resourceId].mimetype).send(fileData);// .sendFile(path(data[resourceId].path)); - else if (data[resourceId] && isMp4Req && isBot) - res.type('html').send(generateDiscordMp4Response(req.url + '?element=true')); else res.sendStatus(404); });