Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug(forgejo): Improved auto-detection
Previously, the Forgejo/Gitea auto-detection worked by hittin an endpoint that only exists on these forges, out of the ones we support. But it had no indication other than its existence that it is a Forgejo instance. While looking at other ways to identify these, I found the `/swagger.v1.json` endpoint. It has the full API documentation in a Swagger JSON format, and includes an `info.title` key, which *does* mention "Gitea API" or "Forgejo API", depending on the forge. It's a rather large document, however. Luckily, we don't need the whole document! This file is part of the web UI, not the API itself, and as such, includes cookies! One of those cookies is `i_like_gitea` (for both Forgejo and Gitea). As such, we can do a HEAD request, and check the cookie. This is both more reliable than the old method, and involves less network traffic too. Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
- Loading branch information