summary refs log tree commit diff
path: root/src/cdn/Server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cdn/Server.ts')
-rw-r--r--src/cdn/Server.ts23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/cdn/Server.ts b/src/cdn/Server.ts

index dff76494..42323556 100644 --- a/src/cdn/Server.ts +++ b/src/cdn/Server.ts
@@ -17,12 +17,11 @@ */ import { Server, ServerOptions } from "lambert-server"; -import { Attachment, Config, initDatabase, registerRoutes } from "@spacebar/util"; +import { Config, initDatabase, registerRoutes } from "@spacebar/util"; import { CORS, BodyParser } from "@spacebar/api"; import path from "path"; import guildProfilesRoute from "./routes/guild-profiles"; import morgan from "morgan"; -import { Like } from "typeorm"; export type CDNServerOptions = ServerOptions; @@ -36,7 +35,6 @@ export class CDNServer extends Server { async start() { await initDatabase(); await Config.init(); - await this.cleanupSignaturesInDb(); const logRequests = process.env["LOG_REQUESTS"] != undefined; if (logRequests) { @@ -73,23 +71,4 @@ export class CDNServer extends Server { async stop() { return super.stop(); } - - async cleanupSignaturesInDb() { - console.log("[CDN] Cleaning up signatures in database"); - const attachmentsToFix = await Attachment.find({ - where: { url: Like("%?ex=%") }, - }); - if (attachmentsToFix.length === 0) { - console.log("[CDN] No attachments to fix"); - return; - } - - console.log("[CDN] Found", attachmentsToFix.length, " attachments to fix"); - for (const attachment of attachmentsToFix) { - attachment.url = attachment.url.split("?ex=")[0]; - attachment.proxy_url = attachment.proxy_url?.split("?ex=")[0]; - await attachment.save(); - console.log(`[CDN] Fixed attachment ${attachment.id}`); - } - } }