mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
ScreenScraper answers a bad credential set with HTTP 403 and a body that says so, but the login-error check sat after raise_for_status(), so it could never match the case it was written for. The scan logged "403, message='Forbidden'", carried on, and saved every ROM without ScreenScraper metadata, with nothing anywhere naming the credentials. The body is now read before the status is raised, and a 403 raises a ScreenScraperCredentialsError that says which of the two credential sets was refused. The account endpoint is the only one that checks the account password, so a refusal there names SCREENSCRAPER_USER and SCREENSCRAPER_PASSWORD, and a refusal from a scraping endpoint can only be about the RomM developer credentials. That message does not name their variables: they are only semi-protected, and nothing should send an end user looking for them. ScreenScraper's own wording is carried through under both, because it cannot attribute the fault by itself: with a bad developer id, ssuserInfos.php still blames the account. That wording reaches the caller as well as the log, and the credentials travel in the query string, so it is masked with the regex the log formatter already uses. The refusal surfaces as a 403, matching the blacklisted-version case: both mean ScreenScraper refused RomM itself and both need an operator change, unlike the transient failures that map to 503. Never a 401, which the frontend reads as an expired session and acts on by returning the user to the login page. A refusal trips a breaker like the daily quota does: it is reported once and the remaining requests short-circuit rather than spending a round trip per ROM to be told the same thing. The scan-path lookups treat it like an exhausted quota, so a scan degrades to the other providers instead of failing outright. Manual searches still surface the error. The account check reports a refusal but never arms that breaker. ScreenScraper refuses a developer id it accepted a minute earlier while the scraping endpoints keep answering, so leaving the breaker armed cost a working scan all of its ScreenScraper metadata. Only the requests a scan actually needs can take the provider out. prime_account_limits() now warns whether the lookup raised or was swallowed into an empty response, which is what left a scan with no limits, no quota readout and no explanation. The HTTP 401 message gains the half of ScreenScraper's error table it was missing: the API is closed to non-members and inactive members, with server saturation given as the cause. Both attempts had diverging copies of the status ladder, so they now share one mapping. Fixes #4122 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>