feat(brand): operator brand-logo override (#70)#71
Merged
Conversation
… logo.svg Move the hardcoded inline brand-logo from base.html into a per-instance FuncMap helper backed by an embedded asset at web/static/img/brand-logo.svg. Phase 2 will extend loadBrandLogo to read a STATIC_PATH overlay; for now this is behavior-preserving. Embedded read failure aborts startup (build invariant). Deletes the stale, unreferenced web/static/img/logo.svg.
Read <STATIC_PATH>/img/brand-logo.svg at startup. Validates well-formed XML with <svg> root, caps at 32 KiB via io.LimitReader, injects class="brand-logo" when absent (string-scan, preserves operator formatting). Silent fallback when the file is absent; logs a single warning on malformed/oversize/wrong-root overlays. Operator filesystem is the trust boundary (same model as CSS/JS overlay since v3.10.2). Closes #70.
Add docs/configuration.md#branding section with starter SVG, validation contract, theme-reactivity guidance, and the overlay-eligible brand asset inventory. One-line pointer added in GETTING-STARTED's filesystem-overrides paragraph. CHANGELOG entry under Unreleased.
Three self-review fixups surfaced by /code-review: - NewTemplateService now calls cancel() before returning the loadTemplates error, matching the obcache and loadBrandLogo failure paths so the goflow scheduler goroutine started by setupTemplateMaintenance can shut down cleanly. Pre-existing leak made visible by adjacent changes. - loadBrandLogo runs the embedded fallback through injectBrandLogoClass, so CSS sizing keeps working even if a future refactor drops the class from the embedded SVG. Latent today, structural going forward. - GetTemplateFuncMap docstring now states the returned map is stateless; per-instance helpers like brandLogoSVG live on TemplateService.funcMap.
Collaborator
Author
Code reviewNo issues found. Three sub-80 findings (cancel-leak on adjacent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #70. Drop your SVG at
<STATIC_PATH>/img/brand-logo.svgto swap the header logo — the last template-embedded brand surface becomes operator-overridable, completing what v3.10.2's STATIC_PATH overlay started for favicons, fonts, themes, and OG images. Validates well-formed XML with<svg>root, caps at 32 KiB viaio.LimitReader, injectsclass="brand-logo"when absent (string-scan, preserves operator formatting), silently falls back when the file is missing, warns-and-falls-back on validation failure. Operator filesystem is the trust boundary, same model as STATIC_PATH-overlaid CSS/JS since v3.10.2 — documented indocs/configuration.md#branding. Surfaced from log.1mb.dev M3-polish-2 wave-3 feedback.Three atomic commits: refactor extracts the inline SVG to a per-instance FuncMap helper backed by an embedded asset (and drops the unused
logo.svg); feat adds the overlay read + validation + class injection; docs add the Branding section with starter SVG, override contract, and the overlay-eligible asset inventory. Embedded read failure aborts startup as a build invariant. 15 new tests cover embedded-only, overlay-replaces, class injection (missing/preserves/quoted-attrs/single-quotes/newlines/non-svg), all three validation-failure paths, and end-to-end render through TemplateService.