summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-02-07 19:15:20 +0100
committerGravatar default2024-02-07 19:15:20 +0100
commit89b64de531095c9429e2478b0c1338be25221664 (patch)
tree6c4918b59aa688f91a60ffefb6fb3b0bf91cbdb7
parentDeactivated stale actors behind a compiler directive. (diff)
downloadsnac2-89b64de531095c9429e2478b0c1338be25221664.tar.gz
snac2-89b64de531095c9429e2478b0c1338be25221664.tar.xz
snac2-89b64de531095c9429e2478b0c1338be25221664.zip
Some og:description tweaks.
-rw-r--r--html.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/html.c b/html.c
index 8cc0394..714d7c8 100644
--- a/html.c
+++ b/html.c
@@ -552,7 +552,7 @@ static xs_html *html_instance_body(char *tag)
552} 552}
553 553
554 554
555xs_html *html_user_head(snac *user) 555xs_html *html_user_head(snac *user, char *desc)
556{ 556{
557 xs_html *head = html_base_head(); 557 xs_html *head = html_base_head();
558 558
@@ -595,13 +595,13 @@ xs_html *html_user_head(snac *user)
595 avatar = xs_fmt("%s/susie.png", srv_baseurl); 595 avatar = xs_fmt("%s/susie.png", srv_baseurl);
596 } 596 }
597 597
598 xs *s_bio = xs_dup(xs_dict_get(user->config, "bio")); 598 /* create a description field */
599 int n; 599 xs *s_desc = NULL;
600 600
601 /* shorten the bio */ 601 if (desc == NULL)
602 for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' && 602 s_desc = xs_dup(xs_dict_get(user->config, "bio"));
603 s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++); 603 else
604 s_bio[n] = '\0'; 604 s_desc = xs_dup(desc);
605 605
606 /* og properties */ 606 /* og properties */
607 xs_html_add(head, 607 xs_html_add(head,
@@ -613,7 +613,7 @@ xs_html *html_user_head(snac *user)
613 xs_html_attr("content", title)), 613 xs_html_attr("content", title)),
614 xs_html_sctag("meta", 614 xs_html_sctag("meta",
615 xs_html_attr("property", "og:description"), 615 xs_html_attr("property", "og:description"),
616 xs_html_attr("content", s_bio)), 616 xs_html_attr("content", s_desc)),
617 xs_html_sctag("meta", 617 xs_html_sctag("meta",
618 xs_html_attr("property", "og:image"), 618 xs_html_attr("property", "og:image"),
619 xs_html_attr("content", avatar)), 619 xs_html_attr("content", avatar)),
@@ -1849,11 +1849,21 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
1849 char *v; 1849 char *v;
1850 double t = ftime(); 1850 double t = ftime();
1851 1851
1852 char *desc = NULL;
1853
1854#if 0
1855 if (xs_list_len(list) == 1) {
1856 /* only one element? pick the description from the source */
1857 xs_dict *d = xs_list_get(list, 0);
1858 desc = xs_dict_get(d, "sourceContent");
1859 }
1860#endif
1861
1852 xs_html *head; 1862 xs_html *head;
1853 xs_html *body; 1863 xs_html *body;
1854 1864
1855 if (user) { 1865 if (user) {
1856 head = html_user_head(user); 1866 head = html_user_head(user, desc);
1857 body = html_user_body(user, local); 1867 body = html_user_body(user, local);
1858 } 1868 }
1859 else { 1869 else {
@@ -2125,7 +2135,7 @@ xs_str *html_people(snac *user)
2125 xs *wers = follower_list(user); 2135 xs *wers = follower_list(user);
2126 2136
2127 xs_html *html = xs_html_tag("html", 2137 xs_html *html = xs_html_tag("html",
2128 html_user_head(user), 2138 html_user_head(user, NULL),
2129 xs_html_add(html_user_body(user, 0), 2139 xs_html_add(html_user_body(user, 0),
2130 html_people_list(user, wing, L("People you follow"), "i"), 2140 html_people_list(user, wing, L("People you follow"), "i"),
2131 html_people_list(user, wers, L("People that follow you"), "e"), 2141 html_people_list(user, wers, L("People that follow you"), "e"),
@@ -2143,7 +2153,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
2143 xs_html *body = html_user_body(user, 0); 2153 xs_html *body = html_user_body(user, 0);
2144 2154
2145 xs_html *html = xs_html_tag("html", 2155 xs_html *html = xs_html_tag("html",
2146 html_user_head(user), 2156 html_user_head(user, NULL),
2147 body); 2157 body);
2148 2158
2149 xs *clear_all_action = xs_fmt("%s/admin/clear-notifications", user->actor); 2159 xs *clear_all_action = xs_fmt("%s/admin/clear-notifications", user->actor);