discord_embed: Make sure that all cdn.discordapp.com links get proxy-treatment
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
This commit is contained in:
parent
6faf71ba18
commit
203965027b
3 changed files with 8 additions and 6 deletions
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Discord Embedder from AV1 server 1.0.9</title>
|
||||
<title>Discord Embedder from AV1 server 1.0.11</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{{ if (imageLink) { }}
|
||||
|
|
Loading…
Reference in a new issue