diff options
| author | 2023-05-13 09:35:43 +0200 | |
|---|---|---|
| committer | 2023-05-13 09:35:43 +0200 | |
| commit | 6b597ffdb44a5fce7a7da6b5613f0607de483f99 (patch) | |
| tree | 6a8a581f1212d130716a219c5cb78af7e43c026a | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-6b597ffdb44a5fce7a7da6b5613f0607de483f99.tar.gz snac2-6b597ffdb44a5fce7a7da6b5613f0607de483f99.tar.xz snac2-6b597ffdb44a5fce7a7da6b5613f0607de483f99.zip | |
Only show the bio in the top of the page for public pages.
| -rw-r--r-- | html.c | 21 |
1 files changed, 12 insertions, 9 deletions
| @@ -224,7 +224,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local) | |||
| 224 | xs *s_bio = xs_dup(xs_dict_get(snac->config, "bio")); | 224 | xs *s_bio = xs_dup(xs_dict_get(snac->config, "bio")); |
| 225 | int n; | 225 | int n; |
| 226 | 226 | ||
| 227 | /* sorten a bio */ | 227 | /* shorten the bio */ |
| 228 | for (n = 0; s_bio[n] && s_bio[n] != '&' && | 228 | for (n = 0; s_bio[n] && s_bio[n] != '&' && |
| 229 | s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++); | 229 | s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++); |
| 230 | s_bio[n] = '\0'; | 230 | s_bio[n] = '\0'; |
| @@ -310,23 +310,26 @@ d_char *html_user_header(snac *snac, d_char *s, int local) | |||
| 310 | 310 | ||
| 311 | /* user info */ | 311 | /* user info */ |
| 312 | { | 312 | { |
| 313 | xs *bio = NULL; | ||
| 314 | char *_tmpl = | 313 | char *_tmpl = |
| 315 | "<div class=\"h-card snac-top-user\">\n" | 314 | "<div class=\"h-card snac-top-user\">\n" |
| 316 | "<p class=\"p-name snac-top-user-name\">%s</p>\n" | 315 | "<p class=\"p-name snac-top-user-name\">%s</p>\n" |
| 317 | "<p class=\"snac-top-user-id\">@%s@%s</p>\n" | 316 | "<p class=\"snac-top-user-id\">@%s@%s</p>\n"; |
| 318 | "<div class=\"p-note snac-top-user-bio\">%s</div>\n" | ||
| 319 | "</div>\n"; | ||
| 320 | |||
| 321 | bio = not_really_markdown(xs_dict_get(snac->config, "bio")); | ||
| 322 | 317 | ||
| 323 | xs *s1 = xs_fmt(_tmpl, | 318 | xs *s1 = xs_fmt(_tmpl, |
| 324 | xs_dict_get(snac->config, "name"), | 319 | xs_dict_get(snac->config, "name"), |
| 325 | xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host"), | 320 | xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host") |
| 326 | bio | ||
| 327 | ); | 321 | ); |
| 328 | 322 | ||
| 329 | s = xs_str_cat(s, s1); | 323 | s = xs_str_cat(s, s1); |
| 324 | |||
| 325 | if (local) { | ||
| 326 | xs *bio = not_really_markdown(xs_dict_get(snac->config, "bio")); | ||
| 327 | xs *s1 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio); | ||
| 328 | |||
| 329 | s = xs_str_cat(s, s1); | ||
| 330 | } | ||
| 331 | |||
| 332 | s = xs_str_cat(s, "</div>\n"); | ||
| 330 | } | 333 | } |
| 331 | 334 | ||
| 332 | return s; | 335 | return s; |