forgot to strip protocol
This commit is contained in:
parent
23f4ef1070
commit
64a4d6b2be
@ -167,18 +167,27 @@ export class SpacebarServer extends Server {
|
|||||||
// caca
|
// caca
|
||||||
app.get(/^(?!\/(api|\.well-known)).*$/, async (req, res) => {
|
app.get(/^(?!\/(api|\.well-known)).*$/, async (req, res) => {
|
||||||
let html = await fs.readFile(
|
let html = await fs.readFile(
|
||||||
path.join(PUBLIC_ASSETS_FOLDER, "index.html"),
|
path.join(PUBLIC_ASSETS_FOLDER, "index.html"),
|
||||||
"utf8"
|
"utf8"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const baseUrl =
|
||||||
|
Config.get().api.endpointPublic
|
||||||
|
?.split("/api")[0]
|
||||||
|
?.replace(/^https?:/, "") ?? "";
|
||||||
|
|
||||||
|
const cdnUrl =
|
||||||
|
Config.get().cdn.endpointPublic
|
||||||
|
?.replace(/^https?:/, "") ?? "";
|
||||||
|
|
||||||
html = html
|
html = html
|
||||||
.replaceAll("%BASE_URL%", Config.get().api.endpointPublic?.split("/api")[0] ?? "")
|
.replaceAll("%BASE_URL%", baseUrl)
|
||||||
.replaceAll("%GATEWAY_URL%", Config.get().gateway.endpointPublic ?? "")
|
.replaceAll("%GATEWAY_URL%", Config.get().gateway.endpointPublic ?? "")
|
||||||
.replaceAll("%CDN_URL%", Config.get().cdn.endpointPublic ?? "")
|
.replaceAll("%CDN_URL%", cdnUrl)
|
||||||
.replaceAll("%VAPID_KEY%", Config.get().webPush.publicVapidKey ?? "");
|
.replaceAll("%VAPID_KEY%", Config.get().webPush.publicVapidKey ?? "");
|
||||||
|
|
||||||
res.type("html").send(html);
|
res.type("html").send(html);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.app.use(ErrorHandler);
|
this.app.use(ErrorHandler);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user