diff options
| author | Giuseppe Ranieri <giuseppe@ranieri.dev> | 2026-03-19 10:41:34 +0100 |
|---|---|---|
| committer | Giuseppe Ranieri <giuseppe@ranieri.dev> | 2026-03-19 10:41:34 +0100 |
| commit | d451af3faa0ddba0a4d07b5625e6c73ea7f1b947 (patch) | |
| tree | d45701f7beaf3863d3b8482d7db603c46b63ad76 /httpd.c | |
| parent | 72be32d06fc6ea5a8fba944fe9b3305873810f67 (diff) | |
Implemented tootfinder.ch compatibility mimic Mastodon Behaviour
Added aliases list on webfinger response
Return the /users/<actor> in the webfinger response ( mimic Mastodon )
Implemented /users endpoint redirect to access actor profile
Files changed:
modified: data.c
modified: httpd.c
modified: snac.h
modified: webfinger.c
Diffstat (limited to 'httpd.c')
| -rw-r--r-- | httpd.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -502,6 +502,13 @@ void httpd_connection(FILE *f) if (xs_startswith(q_path, p)) q_path = xs_crop_i(q_path, strlen(p), 0); + /* add users endpoint redirection mimic Mastodon behaviour */ + const char *users_endpoint = "/users"; + if (xs_startswith(q_path, users_endpoint)) { + q_path = xs_crop_i(q_path, strlen(users_endpoint), 0); + status = HTTP_STATUS_FOUND; + } + if (strcmp(method, "GET") == 0 || strcmp(method, "HEAD") == 0) { /* cascade through */ if (status == 0) @@ -607,6 +614,9 @@ void httpd_connection(FILE *f) if (status == HTTP_STATUS_SEE_OTHER) headers = xs_dict_append(headers, "location", body); + if (status == HTTP_STATUS_FOUND) + headers = xs_dict_append(headers, "location", xs_fmt("%s%s", p, q_path)); + if (status == HTTP_STATUS_UNAUTHORIZED && body) { xs *www_auth = xs_fmt("Basic realm=\"@%s@%s snac login\"", body, xs_dict_get(srv_config, "host")); |