Repository navigation
Load covers through the asset protocol instead of base64 over IPC - #3
Merged
Merged
Conversation
get_game_cover and get_game_icon read the whole cached image and sent it base64-encoded over IPC (a third larger, plus encode/decode), and every games refresh refetched it because the cards' $effect depended on the whole `game` object. - Both commands now return the cache file's path; the frontend turns it into an asset URL with convertFileSrc. The asset protocol is enabled with its scope limited to $APPDATA/artwork/* (tauri feature protocol-asset, which adds http-range to Cargo.lock) - The URL carries the grid id as ?v= so a newly chosen image is not shadowed by the webview cache - GameCard/GameListRow only depend on id, cover_url and cover_grid_id and ignore results of outdated requests - Cover images are loaded lazily and decoded asynchronously Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019UYcbUoJWjGexas7Tjz9Ko
svelte.svg, tauri.svg and vite.svg came with the project template and are referenced nowhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019UYcbUoJWjGexas7Tjz9Ko
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.
What / why
Covers over the asset protocol.
get_game_coverandget_game_iconused to read the whole cached image and send it as a base64data:URL over IPC, which is about a third larger plus encoding and decoding on both sides.GameCardandGameListRowthen refetched it on every games refresh, because their$effectdepended on the wholegameobject, and each refresh creates a new object.asset://URL withconvertFileSrc(src/lib/stores/steamgriddb.ts).tauri.conf.jsonturns onapp.security.assetProtocolwith its scope limited to$APPDATA/artwork/*, the cover/icon cache dir, top level only. This needs theprotocol-assetfeature ontauri, which adds a single new crate,http-range, toCargo.lock. I edited the lock by hand so the rest of it stays untouched;--lockedaccepts it.?v=<grid id>, so a newly chosen image is not shadowed by the webview cache. The asset protocol ignores the query.id,cover_urlandcover_grid_id(via$derived) and drop results from outdated requests.<img>s getloading="lazy"anddecoding="async".image_data_urlandimage_mimealong with their tests. Thebase64crate stays becauseicons.rsuses it.Static cleanup. Removed the unused template files
static/svelte.svg,tauri.svgandvite.svg. A grep found no references outside.git.Measured
get_game_covercall per card on everyrefreshGames(). After, a call only when the id, cover URL or grid id changes.How tested
bun run check: 0 errors, 0 warnings.bun run testandbun run buildpass.cargo test --locked: 128 passed. Acargo build --locked(dev profile) has no warnings, andtauri-buildaccepts the feature and config combination.cargo build --release(too little disk space in the sandbox; CI covers it), and a manual check in the running app since there's no display. Worth a quick look that covers show up in the grid and list views and that switching a cover updates the card.🤖 Generated with Claude Code
https://claude.ai/code/session_019UYcbUoJWjGexas7Tjz9Ko
Generated by Claude Code