Posts can be marked as 'sensitive content' (not yet for replies).

This commit is contained in:
default 2022-11-16 11:42:16 +01:00
parent 36ff972173
commit a06930f4da
2 changed files with 11 additions and 1 deletions

2
data.c
View file

@ -79,7 +79,7 @@ int srv_open(char *basedir)
if (error != NULL) if (error != NULL)
srv_log(error); srv_log(error);
/* disabled temporarily; messages can't be sent */ /* disabled temporarily; messages can't be sent (libcurl issue?) */
#if 0 #if 0
#ifdef __OpenBSD__ #ifdef __OpenBSD__
srv_debug(2, xs_fmt("Calling unveil()")); srv_debug(2, xs_fmt("Calling unveil()"));

10
html.c
View file

@ -242,6 +242,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
"<textarea class=\"snac-textarea\" name=\"content\" " "<textarea class=\"snac-textarea\" name=\"content\" "
"rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n" "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n"
"<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n" "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n"
"<p><input type=\"checkbox\" name=\"sensitive\"> %s\n"
"<p><input type=\"file\" name=\"attach\">\n" "<p><input type=\"file\" name=\"attach\">\n"
"<p><input type=\"submit\" class=\"button\" value=\"%s\">\n" "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n"
"</form><p>\n" "</form><p>\n"
@ -297,6 +298,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
xs *s1 = xs_fmt(_tmpl, xs *s1 = xs_fmt(_tmpl,
snac->actor, snac->actor,
L("Sensitive content"),
L("Post"), L("Post"),
L("More options..."), L("More options..."),
@ -1120,6 +1122,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
char *attach_url = xs_dict_get(p_vars, "attach_url"); char *attach_url = xs_dict_get(p_vars, "attach_url");
char *attach_file = xs_dict_get(p_vars, "attach"); char *attach_file = xs_dict_get(p_vars, "attach");
char *to = xs_dict_get(p_vars, "to"); char *to = xs_dict_get(p_vars, "to");
char *sensitive = xs_dict_get(p_vars, "sensitive");
xs *attach_list = xs_list_new(); xs *attach_list = xs_list_new();
/* is attach_url set? */ /* is attach_url set? */
@ -1152,6 +1155,13 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
msg = msg_note(&snac, content_2, to, in_reply_to, attach_list); msg = msg_note(&snac, content_2, to, in_reply_to, attach_list);
if (sensitive != NULL) {
xs *t = xs_val_new(XSTYPE_TRUE);
msg = xs_dict_set(msg, "sensitive", t);
msg = xs_dict_set(msg, "summary", "...");
}
c_msg = msg_create(&snac, msg); c_msg = msg_create(&snac, msg);
post(&snac, c_msg); post(&snac, c_msg);