diff --git a/discord_embed/api/serve.mjs b/discord_embed/api/serve.mjs index 5fe719b..e7b406b 100644 --- a/discord_embed/api/serve.mjs +++ b/discord_embed/api/serve.mjs @@ -37,10 +37,8 @@ export default class ServeHandler extends Parent { if (id) { let res = await ctx.db.safeCallProc('discord_embed.link_get', [id - 3843]) if (res.first.length) { - ctx.state.video = res.first[0].video_link - if (ctx.state.video.startsWith('https://cdn.discordapp.com')) { - videoLink = ctx.state.video.replace('https://cdn.discordapp.com', 'https://discordproxy.nfp.is') - } else { + videoLink = ctx.state.video = res.first[0].video_link + if (!ctx.state.video.startsWith('https://cdn.discordapp.com')) { videoLink = this.frontend + '/video/' + ctx.url.slice(1) + '.webm' } imageLink = res.first[0].image_link @@ -56,6 +54,10 @@ export default class ServeHandler extends Parent { ctx.status = 404 } + if (videoLink.startsWith('https://cdn.discordapp.com')) { + videoLink = videoLink.replace('https://cdn.discordapp.com', 'https://discordproxy.nfp.is') + } + let payload = { videoLink: videoLink, imageLink: imageLink, diff --git a/discord_embed/package.json b/discord_embed/package.json index 37ab2ac..ab1bbfb 100644 --- a/discord_embed/package.json +++ b/discord_embed/package.json @@ -1,6 +1,6 @@ { "name": "discord_embed", - "version": "1.0.10", + "version": "1.0.11", "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 3fa1819..c6db4a5 100644 --- a/discord_embed/public/index.html +++ b/discord_embed/public/index.html @@ -2,7 +2,7 @@
-