diff options
| author | 2023-10-16 18:59:41 +0200 | |
|---|---|---|
| committer | 2023-10-16 18:59:41 +0200 | |
| commit | 85a9ebc47188ad10a245b2735ec46affac6d0514 (patch) | |
| tree | eaeb80ce39a0ebaa6472103402152224858e05ad | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-85a9ebc47188ad10a245b2735ec46affac6d0514.tar.gz snac2-85a9ebc47188ad10a245b2735ec46affac6d0514.tar.xz snac2-85a9ebc47188ad10a245b2735ec46affac6d0514.zip | |
Added web UI for setting the 'private' flag.
| -rw-r--r-- | html.c | 10 |
1 files changed, 10 insertions, 0 deletions
| @@ -607,6 +607,9 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 607 | "<p><input type=\"checkbox\" name=\"bot\" id=\"bot\" %s>\n" | 607 | "<p><input type=\"checkbox\" name=\"bot\" id=\"bot\" %s>\n" |
| 608 | "<label for=\"bot\">%s</label></p>\n" | 608 | "<label for=\"bot\">%s</label></p>\n" |
| 609 | 609 | ||
| 610 | "<p><input type=\"checkbox\" name=\"private\" id=\"private\" %s>\n" | ||
| 611 | "<label for=\"private\">%s</label></p>\n" | ||
| 612 | |||
| 610 | "<p>%s:<br>\n" | 613 | "<p>%s:<br>\n" |
| 611 | "<textarea name=\"metadata\" cols=\"40\" rows=\"4\" " | 614 | "<textarea name=\"metadata\" cols=\"40\" rows=\"4\" " |
| 612 | "placeholder=\"Blog=https:/" "/example.com/my-blog\nGPG Key=1FA54\n...\">" | 615 | "placeholder=\"Blog=https:/" "/example.com/my-blog\nGPG Key=1FA54\n...\">" |
| @@ -659,6 +662,7 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 659 | const char *d_dm_f_u = xs_dict_get(snac->config, "drop_dm_from_unknown"); | 662 | const char *d_dm_f_u = xs_dict_get(snac->config, "drop_dm_from_unknown"); |
| 660 | 663 | ||
| 661 | const char *bot = xs_dict_get(snac->config, "bot"); | 664 | const char *bot = xs_dict_get(snac->config, "bot"); |
| 665 | const char *a_private = xs_dict_get(snac->config, "private"); | ||
| 662 | 666 | ||
| 663 | xs *es1 = encode_html(xs_dict_get(snac->config, "name")); | 667 | xs *es1 = encode_html(xs_dict_get(snac->config, "name")); |
| 664 | xs *es2 = encode_html(xs_dict_get(snac->config, "bio")); | 668 | xs *es2 = encode_html(xs_dict_get(snac->config, "bio")); |
| @@ -730,6 +734,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s) | |||
| 730 | L("Drop direct messages from people you don't follow"), | 734 | L("Drop direct messages from people you don't follow"), |
| 731 | xs_type(bot) == XSTYPE_TRUE ? "checked" : "", | 735 | xs_type(bot) == XSTYPE_TRUE ? "checked" : "", |
| 732 | L("This account is a bot"), | 736 | L("This account is a bot"), |
| 737 | xs_type(a_private) == XSTYPE_TRUE ? "checked" : "", | ||
| 738 | L("This account is private (posts are not shown through the web)"), | ||
| 733 | 739 | ||
| 734 | L("Profile metadata (key=value pairs in each line)"), | 740 | L("Profile metadata (key=value pairs in each line)"), |
| 735 | metadata, | 741 | metadata, |
| @@ -2545,6 +2551,10 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 2545 | snac.config = xs_dict_set(snac.config, "bot", xs_stock_true); | 2551 | snac.config = xs_dict_set(snac.config, "bot", xs_stock_true); |
| 2546 | else | 2552 | else |
| 2547 | snac.config = xs_dict_set(snac.config, "bot", xs_stock_false); | 2553 | snac.config = xs_dict_set(snac.config, "bot", xs_stock_false); |
| 2554 | if ((v = xs_dict_get(p_vars, "private")) != NULL && strcmp(v, "on") == 0) | ||
| 2555 | snac.config = xs_dict_set(snac.config, "private", xs_stock_true); | ||
| 2556 | else | ||
| 2557 | snac.config = xs_dict_set(snac.config, "private", xs_stock_false); | ||
| 2548 | if ((v = xs_dict_get(p_vars, "metadata")) != NULL) { | 2558 | if ((v = xs_dict_get(p_vars, "metadata")) != NULL) { |
| 2549 | /* split the metadata and store it as a dict */ | 2559 | /* split the metadata and store it as a dict */ |
| 2550 | xs_dict *md = xs_dict_new(); | 2560 | xs_dict *md = xs_dict_new(); |