diff --git a/README.md b/README.md index bff6ecd5..9adafaec 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,7 @@ ALLOWED_WEBHOOK_DOMAINS | comma-separated list of permitted domains to use in we APP_DOC_URL | doc worker url, set when starting an individual doc worker (other servers will find doc worker urls via redis) APP_HOME_URL | url prefix for home api (home and doc servers need this) APP_STATIC_URL | url prefix for static resources +APP_STATIC_INCLUDE_CUSTOM_CSS | set to "true" to include custom.css (from APP_STATIC_URL) in static pages APP_UNTRUSTED_URL | URL at which to serve/expect plugin content. GRIST_ADAPT_DOMAIN | set to "true" to support multiple base domains (careful, host header should be trustworthy) GRIST_APP_ROOT | directory containing Grist sandbox and assets (specifically the sandbox and static subdirectories). diff --git a/app/client/ui/AppHeader.ts b/app/client/ui/AppHeader.ts index 9bf02740..0024b0c2 100644 --- a/app/client/ui/AppHeader.ts +++ b/app/client/ui/AppHeader.ts @@ -98,7 +98,7 @@ const cssAppLogo = styled('a', ` height: 48px; width: 48px; background-image: var(--icon-GristLogo); - background-size: 22px 22px; + background-size: ${vars.logoSize}; background-repeat: no-repeat; background-position: center; background-color: ${vars.logoBg}; diff --git a/app/client/ui2018/cssVars.ts b/app/client/ui2018/cssVars.ts index 2337e549..b5eb67c4 100644 --- a/app/client/ui2018/cssVars.ts +++ b/app/client/ui2018/cssVars.ts @@ -110,6 +110,7 @@ export const vars = { controlBorderRadius: new CustomProp('border-radius', '4px'), logoBg: new CustomProp('logo-bg', '#040404'), + logoSize: new CustomProp('logo-size', '22px 22px'), toastBg: new CustomProp('toast-bg', '#040404'), }; diff --git a/app/server/lib/ICreate.ts b/app/server/lib/ICreate.ts index a00897c8..6f57df4a 100644 --- a/app/server/lib/ICreate.ts +++ b/app/server/lib/ICreate.ts @@ -29,6 +29,9 @@ export interface ICreate { sessionSecret(): string; // Get configuration information to show at start-up. configurationOptions(): {[key: string]: any}; + // Return a string containing 1 or more HTML tags to insert into the head element of every + // static page. + getExtraHeadHtml?(): string; } export interface ICreateActiveDocOptions { @@ -90,6 +93,13 @@ export function makeSimpleCreator(opts: { if (config) { return config; } } return {}; - } + }, + getExtraHeadHtml() { + let customHeadHtmlSnippet = ''; + if (process.env.APP_STATIC_INCLUDE_CUSTOM_CSS === 'true') { + customHeadHtmlSnippet += ''; + } + return customHeadHtmlSnippet; + }, }; } diff --git a/app/server/lib/sendAppPage.ts b/app/server/lib/sendAppPage.ts index 265fadf8..c45b6d7e 100644 --- a/app/server/lib/sendAppPage.ts +++ b/app/server/lib/sendAppPage.ts @@ -90,10 +90,12 @@ export function makeSendAppPage(opts: { const tagManagerSnippet = needTagManager ? getTagManagerSnippet(process.env.GOOGLE_TAG_MANAGER_ID) : ''; const staticOrigin = process.env.APP_STATIC_URL || ""; const staticBaseUrl = `${staticOrigin}/v/${options.tag || tag}/`; + const customHeadHtmlSnippet = server?.create.getExtraHeadHtml?.() ?? ""; const warning = testLogin ? "