aboutsummaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authorOliver <zen@noreply.codeberg.org>2025-08-19 21:38:44 +0200
committerOliver <zen@noreply.codeberg.org>2025-08-19 21:38:44 +0200
commiteecfeec3745333451de6a2b1754f43f171e23e5d (patch)
tree0521647efd7aba9cca0911acb387872f5f303f2d /httpd.c
parent3554a73aa50526631961efcca78c6c8eb2a16911 (diff)
parent9558136f4153f75bf5b5dfe789f841489796b9eb (diff)
Merge pull request 'updates holen' (#10) from grunfink/snac2:master into master
Reviewed-on: https://codeberg.org/zen/snac2/pulls/10
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,
status = HTTP_STATUS_OK;
*ctype = "application/json; charset=utf-8";
*body = xs_fmt("{\"links\":["
- "{\"rel\":\"http:/" "/nodeinfo.diaspora.software/ns/schema/2.0\","
- "\"href\":\"%s/nodeinfo_2_0\"}]}",
- srv_baseurl);
+ "{\"rel\":\"http:/" "/nodeinfo.diaspora.software/ns/schema/2.0\",\"href\":\"%s/nodeinfo_2_0\"},"
+ "{\"rel\":\"http:/" "/nodeinfo.diaspora.software/ns/schema/2.1\",\"href\":\"%s/nodeinfo_2_1\"}"
+ "]}",
+ srv_baseurl, srv_baseurl);
}
else
if (strcmp(q_path, "/.well-known/host-meta") == 0) {
@@ -303,6 +304,19 @@ int server_get_handler(xs_dict *req, const char *q_path,
*body = nodeinfo_2_0();
}
else
+ if (strcmp(q_path, "/nodeinfo_2_1") == 0) {
+ xs *s = nodeinfo_2_0();
+ xs *j = xs_json_loads(s);
+
+ j = xs_dict_set(j, "version", "2.1");
+ j = xs_dict_set_path(j, "software.repository", WHAT_IS_SNAC_URL);
+ j = xs_dict_set_path(j, "software.homepage", SNAC_DOC_URL);
+
+ status = HTTP_STATUS_OK;
+ *ctype = "application/json; charset=utf-8";
+ *body = xs_json_dumps(j, 4);
+ }
+ else
if (strcmp(q_path, "/robots.txt") == 0) {
status = HTTP_STATUS_OK;
*ctype = "text/plain";