diff options
| author | 2023-02-05 19:09:22 +0100 | |
|---|---|---|
| committer | 2023-02-05 19:09:22 +0100 | |
| commit | 70c73d03363e890c4d7f85287fa7624160b1c352 (patch) | |
| tree | 1af3c8c37688152875f857c6ae664d8104ad2768 /html.c | |
| parent | Reworked purge_user() to be clearer. (diff) | |
| download | snac2-70c73d03363e890c4d7f85287fa7624160b1c352.tar.gz snac2-70c73d03363e890c4d7f85287fa7624160b1c352.tar.xz snac2-70c73d03363e890c4d7f85287fa7624160b1c352.zip | |
New user option 'purge_days'.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 15 |
1 files changed, 15 insertions, 0 deletions
| @@ -307,6 +307,9 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 307 | "<input type=\"text\" name=\"email\" value=\"%s\"></p>\n" | 307 | "<input type=\"text\" name=\"email\" value=\"%s\"></p>\n" |
| 308 | 308 | ||
| 309 | "<p>%s:<br>\n" | 309 | "<p>%s:<br>\n" |
| 310 | "<input type=\"number\" name=\"purge_days\" value=\"%s\"></p>\n" | ||
| 311 | |||
| 312 | "<p>%s:<br>\n" | ||
| 310 | "<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n" | 313 | "<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n" |
| 311 | 314 | ||
| 312 | "<p>%s:<br>\n" | 315 | "<p>%s:<br>\n" |
| @@ -329,6 +332,12 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 329 | if (xs_is_null(cw)) | 332 | if (xs_is_null(cw)) |
| 330 | cw = ""; | 333 | cw = ""; |
| 331 | 334 | ||
| 335 | const char *purge_days = xs_dict_get(snac->config, "purge_days"); | ||
| 336 | if (!xs_is_null(purge_days) && xs_type(purge_days) == XSTYPE_NUMBER) | ||
| 337 | purge_days = xs_number_str(purge_days); | ||
| 338 | else | ||
| 339 | purge_days = "0"; | ||
| 340 | |||
| 332 | xs *s1 = xs_fmt(_tmpl, | 341 | xs *s1 = xs_fmt(_tmpl, |
| 333 | snac->actor, | 342 | snac->actor, |
| 334 | L("Sensitive content"), | 343 | L("Sensitive content"), |
| @@ -355,6 +364,8 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 355 | L("Always show sensitive content"), | 364 | L("Always show sensitive content"), |
| 356 | L("Email address for notifications"), | 365 | L("Email address for notifications"), |
| 357 | email, | 366 | email, |
| 367 | L("Maximum days to keep posts (0: server settings)"), | ||
| 368 | purge_days, | ||
| 358 | L("Password (only to change it)"), | 369 | L("Password (only to change it)"), |
| 359 | L("Repeat Password"), | 370 | L("Repeat Password"), |
| 360 | L("Update user info") | 371 | L("Update user info") |
| @@ -1567,6 +1578,10 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | |||
| 1567 | } | 1578 | } |
| 1568 | if ((v = xs_dict_get(p_vars, "email")) != NULL) | 1579 | if ((v = xs_dict_get(p_vars, "email")) != NULL) |
| 1569 | snac.config = xs_dict_set(snac.config, "email", v); | 1580 | snac.config = xs_dict_set(snac.config, "email", v); |
| 1581 | if ((v = xs_dict_get(p_vars, "purge_days")) != NULL) { | ||
| 1582 | xs *days = xs_number_new(atof(v)); | ||
| 1583 | snac.config = xs_dict_set(snac.config, "purge_days", days); | ||
| 1584 | } | ||
| 1570 | 1585 | ||
| 1571 | /* password change? */ | 1586 | /* password change? */ |
| 1572 | if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL && | 1587 | if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL && |