summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c64
1 files changed, 27 insertions, 37 deletions
diff --git a/html.c b/html.c
index c8b08d2..3e9eb81 100644
--- a/html.c
+++ b/html.c
@@ -545,47 +545,37 @@ xs_html *html_user_head(snac *user)
545 545
546 if (avatar == NULL || *avatar == '\0') { 546 if (avatar == NULL || *avatar == '\0') {
547 xs_free(avatar); 547 xs_free(avatar);
548 avatar = xs_fmt("data:image/png;base64, %s", default_avatar_base64()); 548 avatar = xs_fmt("%s/susie.png", srv_baseurl);
549 } 549 }
550 550
551 { 551 xs *s_bio = xs_dup(xs_dict_get(user->config, "bio"));
552 xs *s_bio = xs_dup(xs_dict_get(user->config, "bio")); 552 int n;
553 int n;
554
555 /* shorten the bio */
556 for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' &&
557 s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
558 s_bio[n] = '\0';
559 553
560 xs *s_avatar = xs_dup(avatar); 554 /* shorten the bio */
555 for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' &&
556 s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
557 s_bio[n] = '\0';
561 558
562 /* don't inline an empty avatar: create a real link */ 559 /* og properties */
563 if (xs_startswith(s_avatar, "data:")) { 560 xs_html_add(head,
564 xs_free(s_avatar); 561 xs_html_sctag("meta",
565 s_avatar = xs_fmt("%s/susie.png", srv_baseurl); 562 xs_html_attr("property", "og:site_name"),
566 } 563 xs_html_attr("content", xs_dict_get(srv_config, "host"))),
567 564 xs_html_sctag("meta",
568 /* og properties */ 565 xs_html_attr("property", "og:title"),
569 xs_html_add(head, 566 xs_html_attr("content", title)),
570 xs_html_sctag("meta", 567 xs_html_sctag("meta",
571 xs_html_attr("property", "og:site_name"), 568 xs_html_attr("property", "og:description"),
572 xs_html_attr("content", xs_dict_get(srv_config, "host"))), 569 xs_html_attr("content", s_bio)),
573 xs_html_sctag("meta", 570 xs_html_sctag("meta",
574 xs_html_attr("property", "og:title"), 571 xs_html_attr("property", "og:image"),
575 xs_html_attr("content", title)), 572 xs_html_attr("content", avatar)),
576 xs_html_sctag("meta", 573 xs_html_sctag("meta",
577 xs_html_attr("property", "og:description"), 574 xs_html_attr("property", "og:width"),
578 xs_html_attr("content", s_bio)), 575 xs_html_attr("content", "300")),
579 xs_html_sctag("meta", 576 xs_html_sctag("meta",
580 xs_html_attr("property", "og:image"), 577 xs_html_attr("property", "og:height"),
581 xs_html_attr("content", s_avatar)), 578 xs_html_attr("content", "300")));
582 xs_html_sctag("meta",
583 xs_html_attr("property", "og:width"),
584 xs_html_attr("content", "300")),
585 xs_html_sctag("meta",
586 xs_html_attr("property", "og:height"),
587 xs_html_attr("content", "300")));
588 }
589 579
590 /* RSS link */ 580 /* RSS link */
591 xs *rss_url = xs_fmt("%s.rss", user->actor); 581 xs *rss_url = xs_fmt("%s.rss", user->actor);