Fix 403 game lookups by not reusing cached client User-Agent (#89) - #97
Merged
Conversation
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.
Fixes #89.
Problem
The proxy identified itself to RetroAchievements with
ua::last— the User-Agent of whichever emulator most recently passed through it. RA reads the first token of the User-Agent as the client identity and answers blocked clients with403 unsupported_clienton every endpoint, includingr=gameid.So one emulator RA rejects poisoned every request the proxy made on its own behalf, for every console. The reporter's Game Boy folder scan failed because a GameCube emulator's identity was cached.
ua::lastis exempt from cache eviction, so it never expired.Worth noting: RA sets
clientVersion = 'Unknown'when it can't parse a version out of the User-Agent, and that sorts below every minimum, so a current build with a versionless UA is rejected exactly like an ancient one.Fix
New
self_user_agent()used for every request the proxy originates — manual ROM caching, preview images, the reachability probe, and the background refresher. Genuinely forwarded emulator requests still carry the client's real User-Agent viabuild_forward_headers, and pending awards still replay under the User-Agent that earned them.Storage.load_user_agentis removed; it existed only to feed this bug.Diagnostics
http_getwas discarding RA's response body, so the only thing that ever surfaced wasHTTP Error 403: Forbidden. It now extracts RA's ownCode/Errorand logs the outgoing User-Agent:Verification
Confirmed against the live RA API using the exact hash from the report:
Reporter confirmed the test build resolves the issue on ROCKNIX.
Existing installs self-heal on upgrade — the poisoned row is simply no longer read.
Notes
PROXY_UA_TAGnow derives fromAPP_VERSIONinstead of being a second hardcoded copy that had drifted.APP_VERSIONis bumped to1.10.0-alpha7. It is shared by the muOS, Knulli and Onion bundles, whose own build scripts still default toalpha2filenames.RomScanner.kt,MainViewModel.kt,AwardFlusher.kt,ProxyService.kt) and is not addressed here.