summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-09 20:44:41 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-09 20:44:41 +0200
commitc66a9052745d591137e96080869e5316a41153d3 (patch)
tree43372c32afb1b9e6f90f702fa63c4907b963cc38 /src
parent:bug: fix cdn endpoint (diff)
downloadserver-c66a9052745d591137e96080869e5316a41153d3.tar.xz
:bug: fix cdn endpoint
Diffstat (limited to 'src')
-rw-r--r--src/middlewares/TestClient.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/middlewares/TestClient.ts b/src/middlewares/TestClient.ts
index 49cae118..4ebdd010 100644
--- a/src/middlewares/TestClient.ts
+++ b/src/middlewares/TestClient.ts
@@ -55,8 +55,8 @@ export default function TestClient(app: Application) {
 		res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
 		res.set("content-type", "text/html");
 		var html = indexHTML;
-		const CDN_ENDPOINT = Config.get().cdn.endpoint || process.env.CDN;
-		const GATEWAY_ENDPOINT = Config.get().gateway.endpoint || process.env.GATEWAY;
+		const CDN_ENDPOINT = Config.get()?.cdn.endpoint || process.env.CDN;
+		const GATEWAY_ENDPOINT = (Config.get()?.gateway.endpoint || process.env.GATEWAY || "").replace(/(https?)?(:\/\/?)/g, "");
 
 		if (CDN_ENDPOINT) html = html.replace(/CDN_HOST: .+/, `CDN_HOST: "${CDN_ENDPOINT}",`);
 		if (GATEWAY_ENDPOINT) html = html.replace(/GATEWAY_ENDPOINT: .+/, `GATEWAY_ENDPOINT: "${GATEWAY_ENDPOINT}",`);