Add reverse proxy endpoint

This commit is contained in:
2026-01-02 00:29:56 -03:00
parent 5bb1f42bb3
commit 462a21604b
4 changed files with 166 additions and 22 deletions
+12 -2
View File
@@ -18,8 +18,9 @@ async fn docs() -> &'static str {
dedent!(
"
Welcome to Nyeki's API! This is a tiny API I built to provide some basic information I
found myself needing in more than one place. This at the moment only includes Discord and
GitHub profiles, but I may add more stuff as I see myself needing it.
found myself needing in more than one place. This at the moment only includes Discord
profiles, GitHub profiles, and a reverse proxy, but I may add more stuff as I see myself
needing it.
The API is versioned, so API endpoints will always be prefixed with `/v{version}`. The
current version is 1 (i.e. stuff is prefixed by `/v1`). All responses are JSON (or
@@ -88,6 +89,15 @@ async fn docs() -> &'static str {
for supported sources).
- `source`: The source of the profile (either `discord` or `github`).
GET /v1/proxy
Proxies a request to the given URL.
Note that headers are not forwarded and neither is the request body. This is a
simple GET proxy.
Query parameters:
- `url`: The URL to proxy the request to.
They all take 2 query parameters: `id` and `source`. The `id` is the ID of the user you
want to get the profile of, and the `source` is the source of the profile. The source can
be either `discord` or `github`.