summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-08-14 11:31:11 +0200
committerdefault <nobody@localhost>2023-08-14 11:31:11 +0200
commit3d2d75315ef50f9523359d124c50fa7d8efc9616 (patch)
tree1a299da9744e7937f632cbbce2b4152a9dbc454d /mastoapi.c
parent86571f37bb3e85acaed6d0212b5543130a6766ce (diff)
mastoapi: show the instance's title and short_description, if they exist.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 6fd0cf1..e7d9b60 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1445,16 +1445,18 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
if (strcmp(cmd, "/v1/instance") == 0) { /** **/
/* returns an instance object */
xs *ins = xs_dict_new();
- const char *host = xs_dict_get(srv_config, "host");
+ const char *host = xs_dict_get(srv_config, "host");
+ const char *title = xs_dict_get(srv_config, "title");
+ const char *sdesc = xs_dict_get(srv_config, "short_description");
ins = xs_dict_append(ins, "uri", host);
ins = xs_dict_append(ins, "domain", host);
- ins = xs_dict_append(ins, "title", host);
+ ins = xs_dict_append(ins, "title", title && *title ? title : host);
ins = xs_dict_append(ins, "version", "4.0.0 (not true; really " USER_AGENT ")");
ins = xs_dict_append(ins, "source_url", WHAT_IS_SNAC_URL);
ins = xs_dict_append(ins, "description", host);
- ins = xs_dict_append(ins, "short_description", host);
+ ins = xs_dict_append(ins, "short_description", sdesc && *sdesc ? sdesc : host);
xs *susie = xs_fmt("%s/susie.png", srv_baseurl);
ins = xs_dict_append(ins, "thumbnail", susie);