rime icon indicating copy to clipboard operation
rime copied to clipboard

feat: sourcehut auto-discovery

Open algernon opened this issue 2 years ago • 2 comments

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.

algernon avatar Oct 31 '23 12:10 algernon

I'll maybe do this then, thanks for finding this!

cafkafk avatar Oct 31 '23 12:10 cafkafk

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.

algernon avatar Nov 04 '23 10:11 algernon