aboutsummaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-06-21 19:08:38 +0200
committergrunfink <grunfink@comam.es>2025-06-21 19:08:38 +0200
commitfa986ad91e15bdea6a9764d04fdb90e404d39e55 (patch)
tree424c1b63c01a35648036e00f543f3da2a96fde95 /mastoapi.c
parent508726cc04768bd2cdad4c774b6fa1c411c41ab3 (diff)
Added support for /api/v1/instance/extended_description (with a hardcoded text).
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 2e8063b..0829a84 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -2337,6 +2337,21 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
status = HTTP_STATUS_OK;
}
else
+ if (strcmp(cmd, "/v1/instance/extended_description") == 0) { /** **/
+ xs *d = xs_dict_new();
+ xs *greeting = xs_fmt("%s/greeting.html", srv_basedir);
+ time_t t = mtime(greeting);
+ xs *updated_at = xs_str_iso_date(t);
+ xs *content = xs_replace(snac_blurb, "%host%", xs_dict_get(srv_config, "host"));
+
+ d = xs_dict_set(d, "updated_at", updated_at);
+ d = xs_dict_set(d, "content", content);
+
+ *body = xs_json_dumps(d, 4);
+ *ctype = "application/json";
+ status = HTTP_STATUS_OK;
+ }
+ else
if (xs_startswith(cmd, "/v1/statuses/")) { /** **/
/* information about a status */
if (logged_in) {