summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/html.c b/html.c
index fe14ab3..9b5cbf2 100644
--- a/html.c
+++ b/html.c
@@ -135,12 +135,37 @@ xs_str *html_actor_icon(xs_str *os, char *actor,
135 } 135 }
136 136
137 xs *s1 = xs_fmt( 137 xs *s1 = xs_fmt(
138 "<br>\n<time class=\"dt-published snac-pubdate\" title=\"%s\">%s</time>\n", 138 "\n<time class=\"dt-published snac-pubdate\" title=\"%s\">%s</time>\n",
139 date_title, date_label); 139 date_title, date_label);
140 140
141 s = xs_str_cat(s, s1); 141 s = xs_str_cat(s, s1);
142 } 142 }
143 143
144 {
145 char *username, *id;
146 xs *s1;
147
148 if (xs_is_null(username = xs_dict_get(actor, "preferredUsername")) || *username == '\0') {
149 /* This should never be reached */
150 username = "anonymous";
151 }
152
153 if (xs_is_null(id = xs_dict_get(actor, "id")) || *id == '\0') {
154 /* This should never be reached */
155 id = "https://social.example.org/anonymous";
156 }
157
158 /* "LIKE AN ANIMAL" */
159 xs *domain = xs_split(id, "/");
160 xs *user = xs_fmt("@%s@%s", username, xs_list_get(domain, 2));
161
162 s1 = xs_fmt(
163 "<br><a href=\"%s\" class=\"p-author-tag h-card snac-author snac-author-tag\">%s</a>",
164 xs_dict_get(actor, "id"), user);
165
166 s = xs_str_cat(s, s1);
167 }
168
144 return xs_str_cat(os, s); 169 return xs_str_cat(os, s);
145} 170}
146 171