summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar Alex Schroeder2022-12-03 20:46:51 +0100
committerGravatar Alex Schroeder2022-12-04 10:05:53 +0100
commita3fa7dbaec4e3d61eb51224ca44d6c9fe644af3c (patch)
treee454043306472648337427772ab5dc3671fca30e /html.c
parentAdd an option to always show sensitive content (diff)
downloadsnac2-a3fa7dbaec4e3d61eb51224ca44d6c9fe644af3c.tar.gz
snac2-a3fa7dbaec4e3d61eb51224ca44d6c9fe644af3c.tar.xz
snac2-a3fa7dbaec4e3d61eb51224ca44d6c9fe644af3c.zip
No sensitive content in the public timeline
Don't use h3 in the public timeline. Use the details tag, as before, but default to "open" if the config setting is set. Only do this in the private timeline (where local == 0, as set by html_get_handler).
Diffstat (limited to 'html.c')
-rw-r--r--html.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/html.c b/html.c
index 5912422..fbb313b 100644
--- a/html.c
+++ b/html.c
@@ -618,17 +618,13 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
618 if (!xs_is_null(v = xs_dict_get(msg, "sensitive")) && xs_type(v) == XSTYPE_TRUE) { 618 if (!xs_is_null(v = xs_dict_get(msg, "sensitive")) && xs_type(v) == XSTYPE_TRUE) {
619 if (xs_is_null(v = xs_dict_get(msg, "summary")) || *v == '\0') 619 if (xs_is_null(v = xs_dict_get(msg, "summary")) || *v == '\0')
620 v = "..."; 620 v = "...";
621 /* only show it when not in the public timeline and the config setting is "open" */
621 char *cw = xs_dict_get(snac->config, "cw"); 622 char *cw = xs_dict_get(snac->config, "cw");
622 if (xs_is_null(cw)) 623 if (xs_is_null(cw) || local)
623 cw = ""; 624 cw = "";
624 if (strcmp(cw, "checked") == 0) { 625 xs *s1 = xs_fmt("<details %s><summary>%s [%s]</summary>\n", cw, v, L("SENSITIVE CONTENT"));
625 xs *s1 = xs_fmt("<h3>%s</h3>", v); 626 s = xs_str_cat(s, s1);
626 s = xs_str_cat(s, s1); 627 sensitive = 1;
627 } else {
628 xs *s1 = xs_fmt("<details><summary>%s [%s]</summary>\n", v, L("SENSITIVE CONTENT"));
629 s = xs_str_cat(s, s1);
630 sensitive = 1;
631 }
632 } 628 }
633 629
634#if 0 630#if 0
@@ -1392,7 +1388,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
1392 snac.config = xs_dict_set(snac.config, "bio", v); 1388 snac.config = xs_dict_set(snac.config, "bio", v);
1393 if ((v = xs_dict_get(p_vars, "cw")) != NULL && 1389 if ((v = xs_dict_get(p_vars, "cw")) != NULL &&
1394 strcmp(v, "on") == 0) { 1390 strcmp(v, "on") == 0) {
1395 snac.config = xs_dict_set(snac.config, "cw", "checked"); 1391 snac.config = xs_dict_set(snac.config, "cw", "open");
1396 } else { /* if the checkbox is not set, the parameter is missing */ 1392 } else { /* if the checkbox is not set, the parameter is missing */
1397 snac.config = xs_dict_set(snac.config, "cw", ""); 1393 snac.config = xs_dict_set(snac.config, "cw", "");
1398 } 1394 }