commit 3d2d753

default  ·  2023-08-14 09:31:11 +0000 UTC
parent 86571f3
mastoapi: show the instance's title and short_description, if they exist.
1 files changed,  +5, -3
+5, -3
 1@@ -1445,16 +1445,18 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2     if (strcmp(cmd, "/v1/instance") == 0) { /** **/
 3         /* returns an instance object */
 4         xs *ins = xs_dict_new();
 5-        const char *host = xs_dict_get(srv_config, "host");
 6+        const char *host  = xs_dict_get(srv_config, "host");
 7+        const char *title = xs_dict_get(srv_config, "title");
 8+        const char *sdesc = xs_dict_get(srv_config, "short_description");
 9 
10         ins = xs_dict_append(ins, "uri",         host);
11         ins = xs_dict_append(ins, "domain",      host);
12-        ins = xs_dict_append(ins, "title",       host);
13+        ins = xs_dict_append(ins, "title",       title && *title ? title : host);
14         ins = xs_dict_append(ins, "version",     "4.0.0 (not true; really " USER_AGENT ")");
15         ins = xs_dict_append(ins, "source_url",  WHAT_IS_SNAC_URL);
16         ins = xs_dict_append(ins, "description", host);
17 
18-        ins = xs_dict_append(ins, "short_description", host);
19+        ins = xs_dict_append(ins, "short_description", sdesc && *sdesc ? sdesc : host);
20 
21         xs *susie = xs_fmt("%s/susie.png", srv_baseurl);
22         ins = xs_dict_append(ins, "thumbnail", susie);