From a24cb9987c9488df9ec0ad0ab7b084d3482a4792 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 22 Feb 2022 21:02:38 -0800 Subject: [PATCH] fix: Do not prefetch JS bundles on public share links --- server/routes/index.ts | 3 ++- shared/i18n/locales/en_US/translation.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/routes/index.ts b/server/routes/index.ts index 8f89beac4..84a0dee88 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -52,6 +52,7 @@ const renderApp = async (ctx: Context, next: Next, title = "Outline") => { return next(); } + const { shareId } = ctx.params; const page = await readIndexFile(ctx); const environment = ` window.env = ${JSON.stringify(presentEnv(env))}; @@ -60,7 +61,7 @@ const renderApp = async (ctx: Context, next: Next, title = "Outline") => { .toString() .replace(/\/\/inject-env\/\//g, environment) .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 || ""); }; diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 0dd9a8c4a..c08836c85 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -25,7 +25,6 @@ "Templatize": "Templatize", "Create template": "Create template", "Home": "Home", - "Search": "Search", "Search documents for \"{{searchQuery}}\"": "Search documents for \"{{searchQuery}}\"", "Drafts": "Drafts", "Templates": "Templates", @@ -123,6 +122,7 @@ "Choose icon": "Choose icon", "Loading": "Loading", "Loading editor": "Loading editor", + "Search": "Search", "Default access": "Default access", "View and edit": "View and edit", "View only": "View only",