diff --git a/html.c b/html.c
index 8351143..d788458 100644
--- a/html.c
+++ b/html.c
@@ -306,6 +306,10 @@ d_char *html_top_controls(snac *snac, d_char *s)
"
%s:
\n"
"
\n"
+ "%s:
\n"
+ " "
+ "
\n"
+
"%s:
\n"
"
\n"
@@ -332,6 +336,14 @@ d_char *html_top_controls(snac *snac, d_char *s)
if (xs_is_null(cw))
cw = "";
+ char *telegram_bot = xs_dict_get(snac->config, "telegram_bot");
+ if (xs_is_null(telegram_bot))
+ telegram_bot = "";
+
+ char *telegram_chat_id = xs_dict_get(snac->config, "telegram_chat_id");
+ if (xs_is_null(telegram_chat_id))
+ telegram_chat_id = "";
+
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);
@@ -364,6 +376,9 @@ d_char *html_top_controls(snac *snac, d_char *s)
L("Always show sensitive content"),
L("Email address for notifications"),
email,
+ L("Telegram notifications (bot key and chat id)"),
+ telegram_bot,
+ telegram_chat_id,
L("Maximum days to keep posts (0: server settings)"),
purge_days,
L("Password (only to change it)"),
@@ -1578,6 +1593,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, "telegram_bot")) != NULL)
+ snac.config = xs_dict_set(snac.config, "telegram_bot", v);
+ if ((v = xs_dict_get(p_vars, "telegram_chat_id")) != NULL)
+ snac.config = xs_dict_set(snac.config, "telegram_chat_id", 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);