From 70c73d03363e890c4d7f85287fa7624160b1c352 Mon Sep 17 00:00:00 2001
From: default
Date: Sun, 5 Feb 2023 19:09:22 +0100
Subject: New user option 'purge_days'.
---
html.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
(limited to 'html.c')
diff --git a/html.c b/html.c
index f163921..8351143 100644
--- a/html.c
+++ b/html.c
@@ -306,6 +306,9 @@ d_char *html_top_controls(snac *snac, d_char *s)
"
%s:
\n"
"
\n"
+ "%s:
\n"
+ "
\n"
+
"%s:
\n"
"
\n"
@@ -329,6 +332,12 @@ d_char *html_top_controls(snac *snac, d_char *s)
if (xs_is_null(cw))
cw = "";
+ const char *purge_days = xs_dict_get(snac->config, "purge_days");
+ if (!xs_is_null(purge_days) && xs_type(purge_days) == XSTYPE_NUMBER)
+ purge_days = xs_number_str(purge_days);
+ else
+ purge_days = "0";
+
xs *s1 = xs_fmt(_tmpl,
snac->actor,
L("Sensitive content"),
@@ -355,6 +364,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
L("Always show sensitive content"),
L("Email address for notifications"),
email,
+ L("Maximum days to keep posts (0: server settings)"),
+ purge_days,
L("Password (only to change it)"),
L("Repeat Password"),
L("Update user info")
@@ -1567,6 +1578,10 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
}
if ((v = xs_dict_get(p_vars, "email")) != NULL)
snac.config = xs_dict_set(snac.config, "email", v);
+ if ((v = xs_dict_get(p_vars, "purge_days")) != NULL) {
+ xs *days = xs_number_new(atof(v));
+ snac.config = xs_dict_set(snac.config, "purge_days", days);
+ }
/* password change? */
if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL &&
--
cgit v1.2.3