mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Show the user@host identified next to the user avatar (contributed by Haijo7).
This commit is contained in:
parent
37878fb926
commit
fac52ff262
27
html.c
27
html.c
@ -135,12 +135,37 @@ xs_str *html_actor_icon(xs_str *os, char *actor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
xs *s1 = xs_fmt(
|
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);
|
date_title, date_label);
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
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);
|
return xs_str_cat(os, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user