From 7d936efb2f37db42c3e57ee9a915ed4d5ab8e25f Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Sat, 27 Aug 2022 05:18:48 +0200 Subject: Cleanup, reformat, fix some todos, git hook fixup! Cleanup, reformat, fix some todos, git hook --- src/api/middlewares/TestClient.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/api/middlewares/TestClient.ts') diff --git a/src/api/middlewares/TestClient.ts b/src/api/middlewares/TestClient.ts index 9090840e..e4daaf25 100644 --- a/src/api/middlewares/TestClient.ts +++ b/src/api/middlewares/TestClient.ts @@ -10,6 +10,7 @@ import { patchFile } from ".."; const prettier = require("prettier"); const AssetsPath = path.join(__dirname, "..", "..", "..", "assets"); +const cfg = Config.get(); export default function TestClient(app: Application) { const agent = new ProxyAgent(); @@ -81,22 +82,22 @@ export default function TestClient(app: Application) { return res.send(fs.readFileSync(assetCacheItem.FilePath)); }); app.get("/developers*", (_req: Request, res: Response) => { - const { useTestClient } = Config.get().client; res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24); res.set("content-type", "text/html"); - if (!useTestClient) return res.send("Test client is disabled on this instance. Use a stand-alone client to connect this instance."); + if (!cfg.client.useTestClient) + return res.send("Test client is disabled on this instance. Use a stand-alone client to connect this instance."); res.send(fs.readFileSync(path.join(__dirname, "..", "..", "..", "assets", "developers.html"), { encoding: "utf8" })); }); app.get("*", (req: Request, res: Response) => { - const { useTestClient } = Config.get().client; res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24); res.set("content-type", "text/html"); if (req.url.startsWith("/api") || req.url.startsWith("/__development")) return; - if (!useTestClient) return res.send("Test client is disabled on this instance. Use a stand-alone client to connect this instance."); + if (!cfg.client.useTestClient) + return res.send("Test client is disabled on this instance. Use a stand-alone client to connect this instance."); if (req.url.startsWith("/invite")) return res.send(html.replace("9b2b7f0632acd0c5e781", "9f24f709a3de09b67c49")); res.send(html); -- cgit 1.5.1