diff --git a/base/server.mjs b/base/server.mjs index 95bf258..bdcb0f0 100644 --- a/base/server.mjs +++ b/base/server.mjs @@ -81,7 +81,7 @@ export default class Server { level = 'error' } - if (ctx.url === '/health') { + if (ctx.url === '/health' || ctx.url === '/api/health') { healthChecks++ if (healthChecks >= healthCollectLimit) { ctx.log[level]({ diff --git a/discord_embed/api/post.mjs b/discord_embed/api/post.mjs index a79a7bc..aa65a00 100644 --- a/discord_embed/api/post.mjs +++ b/discord_embed/api/post.mjs @@ -16,13 +16,12 @@ export default class IndexPost { server.flaska.post('/', [ server.formidable({ maxFileSize: 8 * 1024 * 1024, }), ], this.createNewLink.bind(this)) - server.flaska.get('/video/secondary/:id', this.videoRedirect.bind(this)) - server.flaska.get('/video/:id', this.videoInbetweenRedirect.bind(this)) + server.flaska.get('/video/:id', this.videoRedirect.bind(this)) } async videoRedirect(ctx) { try { - let id = AlphabeticID.decode(ctx.params.id) + let id = AlphabeticID.decode(ctx.params.id.slice(0,-5)) let videoLink = null if (id) { let res = await ctx.db.safeCallProc('discord_embed.link_get', [id - 3843]) @@ -36,7 +35,7 @@ export default class IndexPost { if (videoLink) { ctx.status = 302 ctx.headers['Location'] = videoLink - ctx.type = 'application/octet-stream' + ctx.type = 'text/html; charset=utf-8' ctx.body = ` Redirecting Click here if it doesn't redirect @@ -53,17 +52,6 @@ Redirecting return this.serve.serveIndex(ctx) } - async videoInbetweenRedirect(ctx) { - let location = '/video/secondary/' + ctx.params.id - ctx.status = 302 - ctx.headers['Location'] = location - ctx.type = 'application/octet-stream' - ctx.body = ` -Redirecting -Click here if it doesn't redirect -` - } - hasErrors(ctx, hasMedia) { if (!ctx.req.body.video) { return 'Missing video link' diff --git a/discord_embed/package.json b/discord_embed/package.json index 38e7737..c719ba4 100644 --- a/discord_embed/package.json +++ b/discord_embed/package.json @@ -1,6 +1,6 @@ { "name": "discord_embed", - "version": "1.0.7", + "version": "1.0.8", "port": 4120, "description": "AV1 discord server embed helper", "main": "index.js", diff --git a/discord_embed/public/index.html b/discord_embed/public/index.html index 3de97eb..e68a5b3 100644 --- a/discord_embed/public/index.html +++ b/discord_embed/public/index.html @@ -2,7 +2,7 @@ - Discord Embedder from AV1 server 1.0.7 + Discord Embedder from AV1 server 1.0.8 {{ if (imageLink) { }}