From a3fa7dbaec4e3d61eb51224ca44d6c9fe644af3c Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Sat, 3 Dec 2022 20:46:51 +0100 Subject: [PATCH] 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). --- html.c | 16 ++++++---------- 1 file 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 if (!xs_is_null(v = xs_dict_get(msg, "sensitive")) && xs_type(v) == XSTYPE_TRUE) { if (xs_is_null(v = xs_dict_get(msg, "summary")) || *v == '\0') v = "..."; + /* only show it when not in the public timeline and the config setting is "open" */ char *cw = xs_dict_get(snac->config, "cw"); - if (xs_is_null(cw)) + if (xs_is_null(cw) || local) cw = ""; - if (strcmp(cw, "checked") == 0) { - xs *s1 = xs_fmt("

%s

", v); - s = xs_str_cat(s, s1); - } else { - xs *s1 = xs_fmt("
%s [%s]\n", v, L("SENSITIVE CONTENT")); - s = xs_str_cat(s, s1); - sensitive = 1; - } + xs *s1 = xs_fmt("
%s [%s]\n", cw, v, L("SENSITIVE CONTENT")); + s = xs_str_cat(s, s1); + sensitive = 1; } #if 0 @@ -1392,7 +1388,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, snac.config = xs_dict_set(snac.config, "bio", v); if ((v = xs_dict_get(p_vars, "cw")) != NULL && strcmp(v, "on") == 0) { - snac.config = xs_dict_set(snac.config, "cw", "checked"); + snac.config = xs_dict_set(snac.config, "cw", "open"); } else { /* if the checkbox is not set, the parameter is missing */ snac.config = xs_dict_set(snac.config, "cw", ""); }