commit fa986ad
grunfink
·
2025-06-21 17:08:38 +0000 UTC
parent 508726c
Added support for /api/v1/instance/extended_description (with a hardcoded text).
1 files changed,
+15,
-0
+15,
-0
1@@ -2337,6 +2337,21 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2 status = HTTP_STATUS_OK;
3 }
4 else
5+ if (strcmp(cmd, "/v1/instance/extended_description") == 0) { /** **/
6+ xs *d = xs_dict_new();
7+ xs *greeting = xs_fmt("%s/greeting.html", srv_basedir);
8+ time_t t = mtime(greeting);
9+ xs *updated_at = xs_str_iso_date(t);
10+ xs *content = xs_replace(snac_blurb, "%host%", xs_dict_get(srv_config, "host"));
11+
12+ d = xs_dict_set(d, "updated_at", updated_at);
13+ d = xs_dict_set(d, "content", content);
14+
15+ *body = xs_json_dumps(d, 4);
16+ *ctype = "application/json";
17+ status = HTTP_STATUS_OK;
18+ }
19+ else
20 if (xs_startswith(cmd, "/v1/statuses/")) { /** **/
21 /* information about a status */
22 if (logged_in) {