summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authorGravatar grunfink2025-08-14 11:17:49 +0200
committerGravatar grunfink2025-08-14 11:17:49 +0200
commitcd05398133a1ed7b4e953e3a4d363273b58ad970 (patch)
treeb7af77fdeb7e8f9edf578528ccf03a5407aef924 /httpd.c
parentUpdated RELEASE_NOTES. (diff)
downloadsnac2-cd05398133a1ed7b4e953e3a4d363273b58ad970.tar.gz
snac2-cd05398133a1ed7b4e953e3a4d363273b58ad970.tar.xz
snac2-cd05398133a1ed7b4e953e3a4d363273b58ad970.zip
Added nodeinfo 2.1 support.
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/httpd.c b/httpd.c
index d01eb9c..71e04bf 100644
--- a/httpd.c
+++ b/httpd.c
@@ -283,9 +283,10 @@ int server_get_handler(xs_dict *req, const char *q_path,
283 status = HTTP_STATUS_OK; 283 status = HTTP_STATUS_OK;
284 *ctype = "application/json; charset=utf-8"; 284 *ctype = "application/json; charset=utf-8";
285 *body = xs_fmt("{\"links\":[" 285 *body = xs_fmt("{\"links\":["
286 "{\"rel\":\"http:/" "/nodeinfo.diaspora.software/ns/schema/2.0\"," 286 "{\"rel\":\"http:/" "/nodeinfo.diaspora.software/ns/schema/2.0\",\"href\":\"%s/nodeinfo_2_0\"},"
287 "\"href\":\"%s/nodeinfo_2_0\"}]}", 287 "{\"rel\":\"http:/" "/nodeinfo.diaspora.software/ns/schema/2.1\",\"href\":\"%s/nodeinfo_2_1\"}"
288 srv_baseurl); 288 "]}",
289 srv_baseurl, srv_baseurl);
289 } 290 }
290 else 291 else
291 if (strcmp(q_path, "/.well-known/host-meta") == 0) { 292 if (strcmp(q_path, "/.well-known/host-meta") == 0) {
@@ -303,6 +304,19 @@ int server_get_handler(xs_dict *req, const char *q_path,
303 *body = nodeinfo_2_0(); 304 *body = nodeinfo_2_0();
304 } 305 }
305 else 306 else
307 if (strcmp(q_path, "/nodeinfo_2_1") == 0) {
308 xs *s = nodeinfo_2_0();
309 xs *j = xs_json_loads(s);
310
311 j = xs_dict_set(j, "version", "2.1");
312 j = xs_dict_set_path(j, "software.repository", WHAT_IS_SNAC_URL);
313 j = xs_dict_set_path(j, "software.homepage", SNAC_DOC_URL);
314
315 status = HTTP_STATUS_OK;
316 *ctype = "application/json; charset=utf-8";
317 *body = xs_json_dumps(j, 4);
318 }
319 else
306 if (strcmp(q_path, "/robots.txt") == 0) { 320 if (strcmp(q_path, "/robots.txt") == 0) {
307 status = HTTP_STATUS_OK; 321 status = HTTP_STATUS_OK;
308 *ctype = "text/plain"; 322 *ctype = "text/plain";