commit 6f72a19

grunfink  ·  2023-06-12 17:05:41 +0000 UTC
parents 8fb74b6, 4295890
Merge pull request 'add mastodon profile header to mastodon api' (#46) from Haijo7/snac2:mastodon-profile-header into master

Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/46
1 files changed,  +10, -2
+10, -2
 1@@ -540,6 +540,16 @@ xs_dict *mastoapi_account(const xs_dict *actor)
 2         avatar = xs_fmt("%s/susie.png", srv_baseurl);
 3 
 4     acct = xs_dict_append(acct, "avatar", avatar);
 5+    acct = xs_dict_append(acct, "avatar_static", avatar);
 6+
 7+    xs *header  = NULL;
 8+    xs_dict *hd = xs_dict_get(actor, "image");
 9+
10+    if (xs_type(hd) == XSTYPE_DICT)
11+        header = xs_dup(xs_dict_get(hd, "url"));
12+
13+    acct = xs_dict_append(acct, "header", header);
14+    acct = xs_dict_append(acct, "header_static", header);
15 
16     /* emojis */
17     xs_list *p;
18@@ -576,8 +586,6 @@ xs_dict *mastoapi_account(const xs_dict *actor)
19         acct = xs_dict_append(acct, "emojis", eml);
20     }
21 
22-    acct = xs_dict_append(acct, "header", "");
23-
24     return acct;
25 }
26