diff --git a/server/routes/app.ts b/server/routes/app.ts index 1363df7a6..532fc2309 100644 --- a/server/routes/app.ts +++ b/server/routes/app.ts @@ -65,7 +65,9 @@ export const renderApp = async ( const { shareId } = ctx.params; const page = await readIndexFile(); const environment = ` - window.env = ${JSON.stringify(presentEnv(env, options.analytics))}; + `; const entry = "app/index.tsx"; const scriptTags = isProduction @@ -85,13 +87,14 @@ export const renderApp = async ( ctx.body = page .toString() - .replace(/\/\/inject-env\/\//g, environment) - .replace(/\/\/inject-title\/\//g, escape(title)) - .replace(/\/\/inject-description\/\//g, escape(description)) - .replace(/\/\/inject-canonical\/\//g, canonical) - .replace(/\/\/inject-prefetch\/\//g, shareId ? "" : prefetchTags) - .replace(/\/\/inject-slack-app-id\/\//g, env.SLACK_APP_ID || "") - .replace(/\/\/inject-script-tags\/\//g, scriptTags); + .replace(/\{env\}/g, environment) + .replace(/\{title\}/g, escape(title)) + .replace(/\{description\}/g, escape(description)) + .replace(/\{canonical-url\}/g, canonical) + .replace(/\{prefetch\}/g, shareId ? "" : prefetchTags) + .replace(/\{slack-app-id\}/g, env.SLACK_APP_ID || "") + .replace(/\{cdn-url\}/g, env.CDN_URL || "") + .replace(/\{script-tags\}/g, scriptTags); }; export const renderShare = async (ctx: Context, next: Next) => { diff --git a/server/static/index.html b/server/static/index.html index cf1d9b03e..3c30ff353 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -1,36 +1,32 @@
-