From ec35ad451f12c769c2f6ec4bdd439131d9d1370b Mon Sep 17 00:00:00 2001 From: default Date: Wed, 14 Feb 2024 23:03:32 +0100 Subject: [PATCH] mastoapi: added verified_at dates for verified links. --- mastoapi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mastoapi.c b/mastoapi.c index e2b7bba..744c2c4 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1134,12 +1134,22 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, xs_str *k; xs_str *v; + xs_dict *val_metadata = xs_dict_get(snac1.config, "validated_metadata"); + if (xs_is_null(val_metadata)) + val_metadata = xs_stock_dict; + while (xs_dict_iter(&metadata, &k, &v)) { + char *val_date = NULL; + + if (xs_startswith(v, "https:/" "/")) + val_date = xs_dict_get(val_metadata, 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); + d = xs_dict_append(d, "verified_at", + xs_type(val_date) == XSTYPE_STRING ? val_date : xs_stock_null); fields = xs_list_append(fields, d); }