mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
mastoapi: added verified_at dates for verified links.
This commit is contained in:
parent
d106f86a67
commit
ec35ad451f
12
mastoapi.c
12
mastoapi.c
@ -1134,12 +1134,22 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||||||
xs_str *k;
|
xs_str *k;
|
||||||
xs_str *v;
|
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)) {
|
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();
|
xs *d = xs_dict_new();
|
||||||
|
|
||||||
d = xs_dict_append(d, "name", k);
|
d = xs_dict_append(d, "name", k);
|
||||||
d = xs_dict_append(d, "value", v);
|
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);
|
fields = xs_list_append(fields, d);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user