From e4c26715a138862b17bb23562be28e6ea4d949f9 Mon Sep 17 00:00:00 2001
From: Alex Schroeder
Date: Fri, 2 Dec 2022 09:55:25 +0100
Subject: Add an option to always show sensitive content
- add a cw key to user.json
- add a cw checkbox to user setup form
- handle the cw parameter when updating user setup
- when rendering an entry, look at the cw config: if set, use a h3
heading for the summary; otherwise use details + summar + SENSITIVE
CONTENT like before
---
html.c | 28 ++++++++++++++++++++++------
utils.c | 1 +
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/html.c b/html.c
index ea7830c..5912422 100644
--- a/html.c
+++ b/html.c
@@ -277,6 +277,9 @@ d_char *html_top_controls(snac *snac, d_char *s)
"
%s: \n"
"
\n"
+ "
\n"
+ "
\n"
+
"
%s: \n"
"
\n"
@@ -320,6 +323,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
xs_dict_get(snac->config, "avatar"),
L("Bio"),
xs_dict_get(snac->config, "bio"),
+ xs_dict_get(snac->config, "cw"),
+ L("Always show sensitive content"),
L("Email address for notifications"),
email,
L("Password (only to change it)"),
@@ -613,11 +618,17 @@ 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 = "...";
-
- xs *s1 = xs_fmt("%s [%s]\n", v, L("SENSITIVE CONTENT"));
- s = xs_str_cat(s, s1);
-
- sensitive = 1;
+ char *cw = xs_dict_get(snac->config, "cw");
+ if (xs_is_null(cw))
+ cw = "";
+ if (strcmp(cw, "checked") == 0) {
+ xs *s1 = xs_fmt("