fix(web): serve the Predbat logo locally instead of from GitHub - #4568
Open
chalfontchubby wants to merge 2 commits into
Open
fix(web): serve the Predbat logo locally instead of from GitHub#4568chalfontchubby wants to merge 2 commits into
chalfontchubby wants to merge 2 commits into
Conversation
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.
Owner
|
Good idea @chalfontchubby but the downloader will need updating to include the images |
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. |
Collaborator
Author
|
I'll fail safe if the image isn't in the apps dir. |
Owner
Yes, suggest adding the installer update in the same PR, the fallback should be fine until its rolled out |
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>
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.
Summary
raw.githubusercontent.comon 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).apps/predbat/bat_logo*.{svg,png}, same as the existing.sokernel 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
web_logo_imageunit test: route serves each logo with the right content type, 404s for anything not on the whitelist, and the page header no longer referencesgithubusercontent.com./run_all --test web_logo_image --test web_functions --test web_annual_routes_registeredpasses./run_pre_commitpasses (black, ruff, cspell, etc.)🤖 Generated with Claude Code