From e14ad56994eaf147c43258047c2f048c60d04849 Mon Sep 17 00:00:00 2001 From: default Date: Mon, 18 Sep 2023 11:57:55 +0200 Subject: [PATCH] mastoapi: Added fields list in verify_credentials. --- mastoapi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mastoapi.c b/mastoapi.c index 2ab921d..1c0ad87 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1044,6 +1044,25 @@ 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_dict *metadata = xs_dict_get(snac1.config, "metadata"); + if (xs_type(metadata) == XSTYPE_DICT) { + xs *fields = xs_list_new(); + xs_str *k; + xs_str *v; + + while (xs_dict_iter(&metadata, &k, &v)) { + xs *d = xs_dict_new(); + + d = xs_dict_append(d, "name", k); + d = xs_dict_append(d, "value", v); + d = xs_dict_append(d, "verified_at", xs_stock_null); + + fields = xs_list_append(fields, d); + } + + acct = xs_dict_set(acct, "fields", fields); + } + *body = xs_json_dumps(acct, 4); *ctype = "application/json"; status = 200;