commit f3e7aff
default
·
2023-11-29 12:35:07 +0000 UTC
parent d1b2fcf
Deleted redundant code.
1 files changed,
+27,
-37
M
html.c
M
html.c
+27,
-37
1@@ -545,47 +545,37 @@ xs_html *html_user_head(snac *user)
2
3 if (avatar == NULL || *avatar == '\0') {
4 xs_free(avatar);
5- avatar = xs_fmt("data:image/png;base64, %s", default_avatar_base64());
6+ avatar = xs_fmt("%s/susie.png", srv_baseurl);
7 }
8
9- {
10- xs *s_bio = xs_dup(xs_dict_get(user->config, "bio"));
11- int n;
12-
13- /* shorten the bio */
14- for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' &&
15- s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
16- s_bio[n] = '\0';
17+ xs *s_bio = xs_dup(xs_dict_get(user->config, "bio"));
18+ int n;
19
20- xs *s_avatar = xs_dup(avatar);
21+ /* shorten the bio */
22+ for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' &&
23+ s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
24+ s_bio[n] = '\0';
25
26- /* don't inline an empty avatar: create a real link */
27- if (xs_startswith(s_avatar, "data:")) {
28- xs_free(s_avatar);
29- s_avatar = xs_fmt("%s/susie.png", srv_baseurl);
30- }
31-
32- /* og properties */
33- xs_html_add(head,
34- xs_html_sctag("meta",
35- xs_html_attr("property", "og:site_name"),
36- xs_html_attr("content", xs_dict_get(srv_config, "host"))),
37- xs_html_sctag("meta",
38- xs_html_attr("property", "og:title"),
39- xs_html_attr("content", title)),
40- xs_html_sctag("meta",
41- xs_html_attr("property", "og:description"),
42- xs_html_attr("content", s_bio)),
43- xs_html_sctag("meta",
44- xs_html_attr("property", "og:image"),
45- xs_html_attr("content", s_avatar)),
46- xs_html_sctag("meta",
47- xs_html_attr("property", "og:width"),
48- xs_html_attr("content", "300")),
49- xs_html_sctag("meta",
50- xs_html_attr("property", "og:height"),
51- xs_html_attr("content", "300")));
52- }
53+ /* og properties */
54+ xs_html_add(head,
55+ xs_html_sctag("meta",
56+ xs_html_attr("property", "og:site_name"),
57+ xs_html_attr("content", xs_dict_get(srv_config, "host"))),
58+ xs_html_sctag("meta",
59+ xs_html_attr("property", "og:title"),
60+ xs_html_attr("content", title)),
61+ xs_html_sctag("meta",
62+ xs_html_attr("property", "og:description"),
63+ xs_html_attr("content", s_bio)),
64+ xs_html_sctag("meta",
65+ xs_html_attr("property", "og:image"),
66+ xs_html_attr("content", avatar)),
67+ xs_html_sctag("meta",
68+ xs_html_attr("property", "og:width"),
69+ xs_html_attr("content", "300")),
70+ xs_html_sctag("meta",
71+ xs_html_attr("property", "og:height"),
72+ xs_html_attr("content", "300")));
73
74 /* RSS link */
75 xs *rss_url = xs_fmt("%s.rss", user->actor);