From df917f39d00473baf7acedfe034c6225cbdeb3bc Mon Sep 17 00:00:00 2001 From: default Date: Wed, 13 Mar 2024 10:07:02 +0100 Subject: [PATCH] mastoapi: return a dummy header field in accounts. --- mastoapi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mastoapi.c b/mastoapi.c index 10fa40b..133b4d0 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -574,7 +574,7 @@ xs_dict *mastoapi_account(const xs_dict *actor) header = xs_dup(xs_dict_get(hd, "url")); if (xs_is_null(header)) - header = xs_dup(""); + header = xs_fmt("%s/header.png", srv_baseurl); acct = xs_dict_append(acct, "header", header); acct = xs_dict_append(acct, "header_static", header); @@ -1142,8 +1142,6 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, acct = xs_dict_append(acct, "last_status_at", xs_dict_get(snac1.config, "published")); acct = xs_dict_append(acct, "note", xs_dict_get(snac1.config, "bio")); acct = xs_dict_append(acct, "url", snac1.actor); - acct = xs_dict_append(acct, "header", ""); - acct = xs_dict_append(acct, "header_static", ""); acct = xs_dict_append(acct, "locked", xs_stock_false); acct = xs_dict_append(acct, "bot", xs_dict_get(snac1.config, "bot")); @@ -1162,6 +1160,17 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, acct = xs_dict_append(acct, "avatar", avatar); acct = xs_dict_append(acct, "avatar_static", avatar); + xs *header = NULL; + char *hd = xs_dict_get(snac1.config, "header"); + + if (!xs_is_null(hd)) + header = xs_dup(hd); + else + header = xs_fmt("%s/header.png", srv_baseurl); + + acct = xs_dict_append(acct, "header", header); + acct = xs_dict_append(acct, "header_static", header); + xs_dict *metadata = xs_dict_get(snac1.config, "metadata"); if (xs_type(metadata) == XSTYPE_DICT) { xs *fields = xs_list_new();