1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

🐛 fix cdn endpoint

This commit is contained in:
Flam3rboy 2021-08-09 20:44:41 +02:00
parent 2c5cdec381
commit c66a905274
2 changed files with 3 additions and 3 deletions

View File

@ -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`,

View File

@ -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}",`);