diff --git a/client_test/index.html b/client_test/index.html
index bacc5465..1a979419 100644
--- a/client_test/index.html
+++ b/client_test/index.html
@@ -15,7 +15,7 @@
API_VERSION: 9,
GATEWAY_ENDPOINT: `${location.protocol === "https:" ? "wss://" : "ws://"}${location.hostname}:3002`,
WEBAPP_ENDPOINT: "",
- CDN_HOST: `//${location.hostname}:3003`,
+ CDN_HOST: `${location.hostname}:3003`,
ASSET_ENDPOINT: "",
MEDIA_PROXY_ENDPOINT: "https://media.discordapp.net",
WIDGET_ENDPOINT: `//${location.host}/widget`,
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}",`);
|