1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-06 10:52:31 +01:00

Make the test client togglable

This commit is contained in:
Thesourtimes 2021-12-15 05:41:21 +03:00
parent 21f76f6ca7
commit 87f7c9b7a3
2 changed files with 10 additions and 2 deletions

View File

@ -84,12 +84,14 @@ export default function TestClient(app: Application) {
return res.send(buffer);
});
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")) return;
if(req.url.startsWith("/api")) return;
if(!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);
});
}

View File

@ -172,6 +172,9 @@ export interface ConfigValue {
allowTemplateCreation: Boolean;
allowDiscordTemplates: Boolean;
allowRaws: Boolean;
},
client: {
useTestClient: Boolean;
}
}
@ -346,5 +349,8 @@ export const DefaultConfigOptions: ConfigValue = {
allowTemplateCreation: true,
allowDiscordTemplates: true,
allowRaws: false
},
client: {
useTestClient: true
}
};