commit 6b597ff
default
·
2023-05-13 07:35:43 +0000 UTC
parent ac39a3b
Only show the bio in the top of the page for public pages.
1 files changed,
+12,
-9
M
html.c
M
html.c
+12,
-9
1@@ -224,7 +224,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
2 xs *s_bio = xs_dup(xs_dict_get(snac->config, "bio"));
3 int n;
4
5- /* sorten a bio */
6+ /* shorten the bio */
7 for (n = 0; s_bio[n] && s_bio[n] != '&' &&
8 s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
9 s_bio[n] = '\0';
10@@ -310,23 +310,26 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
11
12 /* user info */
13 {
14- xs *bio = NULL;
15 char *_tmpl =
16 "<div class=\"h-card snac-top-user\">\n"
17 "<p class=\"p-name snac-top-user-name\">%s</p>\n"
18- "<p class=\"snac-top-user-id\">@%s@%s</p>\n"
19- "<div class=\"p-note snac-top-user-bio\">%s</div>\n"
20- "</div>\n";
21-
22- bio = not_really_markdown(xs_dict_get(snac->config, "bio"));
23+ "<p class=\"snac-top-user-id\">@%s@%s</p>\n";
24
25 xs *s1 = xs_fmt(_tmpl,
26 xs_dict_get(snac->config, "name"),
27- xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host"),
28- bio
29+ xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host")
30 );
31
32 s = xs_str_cat(s, s1);
33+
34+ if (local) {
35+ xs *bio = not_really_markdown(xs_dict_get(snac->config, "bio"));
36+ xs *s1 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio);
37+
38+ s = xs_str_cat(s, s1);
39+ }
40+
41+ s = xs_str_cat(s, "</div>\n");
42 }
43
44 return s;