fix: Do not prefetch JS bundles on public share links

This commit is contained in:
Tom Moor
2022-02-22 21:02:38 -08:00
parent 8832808fbe
commit a24cb9987c
2 changed files with 3 additions and 2 deletions

View File

@@ -52,6 +52,7 @@ const renderApp = async (ctx: Context, next: Next, title = "Outline") => {
return next(); return next();
} }
const { shareId } = ctx.params;
const page = await readIndexFile(ctx); const page = await readIndexFile(ctx);
const environment = ` const environment = `
window.env = ${JSON.stringify(presentEnv(env))}; window.env = ${JSON.stringify(presentEnv(env))};
@@ -60,7 +61,7 @@ const renderApp = async (ctx: Context, next: Next, title = "Outline") => {
.toString() .toString()
.replace(/\/\/inject-env\/\//g, environment) .replace(/\/\/inject-env\/\//g, environment)
.replace(/\/\/inject-title\/\//g, title) .replace(/\/\/inject-title\/\//g, title)
.replace(/\/\/inject-prefetch\/\//g, prefetchTags) .replace(/\/\/inject-prefetch\/\//g, shareId ? "" : prefetchTags)
.replace(/\/\/inject-slack-app-id\/\//g, process.env.SLACK_APP_ID || ""); .replace(/\/\/inject-slack-app-id\/\//g, process.env.SLACK_APP_ID || "");
}; };

View File

@@ -25,7 +25,6 @@
"Templatize": "Templatize", "Templatize": "Templatize",
"Create template": "Create template", "Create template": "Create template",
"Home": "Home", "Home": "Home",
"Search": "Search",
"Search documents for \"{{searchQuery}}\"": "Search documents for \"{{searchQuery}}\"", "Search documents for \"{{searchQuery}}\"": "Search documents for \"{{searchQuery}}\"",
"Drafts": "Drafts", "Drafts": "Drafts",
"Templates": "Templates", "Templates": "Templates",
@@ -123,6 +122,7 @@
"Choose icon": "Choose icon", "Choose icon": "Choose icon",
"Loading": "Loading", "Loading": "Loading",
"Loading editor": "Loading editor", "Loading editor": "Loading editor",
"Search": "Search",
"Default access": "Default access", "Default access": "Default access",
"View and edit": "View and edit", "View and edit": "View and edit",
"View only": "View only", "View only": "View only",