summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c16
-rw-r--r--mastoapi.c24
-rw-r--r--utils.c4
3 files changed, 33 insertions, 11 deletions
diff --git a/html.c b/html.c
index d8dcb3a..5407e22 100644
--- a/html.c
+++ b/html.c
@@ -779,11 +779,21 @@ static xs_html *html_user_body(snac *user, int local)
if (xs_startswith(v, "https:/" "/")) {
/* is this link validated? */
- char *val_date = xs_dict_get(val_links, v);
+ xs *verified_link = NULL;
+ xs_number *val_time = xs_dict_get(val_links, v);
- if (!xs_is_null(val_date) && *val_date) {
+ if (xs_type(val_time) == XSTYPE_NUMBER) {
+ time_t t = xs_number_get(val_time);
+
+ if (t > 0) {
+ xs *s1 = xs_str_utctime(t, ISO_DATE_SPEC);
+ verified_link = xs_fmt("%s (%s)", L("verified link"), s1);
+ }
+ }
+
+ if (!xs_is_null(verified_link)) {
value = xs_html_tag("span",
- xs_html_attr("title", L("verified link")),
+ xs_html_attr("title", verified_link),
xs_html_raw("✔ "),
xs_html_tag("a",
xs_html_attr("href", v),
diff --git a/mastoapi.c b/mastoapi.c
index 8dcd6b4..0a0c3d6 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -642,10 +642,17 @@ xs_dict *mastoapi_account(const xs_dict *actor)
if (!xs_is_null(type) && !xs_is_null(name) &&
!xs_is_null(value) && strcmp(type, "PropertyValue") == 0) {
- char *val_date = NULL;
+ xs *val_date = NULL;
- if (xs_startswith(value, "https:/" "/"))
- val_date = xs_dict_get(val_links, value);
+ if (xs_startswith(value, "https:/" "/")) {
+ xs_number *verified_time = xs_dict_get(val_links, value);
+ if (xs_type(verified_time) == XSTYPE_NUMBER) {
+ time_t t = xs_number_get(verified_time);
+
+ if (t > 0)
+ val_date = xs_str_utctime(t, ISO_DATE_SPEC);
+ }
+ }
xs *d = xs_dict_new();
@@ -1161,10 +1168,15 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
val_links = xs_stock_dict;
while (xs_dict_iter(&metadata, &k, &v)) {
- char *val_date = NULL;
+ xs *val_date = NULL;
- if (xs_startswith(v, "https:/" "/"))
- val_date = xs_dict_get(val_links, v);
+ xs_number *verified_time = xs_dict_get(val_links, v);
+ if (xs_type(verified_time) == XSTYPE_NUMBER) {
+ time_t t = xs_number_get(verified_time);
+
+ if (t > 0)
+ val_date = xs_str_utctime(t, ISO_DATE_SPEC);
+ }
xs *d = xs_dict_new();
diff --git a/utils.c b/utils.c
index 31ab63c..01e0c68 100644
--- a/utils.c
+++ b/utils.c
@@ -491,12 +491,12 @@ void verify_links(snac *user)
/* is it the same as the actor? */
if (strcmp(href, user->actor) == 0) {
/* got it! */
- xs *verified_at = xs_str_utctime(0, ISO_DATE_SPEC);
+ xs *verified_time = xs_number_new((double)time(NULL));
if (user->links == NULL)
user->links = xs_dict_new();
- user->links = xs_dict_set(user->links, v, verified_at);
+ user->links = xs_dict_set(user->links, v, verified_time);
vfied = 1;
}