#!/usr/bin/haserl <%in p/common.cgi %> <% page_title="Telegram" config_file=/etc/webui/telegram.conf params="enabled token channel interval caption crontab document heif proxy" if [ "$REQUEST_METHOD" = "POST" ]; then for p in $params; do eval telegram_${p}=\$POST_telegram_${p} done if [ "$telegram_enabled" = "true" ]; then [ -z "$telegram_token" ] && set_error_flag "Telegram token cannot be empty." [ -z "$telegram_channel" ] && set_error_flag "Telegram channel cannot be empty." fi if [ -z "$error" ]; then rm -f "$config_file" for p in $params; do echo "telegram_${p}=\"$(eval echo \$telegram_${p})\"" >> "$config_file" done sed -i /telegram/d /etc/crontabs/root if [ "$telegram_enabled" = "true" ] && [ "$telegram_crontab" = "true" ]; then echo "*/${telegram_interval} * * * * /usr/sbin/telegram" >> /etc/crontabs/root fi redirect_back "success" "Telegram config updated." fi redirect_to "$SCRIPT_NAME" fi [ -e "$config_file" ] && include $config_file [ -z "$telegram_crontab" ] && telegram_crontab="true" [ -z "$telegram_interval" ] && telegram_interval="15" %> <%in p/header.cgi %>
<%in p/footer.cgi %>