commit 26502fa
grunfink
·
2025-07-10 03:45:22 +0000 UTC
parent 7365a1a
Added metadata to nodeinfo 2.0.
1 files changed,
+7,
-2
M
httpd.c
M
httpd.c
+7,
-2
1@@ -66,7 +66,9 @@ const char *nodeinfo_2_0_template = ""
2 "\"services\":{\"outbound\":[],\"inbound\":[]},"
3 "\"usage\":{\"users\":{\"total\":%d,\"activeMonth\":%d,\"activeHalfyear\":%d},"
4 "\"localPosts\":%d},"
5- "\"openRegistrations\":false,\"metadata\":{}}";
6+ "\"openRegistrations\":false,\"metadata\":{"
7+ "\"nodeDescription\":\"%s\",\"nodeName\":\"%s\""
8+ "}}";
9
10 xs_str *nodeinfo_2_0(void)
11 /* builds a nodeinfo json object */
12@@ -99,7 +101,10 @@ xs_str *nodeinfo_2_0(void)
13 n_posts += index_len(pidxfn);
14 }
15
16- return xs_fmt(nodeinfo_2_0_template, n_utotal, n_umonth, n_uhyear, n_posts);
17+ const char *name = xs_dict_get_def(srv_config, "title", "");
18+ const char *desc = xs_dict_get_def(srv_config, "short_description", "");
19+
20+ return xs_fmt(nodeinfo_2_0_template, n_utotal, n_umonth, n_uhyear, n_posts, desc, name);
21 }
22
23