Only server-side render non-auth systems
parent
e2aa869660
commit
dbabba7326
|
@ -113,8 +113,9 @@ export class HttpServer {
|
||||||
|
|
||||||
// Replaces some template variables in index.html in a rather ad-hoc manner, but YOLO
|
// Replaces some template variables in index.html in a rather ad-hoc manner, but YOLO
|
||||||
async renderHtmlPage(spaceServer: SpaceServer, pageName: string) {
|
async renderHtmlPage(spaceServer: SpaceServer, pageName: string) {
|
||||||
console.log("Server side rendering", pageName);
|
|
||||||
let html = "";
|
let html = "";
|
||||||
|
if (!spaceServer.auth) {
|
||||||
|
// Only attempt server-side rendering when this site is not protected by auth
|
||||||
try {
|
try {
|
||||||
const { data } = await spaceServer.spacePrimitives.readFile(
|
const { data } = await spaceServer.spacePrimitives.readFile(
|
||||||
`${pageName}.md`,
|
`${pageName}.md`,
|
||||||
|
@ -127,6 +128,8 @@ export class HttpServer {
|
||||||
console.error("Error server-side rendering page", e);
|
console.error("Error server-side rendering page", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// TODO: Replace this with a proper template engine
|
||||||
return this.clientAssetBundle.readTextFileSync(".client/index.html")
|
return this.clientAssetBundle.readTextFileSync(".client/index.html")
|
||||||
.replace(
|
.replace(
|
||||||
"{{SPACE_PATH}}",
|
"{{SPACE_PATH}}",
|
||||||
|
|
Loading…
Reference in New Issue