Hopefully fix video hack to work
continuous-integration/appveyor/branch AppVeyor build succeeded Details

master discord_embed_v1.0.8
Jonatan Nilsson 2022-10-29 12:30:46 +00:00
parent 02c1f699fa
commit 3e7e787002
4 changed files with 6 additions and 18 deletions

View File

@ -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]({

View File

@ -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
<a href="${videoLink}">Click here if it doesn't redirect</a>
@ -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
<a href="${location}">Click here if it doesn't redirect</a>
`
}
hasErrors(ctx, hasMedia) {
if (!ctx.req.body.video) {
return 'Missing video link'

View File

@ -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",

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Discord Embedder from AV1 server 1.0.7</title>
<title>Discord Embedder from AV1 server 1.0.8</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ if (imageLink) { }}