mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Added support for sensitive content.
This commit is contained in:
parent
f767507896
commit
9612289477
16
html.c
16
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 *type = xs_dict_get(msg, "type");
|
||||||
char *meta = xs_dict_get(msg, "_snac");
|
char *meta = xs_dict_get(msg, "_snac");
|
||||||
char *actor;
|
char *actor;
|
||||||
|
int sensitive = 0;
|
||||||
|
char *v;
|
||||||
|
|
||||||
/* do not show non-public messages in the public timeline */
|
/* do not show non-public messages in the public timeline */
|
||||||
if (local && !is_msg_public(snac, msg))
|
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 */
|
/* add the content */
|
||||||
s = xs_str_cat(s, "<div class=\"e-content snac-content\">\n");
|
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"));
|
xs *c = xs_dup(xs_dict_get(msg, "content"));
|
||||||
char *p, *v;
|
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");
|
s = xs_str_cat(s, "</div>\n");
|
||||||
|
|
||||||
/** controls **/
|
/** controls **/
|
||||||
|
Loading…
Reference in New Issue
Block a user