aboutsummaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-07-10 05:45:22 +0200
committergrunfink <grunfink@comam.es>2025-07-10 05:45:22 +0200
commit26502fa62ee05465e524987ab5b86078f2e64e6f (patch)
treeecd485e10f7e621aef174a31004f57586d554141 /httpd.c
parent7365a1aa4dbe87b3f3cf620d88448edf5fc750f2 (diff)
Added metadata to nodeinfo 2.0.
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/httpd.c b/httpd.c
index 8f2ef4d..d01eb9c 100644
--- a/httpd.c
+++ b/httpd.c
@@ -66,7 +66,9 @@ const char *nodeinfo_2_0_template = ""
"\"services\":{\"outbound\":[],\"inbound\":[]},"
"\"usage\":{\"users\":{\"total\":%d,\"activeMonth\":%d,\"activeHalfyear\":%d},"
"\"localPosts\":%d},"
- "\"openRegistrations\":false,\"metadata\":{}}";
+ "\"openRegistrations\":false,\"metadata\":{"
+ "\"nodeDescription\":\"%s\",\"nodeName\":\"%s\""
+ "}}";
xs_str *nodeinfo_2_0(void)
/* builds a nodeinfo json object */
@@ -99,7 +101,10 @@ xs_str *nodeinfo_2_0(void)
n_posts += index_len(pidxfn);
}
- return xs_fmt(nodeinfo_2_0_template, n_utotal, n_umonth, n_uhyear, n_posts);
+ const char *name = xs_dict_get_def(srv_config, "title", "");
+ const char *desc = xs_dict_get_def(srv_config, "short_description", "");
+
+ return xs_fmt(nodeinfo_2_0_template, n_utotal, n_umonth, n_uhyear, n_posts, desc, name);
}