mirror of
https://github.com/unraid/webgui.git
synced 2026-04-22 18:19:14 -05:00
flush caches on token change
This commit is contained in:
@@ -227,25 +227,30 @@
|
||||
############
|
||||
{0}
|
||||
############
|
||||
|
||||
|
||||
if [ ! -f /usr/local/bin/jq ]; then
|
||||
curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o /usr/local/bin/jq;
|
||||
chmod +x /usr/local/bin/jq;
|
||||
mkdir -p /boot/config/telegram/;
|
||||
mkdir -p /boot/config/telegram;
|
||||
cp /usr/local/bin/jq /boot/config/telegram;
|
||||
grep -q "/jq" /boot/config/go;
|
||||
[ $? -eq 1 ] && echo "cp /boot/config/telegram/jq /usr/local/bin" >> /boot/config/go;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f /boot/config/telegram/chatid ]; then
|
||||
mkdir -p /boot/config/telegram/;
|
||||
$STORED_TOKEN=$(cat /boot/config/telegram/token) || "";
|
||||
if [[ ! -f /boot/config/telegram/token || "$STORED_TOKEN" != "$BOT_TOKEN" ]]; then
|
||||
mkdir -p /boot/config/telegram;
|
||||
echo -e "$BOT_TOKEN" > /boot/config/telegram/token;
|
||||
fi
|
||||
|
||||
if [[ ! -f /boot/config/telegram/chatid || "$STORED_TOKEN" != "$BOT_TOKEN" ]]; then
|
||||
mkdir -p /boot/config/telegram;
|
||||
curl https://api.telegram.org/bot$BOT_TOKEN/getUpdates | jq ".result | last .message .chat .id" > /boot/config/telegram/chatid;
|
||||
fi
|
||||
|
||||
CHATID=$(cat /boot/config/telegram/chatid)
|
||||
MESSAGE=$(echo -e "$(hostname): $MESSAGE")
|
||||
curl -G -v "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" --data-urlencode "chat_id=$CHATID" --data-urlencode "text=$MESSAGE" 2>&1
|
||||
CHATID=$(cat /boot/config/telegram/chatid);
|
||||
MESSAGE=$(echo -e "$(hostname): $MESSAGE");
|
||||
curl -G -v "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" --data-urlencode "chat_id=$CHATID" --data-urlencode "text=$MESSAGE" 2>&1;
|
||||
]]>
|
||||
</Script>
|
||||
</Agent>
|
||||
|
||||
Reference in New Issue
Block a user