summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-30 06:01:11 +0100
committerdefault <nobody@localhost>2022-10-30 06:01:11 +0100
commit9612289477e3ec121d50f63a46a887c7e8118c2f (patch)
treeb32ab3fbf2e2dcd958db3c4828f82e5931528bec
parentf767507896cce7c9beeb6b3505bd841e092e9e20 (diff)
Added support for sensitive content.
-rw-r--r--html.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/html.c b/html.c
index 43638d5..811aeba 100644
--- a/html.c
+++ b/html.c
@@ -444,6 +444,8 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
char *type = xs_dict_get(msg, "type");
char *meta = xs_dict_get(msg, "_snac");
char *actor;
+ int sensitive = 0;
+ char *v;
/* do not show non-public messages in the public timeline */
if (local && !is_msg_public(snac, msg))
@@ -563,6 +565,17 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
/* add the content */
s = xs_str_cat(s, "<div class=\"e-content snac-content\">\n");
+ /* is it sensitive? */
+ 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("<details><summary>%s [%s]</summary>\n", v, L("SENSITIVE CONTENT"));
+ s = xs_str_cat(s, s1);
+
+ sensitive = 1;
+ }
+
{
xs *c = xs_dup(xs_dict_get(msg, "content"));
char *p, *v;
@@ -642,6 +655,9 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
}
}
+ if (sensitive)
+ s = xs_str_cat(s, "</details><p>\n");
+
s = xs_str_cat(s, "</div>\n");
/** controls **/