feat(playmatch): support self-hosted Playmatch instances#3827
Merged
Conversation
Add a PLAYMATCH_API_URL env var (defaulting to the public instance) so users can point RomM at a self-hosted Playmatch deployment. The handler now derives all endpoints from this configurable base URL. Fixes #3820 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Greptile SummaryThis PR makes the Playmatch API base URL configurable. The main changes are:
Confidence Score: 4/5Common Docker and LAN Playmatch deployments remain unreachable through the changed configuration path.
backend/config/init.py and the SSRF handling used by the Playmatch HTTP requests
|
| Filename | Overview |
|---|---|
| backend/config/init.py | Adds the configurable Playmatch base URL, but common private self-hosted destinations remain blocked by outbound request validation. |
| backend/handler/metadata/playmatch_handler.py | Uses the configured base URL consistently for all existing Playmatch endpoints. |
| env.template | Documents the optional Playmatch API URL override. |
Reviews (1): Last reviewed commit: "feat(playmatch): support self-hosted Pla..." | Re-trigger Greptile
A self-hosted PLAYMATCH_API_URL on a LAN IP, localhost, or a Docker service name is rejected by the shared HTTP client's SSRF defense before connecting, so health checks and lookups fail. Add a narrowly scoped allowlist, derived from the admin-configured provider URL, that both SSRF gates (the static URL hook and the connect-time backend) honor. The exception is matched by exact host and port, and the public default URL is unaffected since public addresses already pass. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Description
Explain the changes or enhancements you are proposing with this pull request.
Adds a
PLAYMATCH_API_URLenvironment variable so users can point RomM at a self-hosted Playmatch instance instead of the public one. This helps users on slow connections or those who prefer to run their own instance (as Playmatch encourages).PLAYMATCH_API_URLconfig, defaulting to the public instance (https://playmatch.retrorealm.dev/api/v2); trailing slashes are stripped so endpoint paths always join cleanly.PlaymatchHandlernow derives itsidentify,health, andsuggestionendpoints from this configurable base URL.env.template.SSRF handling for private destinations
A typical self-hosted URL (
http://playmatch:8000,localhost, or a LAN IP) points at a private/internal address, which the shared HTTP client's SSRF defense rejects before connecting, so health checks and lookups would fail. To support these deployments:SSRF_ALLOWED_INTERNAL_ORIGINS) derived only from admin-configured provider URLs (currently justPLAYMATCH_API_URL).Behavior is unchanged for existing users, since the default remains the public URL. Self-hosters just set
PLAYMATCH_API_URL.Fixes #3820
Checklist
Please check all that apply.
Screenshots (if applicable)
AI assistance: this change was written with the help of Claude Code (Anthropic). All code was reviewed by the author.
🤖 Generated with Claude Code