diff options
| author | grunfink <grunfink@comam.es> | 2025-08-14 11:17:49 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2025-08-14 11:17:49 +0200 |
| commit | cd05398133a1ed7b4e953e3a4d363273b58ad970 (patch) | |
| tree | b7af77fdeb7e8f9edf578528ccf03a5407aef924 | |
| parent | 4fc7d18d692a5c9d3b673cd495249d20317ba757 (diff) | |
Added nodeinfo 2.1 support.
| -rw-r--r-- | httpd.c | 20 | ||||
| -rw-r--r-- | snac.h | 1 |
2 files changed, 18 insertions, 3 deletions
@@ -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"; @@ -6,6 +6,7 @@ #define USER_AGENT "snac/" VERSION #define WHAT_IS_SNAC_URL "https:/" "/comam.es/what-is-snac" +#define SNAC_DOC_URL "https:/" "/comam.es/snac-doc" #define DIR_PERM 00770 #define DIR_PERM_ADD 02770 |