From 8135b3a46d9c4e90d56b96327b0d56d0a7dcdf59 Mon Sep 17 00:00:00 2001 From: tycrek Date: Tue, 6 Apr 2021 00:52:31 -0600 Subject: [PATCH] test? --- ass.js | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/ass.js b/ass.js index 8375d5f..5375d2b 100755 --- a/ass.js +++ b/ass.js @@ -66,18 +66,10 @@ function startup() { // View file app.get('/:resourceId', (req, res) => { let resourceId = req.params.resourceId.split('.')[0]; - let isMp4Req = req.params.resourceId.split('.')[1] == 'mp4'; - let isBot = req.useragent.isBot == 'discordbot'; - let redirect = req.query['redirect']; - - 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')); - else if (data[resourceId]) - res.header('Accept-Ranges', 'bytes').header('Content-Length', fileData.byteLength).type(data[resourceId].mimetype).send(fileData);// .sendFile(path(data[resourceId].path)); + if (data[resourceId]) + res/* .header('Accept-Ranges', 'bytes').header('Content-Length', fileData.byteLength).type(data[resourceId].mimetype).send(fileData); */.sendFile(path(data[resourceId].path)); else res.sendStatus(404); }); @@ -101,17 +93,3 @@ function startup() { app.listen(process.env.PORT, () => log(`Server started on port ${process.env.PORT}\nAuthorized tokens: ${tokens.length}\nAvailable files: ${Object.keys(data).length}`)); } - -function generateDiscordMp4Response(url) { - log('Generating video for Discord'); - return '' + - '' + '\n' + - '' + '\n' + - `\t` + '\n' + - `\t` + '\n' + - '' + '\n' + - '' + '\n' + - `\t` + '\n' + - '' + '\n' + - ''; -} \ No newline at end of file