diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 26 |
1 files changed, 26 insertions, 0 deletions
| @@ -853,6 +853,14 @@ xs_html *html_top_controls(snac *snac) | |||
| 853 | if (xs_is_null(telegram_chat_id)) | 853 | if (xs_is_null(telegram_chat_id)) |
| 854 | telegram_chat_id = ""; | 854 | telegram_chat_id = ""; |
| 855 | 855 | ||
| 856 | char *ntfy_server = xs_dict_get(snac->config, "ntfy_server"); | ||
| 857 | if (xs_is_null(ntfy_server)) | ||
| 858 | ntfy_server = ""; | ||
| 859 | |||
| 860 | char *ntfy_token = xs_dict_get(snac->config, "ntfy_token"); | ||
| 861 | if (xs_is_null(ntfy_token)) | ||
| 862 | ntfy_token = ""; | ||
| 863 | |||
| 856 | char *purge_days = xs_dict_get(snac->config, "purge_days"); | 864 | char *purge_days = xs_dict_get(snac->config, "purge_days"); |
| 857 | if (!xs_is_null(purge_days) && xs_type(purge_days) == XSTYPE_NUMBER) | 865 | if (!xs_is_null(purge_days) && xs_type(purge_days) == XSTYPE_NUMBER) |
| 858 | purge_days = (char *)xs_number_str(purge_days); | 866 | purge_days = (char *)xs_number_str(purge_days); |
| @@ -947,6 +955,20 @@ xs_html *html_top_controls(snac *snac) | |||
| 947 | xs_html_attr("value", telegram_chat_id), | 955 | xs_html_attr("value", telegram_chat_id), |
| 948 | xs_html_attr("placeholder", "Chat id"))), | 956 | xs_html_attr("placeholder", "Chat id"))), |
| 949 | xs_html_tag("p", | 957 | xs_html_tag("p", |
| 958 | xs_html_text(L("ntfy notifications (ntfy server and token):")), | ||
| 959 | xs_html_sctag("br", NULL), | ||
| 960 | xs_html_sctag("input", | ||
| 961 | xs_html_attr("type", "text"), | ||
| 962 | xs_html_attr("name", "ntfy_server"), | ||
| 963 | xs_html_attr("value", ntfy_server), | ||
| 964 | xs_html_attr("placeholder", "ntfy server - full URL (example: https://ntfy.sh/YourTopic)")), | ||
| 965 | xs_html_text(" "), | ||
| 966 | xs_html_sctag("input", | ||
| 967 | xs_html_attr("type", "text"), | ||
| 968 | xs_html_attr("name", "ntfy_token"), | ||
| 969 | xs_html_attr("value", ntfy_token), | ||
| 970 | xs_html_attr("placeholder", "ntfy token - if needed"))), | ||
| 971 | xs_html_tag("p", | ||
| 950 | xs_html_text(L("Maximum days to keep posts (0: server settings):")), | 972 | xs_html_text(L("Maximum days to keep posts (0: server settings):")), |
| 951 | xs_html_sctag("br", NULL), | 973 | xs_html_sctag("br", NULL), |
| 952 | xs_html_sctag("input", | 974 | xs_html_sctag("input", |
| @@ -2890,6 +2912,10 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 2890 | snac.config = xs_dict_set(snac.config, "telegram_bot", v); | 2912 | snac.config = xs_dict_set(snac.config, "telegram_bot", v); |
| 2891 | if ((v = xs_dict_get(p_vars, "telegram_chat_id")) != NULL) | 2913 | if ((v = xs_dict_get(p_vars, "telegram_chat_id")) != NULL) |
| 2892 | snac.config = xs_dict_set(snac.config, "telegram_chat_id", v); | 2914 | snac.config = xs_dict_set(snac.config, "telegram_chat_id", v); |
| 2915 | if ((v = xs_dict_get(p_vars, "ntfy_server")) != NULL) | ||
| 2916 | snac.config = xs_dict_set(snac.config, "ntfy_server", v); | ||
| 2917 | if ((v = xs_dict_get(p_vars, "ntfy_token")) != NULL) | ||
| 2918 | snac.config = xs_dict_set(snac.config, "ntfy_token", v); | ||
| 2893 | if ((v = xs_dict_get(p_vars, "purge_days")) != NULL) { | 2919 | if ((v = xs_dict_get(p_vars, "purge_days")) != NULL) { |
| 2894 | xs *days = xs_number_new(atof(v)); | 2920 | xs *days = xs_number_new(atof(v)); |
| 2895 | snac.config = xs_dict_set(snac.config, "purge_days", days); | 2921 | snac.config = xs_dict_set(snac.config, "purge_days", days); |