Hopefully fix video hack to work
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
02c1f699fa
commit
3e7e787002
4 changed files with 6 additions and 18 deletions
|
@ -81,7 +81,7 @@ export default class Server {
|
||||||
level = 'error'
|
level = 'error'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.url === '/health') {
|
if (ctx.url === '/health' || ctx.url === '/api/health') {
|
||||||
healthChecks++
|
healthChecks++
|
||||||
if (healthChecks >= healthCollectLimit) {
|
if (healthChecks >= healthCollectLimit) {
|
||||||
ctx.log[level]({
|
ctx.log[level]({
|
||||||
|
|
|
@ -16,13 +16,12 @@ export default class IndexPost {
|
||||||
server.flaska.post('/', [
|
server.flaska.post('/', [
|
||||||
server.formidable({ maxFileSize: 8 * 1024 * 1024, }),
|
server.formidable({ maxFileSize: 8 * 1024 * 1024, }),
|
||||||
], this.createNewLink.bind(this))
|
], this.createNewLink.bind(this))
|
||||||
server.flaska.get('/video/secondary/:id', this.videoRedirect.bind(this))
|
server.flaska.get('/video/:id', this.videoRedirect.bind(this))
|
||||||
server.flaska.get('/video/:id', this.videoInbetweenRedirect.bind(this))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async videoRedirect(ctx) {
|
async videoRedirect(ctx) {
|
||||||
try {
|
try {
|
||||||
let id = AlphabeticID.decode(ctx.params.id)
|
let id = AlphabeticID.decode(ctx.params.id.slice(0,-5))
|
||||||
let videoLink = null
|
let videoLink = null
|
||||||
if (id) {
|
if (id) {
|
||||||
let res = await ctx.db.safeCallProc('discord_embed.link_get', [id - 3843])
|
let res = await ctx.db.safeCallProc('discord_embed.link_get', [id - 3843])
|
||||||
|
@ -36,7 +35,7 @@ export default class IndexPost {
|
||||||
if (videoLink) {
|
if (videoLink) {
|
||||||
ctx.status = 302
|
ctx.status = 302
|
||||||
ctx.headers['Location'] = videoLink
|
ctx.headers['Location'] = videoLink
|
||||||
ctx.type = 'application/octet-stream'
|
ctx.type = 'text/html; charset=utf-8'
|
||||||
ctx.body = `
|
ctx.body = `
|
||||||
Redirecting
|
Redirecting
|
||||||
<a href="${videoLink}">Click here if it doesn't redirect</a>
|
<a href="${videoLink}">Click here if it doesn't redirect</a>
|
||||||
|
@ -53,17 +52,6 @@ Redirecting
|
||||||
return this.serve.serveIndex(ctx)
|
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) {
|
hasErrors(ctx, hasMedia) {
|
||||||
if (!ctx.req.body.video) {
|
if (!ctx.req.body.video) {
|
||||||
return 'Missing video link'
|
return 'Missing video link'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "discord_embed",
|
"name": "discord_embed",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"port": 4120,
|
"port": 4120,
|
||||||
"description": "AV1 discord server embed helper",
|
"description": "AV1 discord server embed helper",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<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="/">
|
<base href="/">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
{{ if (imageLink) { }}
|
{{ if (imageLink) { }}
|
||||||
|
|
Loading…
Reference in a new issue