Deleted redundant code.

This commit is contained in:
default 2023-11-29 13:35:07 +01:00
parent d1b2fcf426
commit f3e7aff2d7

64
html.c
View file

@ -545,47 +545,37 @@ xs_html *html_user_head(snac *user)
if (avatar == NULL || *avatar == '\0') { if (avatar == NULL || *avatar == '\0') {
xs_free(avatar); xs_free(avatar);
avatar = xs_fmt("data:image/png;base64, %s", default_avatar_base64()); avatar = xs_fmt("%s/susie.png", srv_baseurl);
} }
{ xs *s_bio = xs_dup(xs_dict_get(user->config, "bio"));
xs *s_bio = xs_dup(xs_dict_get(user->config, "bio")); int n;
int n;
/* shorten the bio */ /* shorten the bio */
for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' && for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' &&
s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++); s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
s_bio[n] = '\0'; s_bio[n] = '\0';
xs *s_avatar = xs_dup(avatar); /* og properties */
xs_html_add(head,
/* don't inline an empty avatar: create a real link */ xs_html_sctag("meta",
if (xs_startswith(s_avatar, "data:")) { xs_html_attr("property", "og:site_name"),
xs_free(s_avatar); xs_html_attr("content", xs_dict_get(srv_config, "host"))),
s_avatar = xs_fmt("%s/susie.png", srv_baseurl); xs_html_sctag("meta",
} xs_html_attr("property", "og:title"),
xs_html_attr("content", title)),
/* og properties */ xs_html_sctag("meta",
xs_html_add(head, xs_html_attr("property", "og:description"),
xs_html_sctag("meta", xs_html_attr("content", s_bio)),
xs_html_attr("property", "og:site_name"), xs_html_sctag("meta",
xs_html_attr("content", xs_dict_get(srv_config, "host"))), xs_html_attr("property", "og:image"),
xs_html_sctag("meta", xs_html_attr("content", avatar)),
xs_html_attr("property", "og:title"), xs_html_sctag("meta",
xs_html_attr("content", title)), xs_html_attr("property", "og:width"),
xs_html_sctag("meta", xs_html_attr("content", "300")),
xs_html_attr("property", "og:description"), xs_html_sctag("meta",
xs_html_attr("content", s_bio)), xs_html_attr("property", "og:height"),
xs_html_sctag("meta", xs_html_attr("content", "300")));
xs_html_attr("property", "og:image"),
xs_html_attr("content", s_avatar)),
xs_html_sctag("meta",
xs_html_attr("property", "og:width"),
xs_html_attr("content", "300")),
xs_html_sctag("meta",
xs_html_attr("property", "og:height"),
xs_html_attr("content", "300")));
}
/* RSS link */ /* RSS link */
xs *rss_url = xs_fmt("%s.rss", user->actor); xs *rss_url = xs_fmt("%s.rss", user->actor);