Skip to content

fix(web): serve the Predbat logo locally instead of from GitHub - #4568

Open
chalfontchubby wants to merge 2 commits into
mainfrom
fix/local-logo-images
Open

fix(web): serve the Predbat logo locally instead of from GitHub#4568
chalfontchubby wants to merge 2 commits into
mainfrom
fix/local-logo-images

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Summary

  • The dashboard's favicon and header logo were fetched from raw.githubusercontent.com on every page load; a GitHub outage or 429 rate limit left every page hanging for ~15s before it would render (Predbat Dash doesn't render until bat_logo_light.png logo downloads or fails #4562).
  • The logo images now ship alongside the app (apps/predbat/bat_logo*.{svg,png}, same as the existing .so kernel binaries) and are served from a new local /images/{filename} route, whitelisted to just those three files.
  • docs/images/bat_logo* were removed rather than duplicated - nothing else in the repo referenced them, so there's a single canonical copy with no drift risk.

Fixes #4562

Test plan

  • New web_logo_image unit test: route serves each logo with the right content type, 404s for anything not on the whitelist, and the page header no longer references githubusercontent.com
  • ./run_all --test web_logo_image --test web_functions --test web_annual_routes_registered passes
  • ./run_pre_commit passes (black, ruff, cspell, etc.)

🤖 Generated with Claude Code

The dashboard fetched its favicon and header logo from
raw.githubusercontent.com on every page load, so a GitHub outage or
429 rate limit left every page hanging for ~15s before it would
render. The logo now ships alongside the app and is served from a
local route, with no network dependency.
@springfall2008

Copy link
Copy Markdown
Owner

Good idea @chalfontchubby but the downloader will need updating to include the images

@chalfontchubby

Copy link
Copy Markdown
Collaborator Author

And that needs to be merged/installed before we can use it in the version it downloads. Same as the "wb" issue on the .so files.

@chalfontchubby

Copy link
Copy Markdown
Collaborator Author

I'll fail safe if the image isn't in the apps dir.

@springfall2008

Copy link
Copy Markdown
Owner

And that needs to be merged/installed before we can use it in the version it downloads. Same as the "wb" issue on the .so files.

Yes, suggest adding the installer update in the same PR, the fallback should be fine until its rolled out

@chalfontchubby

Copy link
Copy Markdown
Collaborator Author

I believe so long as 8ab260b — about 8 months old - is there, you don't have a manifest - the svg files are in a dir that should be autodetected and no change is needed to the downloader.... (?)

The existing web_logo_image tests covered an unknown filename 404ing,
but not the actual #4568 scenario: a whitelisted filename whose file
is genuinely absent on disk (e.g. an old download.py hasn't fetched
the newly-added images yet). html_logo_image already handles this
correctly (catches OSError, returns 404), this just adds the missing
coverage for it.

Traced the full download.py pipeline separately - it's fully driven
by a live GitHub directory listing with no static file list or
extension filter anywhere, and predbat_update_move() verifies and
moves the whole staged file set (code and images alike) as one atomic
batch, so no download.py changes are needed for this to work on any
reasonably current install.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Predbat Dash doesn't render until bat_logo_light.png logo downloads or fails

2 participants