diff options
author | default <nobody@localhost> | 2023-06-01 09:16:17 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-06-01 09:16:17 +0200 |
commit | fac52ff2626d5ded86e24f7347912755810216f9 (patch) | |
tree | bed0b13a6d00fe208cedc44d1cedc47b7941cc19 | |
parent | 37878fb926225d26145fb77127ede162a92201ce (diff) |
Show the user@host identified next to the user avatar (contributed by Haijo7).
-rw-r--r-- | html.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -135,12 +135,37 @@ xs_str *html_actor_icon(xs_str *os, char *actor, } xs *s1 = xs_fmt( - "<br>\n<time class=\"dt-published snac-pubdate\" title=\"%s\">%s</time>\n", + "\n<time class=\"dt-published snac-pubdate\" title=\"%s\">%s</time>\n", date_title, date_label); s = xs_str_cat(s, s1); } + { + char *username, *id; + xs *s1; + + if (xs_is_null(username = xs_dict_get(actor, "preferredUsername")) || *username == '\0') { + /* This should never be reached */ + username = "anonymous"; + } + + if (xs_is_null(id = xs_dict_get(actor, "id")) || *id == '\0') { + /* This should never be reached */ + id = "https://social.example.org/anonymous"; + } + + /* "LIKE AN ANIMAL" */ + xs *domain = xs_split(id, "/"); + xs *user = xs_fmt("@%s@%s", username, xs_list_get(domain, 2)); + + s1 = xs_fmt( + "<br><a href=\"%s\" class=\"p-author-tag h-card snac-author snac-author-tag\">%s</a>", + xs_dict_get(actor, "id"), user); + + s = xs_str_cat(s, s1); + } + return xs_str_cat(os, s); } |