From d451af3faa0ddba0a4d07b5625e6c73ea7f1b947 Mon Sep 17 00:00:00 2001 From: Giuseppe Ranieri Date: Thu, 19 Mar 2026 10:41:34 +0100 Subject: Implemented tootfinder.ch compatibility mimic Mastodon Behaviour Added aliases list on webfinger response Return the /users/ 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 --- httpd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'httpd.c') diff --git a/httpd.c b/httpd.c index 219af19..f4f772c 100644 --- a/httpd.c +++ b/httpd.c @@ -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")); -- cgit