summary refs log tree commit diff
path: root/src/api/middlewares/TestClient.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/middlewares/TestClient.ts')
-rw-r--r--src/api/middlewares/TestClient.ts9
1 files changed, 5 insertions, 4 deletions
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);