Launcher: automatic SteamGridDB art through a keyless proxy #27
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/zortos293--XSEmu!27
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-27"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@zortos293 on GitHub · 2026-11-27 14:58 UTC · original
zortos293:capy/automatic-steamgriddb-art→main· +5498 −226 · 26 files · 8 commits · openThe launcher now downloads cover, banner, logo and icon art for every library game from SteamGridDB automatically, and nobody has to enter an API key. A small Cloudflare Worker holds one SteamGridDB key as a Worker secret and proxies the read-only endpoints. The key is not in this repository or in the launcher binary.
Proxy (
tools/sgdb-proxy)https://xsemu-sgdb.zortosgames293.workers.dev. It accepts onlyGET, and only on/api/v2/search/autocomplete/<term>and/api/v2/{grids,heroes,logos,icons}/game/<id>, which are the same paths as SteamGridDB's API v2. That means the launcher's code is the same whether it goes through the proxy or uses a personal key.Retry-After.SGDB_API_KEYsecret, every proxied path answers 503.SteamGridDB proxyworkflow runs typecheck, tests and a dry-run bundle.Launcher
CoverArtServiceuses the proxy by default (XSEMU_SGDB_PROXYoverrides it). When the user sets a personal SteamGridDB key, it calls SteamGridDB directly with that key. It now fetches all four kinds and records each image's artist.Retry-Aftertime. A failed lookup is not retried on its own for 10 minutes. Art is fetched only when a game is not cached yet, and after that only on Refresh artwork.index.jsonentries gainv,pinned,logo,icon,customandauthors. Entries written before this change are fetched once more, to get their logos and icons.XCL_NETWORK=0is not affected, because these downloads are made by the launcher, not the game.details-artworkstate. Fixture lookups and tests pointXSEMU_SGDB_PROXYat a closed local port, so nothing reaches the real proxy.Tested
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON, andctestpasses 12 of 12.tst_coverartnow runs the whole lookup against a local fake API: the proxy flow with no Authorization header, the best match, all kinds and artists, the cache hit, local images and a pinned match surviving a refresh, a 429 pause, and the failure back-off.library,details,details-no-art,details-artwork,settings-foldersandsettings-aboutin light and dark.npm run typecheckpasses andnpm testpasses 11 of 11. On the live Worker:/returns 200, an unknown path returns 404,POSTreturns 405, and a search returns 503 until the secret is set.Not tested
AI use
Written by Capy (Claude Opus 5.5) from Zortos's request, reviewed by the Captain thread before merge.
Summary by CodeRabbit
@coderabbitai[bot] on GitHub · 2026-11-27 14:58 UTC · original · edited 2026-11-27 15:38 UTC
No actionable comments were generated in the recent review.
Walkthrough
The change adds a SteamGridDB proxy and updates the launcher to retrieve, cache, manage, and display covers, banners, logos, and icons. The launcher supports automatic and manual game matching, custom images, and artwork refresh controls.
Changes: SteamGridDB artwork
tools/sgdb-proxy/*,.github/workflows/sgdb-proxy.ymllauncher/src/core/CoverArtService.*,launcher/src/app/Services.cpp,launcher/src/core/AppSettings.*,launcher/tests/*launcher/src/pages/ArtworkCard.*,launcher/src/pages/GameDetailsPage.*,launcher/src/pages/LibraryPage.cpp,launcher/src/pages/settings/*,launcher/src/app/DevLever.cpp,launcher/README.mdEstimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature
Sequence Diagram(s)
Merge Risk:
Low · up to
e7520· assessed changes onlyPath filters excluded changed files. This rating applies only to the assessed changes.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the main change: the launcher gets automatic SteamGridDB art through a keyless proxy. The changeset adds the Cloudflare Worker proxy under tools/sgdb-proxy, and the launcher's CoverArtService and ArtworkCard use it by default. The title is specific and matches the primary change, so it passes.
Full details: Description check
Explanation
The description covers the change, the proxy design, the launcher changes, the settings and About updates, and the tests run. It also includes the AI use section and screenshots. It does not follow the repository template exactly. It has no 'Regression run' block, although the template requires one only when crates/xcl/src changes, and this changeset does not touch that path. The 'Tested' section lists Ubuntu and Qt results but does not use the template's hardware/Rust fields, and the template's 'Fixes
#N' or 'Part of#N' line is missing. These gaps are non-critical, so the description is mostly complete.Finishing Touches
Generate unit tests (beta)
Fix failing CI checks
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
CodeRabbit Verify
4a1a56e0-aded-4b19-81e0-1a529bc792a1Reviewing files that changed from the base of the PR and between
a7b99af456ande7520bed0c..github/workflows/sgdb-proxy.ymlIncluded review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
@capy-ai[bot] on GitHub · 2026-11-27 15:02 UTC · original · reviewed
Capy found 4 potential issues (4 medium).
@ -282,0 +483,4 @@void CoverArtService::pump(){if (m_busy || m_queue.isEmpty() || m_resume->isActive())@capy-ai[bot] on GitHub · 2026-11-27 15:02 UTC · original
Queued artwork downloads continue after downloads are disabled
Medium Severity
LibraryPage::rebuild()queues every uncached game up front. If the user turns Download game art off while that queue is running or waiting on Retry-After, completion callbacks and the resume timer still callpump(), which starts subsequent titles without checkingcanLookUp(). The launcher therefore keeps sending game names and downloading artwork despite the opt-out. Recheck the setting before starting queued work and pause or cancel pending jobs when downloads are disabled.@ -0,0 +235,4 @@status->setText(matches.isEmpty() ? QStringLiteral("No games found. Try another name.") : QStringLiteral("%1 found").arg(matches.size()));for (const CoverArtService::Match& m : matches.mid(0, 10)) {auto* b = new Button(m.verified ? QStringLiteral("%1 (verified)").arg(m.name) : m.name, Button::Variant::Secondary, Button::Size::Small);results->addWidget(b);@capy-ai[bot] on GitHub · 2026-11-27 15:02 UTC · original
Search results are added to a dialog fixed at its empty height
Medium Severity
The sizing constraint is in the unchanged
Dialog::open(), which fixes the card height from its current contents. Hereopen()runs before the asynchronous search, when the results layout is empty. Adding up to ten result buttons never recalculates that height, so successful searches force the rows into the original small card, clipping or overlapping controls and preventing reliable match selection. Recalculate the card height after results change, or provide a bounded scrollable results area.@ -318,0 +601,4 @@for (CoverCache::Kind kind : CoverCache::kKinds) {const QString was = old.fetched[size_t(kind)];if (!was.isEmpty() && was != e.file(kind))QFile::remove(dir.filePath(was));@capy-ai[bot] on GitHub · 2026-11-27 15:02 UTC · original
A transient image download failure removes previously cached artwork
Medium Severity
On Refresh artwork for a cached game, an image CDN response such as HTTP 503 makes
downloadImage()advance without setting that kind inm_found. If the remaining API requests finish, this cleanup deletes the previously working image because the replacement filename is empty. The new entry then receives a valid fetched timestamp, so normal requests will not repair the missing art. Previously the existing file reference survived failed downloads. Treat image download errors as lookup failures or preserve the previous image for failed kinds rather than committing their absence.@ -282,0 +454,4 @@QFile::remove(dir.filePath(e.customFile(kind)));QFile::remove(dir.filePath(name));if (!QFile::copy(src.absoluteFilePath(), dir.filePath(name)))return false;@capy-ai[bot] on GitHub · 2026-11-27 15:02 UTC · original
Failed custom-image replacement deletes the previous override
Medium Severity
When a title already has custom art, this code deletes that image before attempting to copy its replacement. If the copy fails, for example because the cache volume is full, it returns false with the old image permanently removed and the cache entry still pointing to it. Selecting the current cached image as the source also deletes the source before copying. Copy into a temporary file and commit successfully before removing the previous override, with an explicit same-file check.
@capy-ai[bot] on GitHub · 2026-11-27 15:07 UTC · original · reviewed
Capy found 1 potential issue (1 medium).
View 1 other finding in Capy.
@capy-ai[bot] on GitHub · 2026-11-27 15:07 UTC · original
On
launcher/src/core/CoverArtService.cppline 615 (outdated):Body-level image download errors still commit cached art as absent
Medium Severity
On refresh or a new lookup, a grid/hero image request returns status 200 and then fails mid-body (the 30 s transfer timeout fires, the connection drops) or returns a non-image content type or an unsaveable body. In that case the
reply->error() == NoError && isImage && ...guard is false, som_found.file(kind)stays empty andnext()runs withoutfailCurrent.finishCurrent()then deletes the previously cached file becauseold.fetched[kind]is non-empty and differs from the empty new name, and commits the entry with a freshfetchedAt.request()treats that entry as current, so the art stays missing until a manual refresh. The 429/5xx change at line 609 covers only status codes; this path needs the same treatment, with a failed read or save routed tofailCurrent(reply)rather thannext(), and a test using a truncated 200 body alongside the existing 503 test.@capy-ai[bot] on GitHub · 2026-11-27 15:11 UTC · original · reviewed
Capy found no issues.
View 2 other findings in Capy.
@ -282,0 +517,4 @@return;}if (m_busy || m_queue.isEmpty() || m_resume->isActive())return;@coderabbitai[bot] on GitHub · 2026-11-27 15:12 UTC · original
Honor the art-downloads setting for queued jobs, and release
m_pendingwhen jobs are dropped.pump()never checkscanLookUp(). Take a library scan that queues many titles. The user then turns off art downloads.setArtLookups(false)does not touch the queue. Each laterfinishCurrentorfailCurrentcallspump(), so every queued job still contacts the proxy. A job held by a 429 also resumes when the timer fires. This contradicts the documented setting ("the user can turn them off").The same state has a second effect.
clearMatcherases the queued jobs for a title at Line 435 but does not updatem_pending. IfcanLookUp()is false, it does not enqueue a replacement.m_pendingthen keeps the title ID with no job left.isPendingstays true, andrequest()andrefresh()return early for that title until the launcher restarts.Drop queued jobs when lookups are off and nothing is running. In that same branch, clear
m_pendingand stop the resume timer. MakeclearMatchremove the ID fromm_pendingwhen it erases a queued job and does not re-enqueue.Proposed fix
Also connect
AppSettings::changedforArtLookupstopumpso the drain runs when the setting changes. Without that connection, the drain runs only on the next job completion or timer event.Committable suggestion
@ -282,0 +563,4 @@m_found.notFound = true;finishCurrent();return;}@coderabbitai[bot] on GitHub · 2026-11-27 15:12 UTC · original
Do not cache an invalid HTTP 200 search body as "not found".
startSearchchecks only the HTTP status. It then passes the body toparseSearch, which returns an empty list for malformed JSON and for"success": false. Take a captive-portal or error page that answers with status 200 and an HTML body.bestbecomes-1,m_found.notFoundbecomestrue, andfinishCurrentstores an entry with a validfetchedAtand the currentkVersion.request()skips every entry that has a validfetchedAtand a current version. This lookup is therefore never retried automatically. The only recovery is a per-game refresh or "clear downloaded art". The same applies tofetchKind: an unparseable 200 body yields an emptyImageand a cached entry with no art.Treat a body that is not valid JSON with
success: trueas a failure. CallfailCurrentso that the 600-second back-off applies and the entry stays uncached. Read the body once and pass it to the failure path, becausefailCurrentcallsreply->readAll()again and gets an empty buffer. Keep a valid{"success":true,"data":[]}response as the "not found" case.Proposed fix
Based on learnings, check the response status and validate the body before treating a response as successful data.
Source: Learnings
@coderabbitai[bot] on GitHub · 2026-11-27 15:12 UTC · original
On
launcher/src/core/CoverArtService.cppline 578 (outdated):Fail the job on HTTP 5xx image responses. Do not record "no art" permanently.
downloadImagecallsfailCurrentonly whenhttpStatus(reply) == 0. A CDN reply with status 500 to 599 has a non-zero status. The reply skips the save block and callsnext().finishCurrentthen writes an entry with a validfetchedAtand no file for that kind.For a first lookup, that kind stays empty and
request()never retries it. For a refresh,finishCurrentdeletes the previously good file, becausewas != e.file(kind). A transient CDN outage therefore causes permanent art loss for that title until the user refreshes again.Route server errors through
failCurrent. Keep 404 and non-image replies as "skip this kind", so a dead link does not retry forever.Proposed fix
Committable suggestion
@ -0,0 +237,4 @@}status->setText(QStringLiteral("Searching..."));status->setRole(Theme::Role::Text3);m_s.covers.search(term->text(), d, [this, d, status, results, game](const QList<CoverArtService::Match>& matches, const QString& error) {@coderabbitai[bot] on GitHub · 2026-11-27 15:12 UTC · original
Ignore search responses that belong to a superseded request.
Each search appends its results to the same list, and nothing cancels or identifies an earlier request. If a second search starts while the first is pending, both responses can appear in the list. The status text also shows only the last response. A row from the earlier search can then be pinned for the current search term.
Give each request a sequence number. The callback should return early when its number is no longer the latest.
Suggested fix
@ -0,0 +40,4 @@}if (!term || term.length > MAX_TERM) return null;const encoded = encodeURIComponent(term);return { cacheKey: `search/${encoded}`, upstream: `${UPSTREAM}/search/autocomplete/${encoded}`, ttl: SEARCH_TTL_S };@coderabbitai[bot] on GitHub · 2026-11-27 15:12 UTC · original
Keep accepted search terms within the KV key limit.
A term containing 57 copies of
界passes the 128-character check. Percent-encoding produces a 520-byte cache key, includingsearch/. Workers KV limits keys to 512 bytes, soCACHE.getfails before the upstream request. (developers.cloudflare.com)Use a bounded digest or a separate, unescaped cache-key representation. Keep percent-encoding for the upstream URL. Cover both the 56-character and 57-character boundary cases.
@ -0,0 +47,4 @@const query = new URLSearchParams();for (const name of ART_PARAMS) {const value = url.searchParams.get(name);if (value !== null && /^[\w,.-]{1,64}$/.test(value)) query.set(name, value);@coderabbitai[bot] on GitHub · 2026-11-27 15:12 UTC · original
Preserve valid MIME filters.
For
?mimes=image%2Fpng,searchParams.getreturnsimage/png. This expression rejects the slash and silently removes the filter. The request then uses the unfiltered upstream URL and cache entry.SteamGridDB's own client defines
image/pngandimage/vnd.microsoft.iconas MIME filter values. (raw.githubusercontent.com) Validatemimesseparately and retain these values. Continue to useURLSearchParamsfor serialization.@coderabbitai[bot] on GitHub · 2026-11-27 15:12 UTC · original · reviewed
Actionable comments posted: 6
7c0eb4bc-c864-4c70-a0c5-12285b16ecaeReviewing files that changed from the base of the PR and between
4507577529anda4bc39912a.tools/sgdb-proxy/package-lock.jsonis excluded by!**/package-lock.json.github/workflows/sgdb-proxy.ymllauncher/README.mdlauncher/src/app/DevLever.cpplauncher/src/app/Services.cpplauncher/src/core/AppSettings.cpplauncher/src/core/AppSettings.hlauncher/src/core/CoverArtService.cpplauncher/src/core/CoverArtService.hlauncher/src/pages/ArtworkCard.cpplauncher/src/pages/ArtworkCard.hlauncher/src/pages/GameDetailsPage.cpplauncher/src/pages/GameDetailsPage.hlauncher/src/pages/LibraryPage.cpplauncher/src/pages/settings/AboutSection.cpplauncher/src/pages/settings/GameFoldersSection.cpplauncher/tests/CMakeLists.txtlauncher/tests/tst_coverart.cpplauncher/tests/tst_settings.cpptools/sgdb-proxy/.gitignoretools/sgdb-proxy/README.mdtools/sgdb-proxy/package.jsontools/sgdb-proxy/src/index.tstools/sgdb-proxy/test/index.test.tstools/sgdb-proxy/tsconfig.jsontools/sgdb-proxy/wrangler.jsoncIncluded review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
@capy-ai[bot] on GitHub · 2026-11-27 15:16 UTC · original · reviewed
Capy found no issues.
View 2 other findings in Capy.
@capy-ai[bot] on GitHub · 2026-11-27 15:19 UTC · original · reviewed
Capy found no issues.
View 1 other finding in Capy.
@capy-ai[bot] on GitHub · 2026-11-27 15:21 UTC · original · reviewed
Capy found no issues.
View 1 other finding in Capy.
@capy-ai[bot] on GitHub · 2026-11-27 15:24 UTC · original · reviewed
Capy found no issues.
View 2 other findings in Capy.
@ -287,2 +613,2 @@QNetworkReply* reply = m_net->get(req);connect(reply, &QNetworkReply::finished, this, [this, reply, titleId, kind, url, next] {req.setTransferTimeout(30000);QNetworkReply* reply = net()->get(req);@coderabbitai[bot] on GitHub · 2026-11-27 15:34 UTC · original
Check download availability before starting the image request.
If downloads are disabled while an artwork metadata request is in flight, its callback still calls
downloadImage. This GET starts without anothercanLookUp()check. The new check infetchKindruns only after this image download completes. Thus, disabling downloads can still start another large download. (raw.githubusercontent.com)Check availability before this GET. If downloads are disabled, discard staged files and release the active job without starting another request.
@coderabbitai[bot] on GitHub · 2026-11-27 15:34 UTC · original · reviewed
Actionable comments posted: 1
ef537b05-01dd-422c-b31a-18b65e4d755bReviewing files that changed from the base of the PR and between
a4bc39912aanda7b99af456.launcher/src/app/DevLever.cpplauncher/src/core/CoverArtService.cpplauncher/src/core/CoverArtService.hlauncher/src/pages/ArtworkCard.cpplauncher/src/pages/ArtworkCard.hlauncher/tests/tst_coverart.cppIncluded review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
@capy-ai[bot] on GitHub · 2026-11-27 15:37 UTC · original · reviewed
Capy found no issues.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.