rime
rime copied to clipboard
feat: sourcehut auto-discovery
I don't have the bandwidth at the moment to implement this, but I did a little bit of research and thinking, which I'm sharing here: similar to Forgejo, the autodetection is a little bit fragile. There's no endpoint we can hit that'd 100% tell us its sourcehut. However, sourcehut has API endpoints that are unique among the supported forges (just like Forgejo): /api/user will return a 401, which tells us that the endpoint exists. It's a rather generic endpoint, but none of the other forges use it, so it's not terrible.
Thus, checking if /api/user returns 401 is a reasonably strong indication that we're dealing with SourceHut.
I'll maybe do this then, thanks for finding this!
Hrm. There's a downside of /api/user: the REST API is in the process of being deprecated, and replaced with a GraphQL API, which is at /query - and that one is way too generic, and there's nothing particularly identifiable there.