mirror of
https://github.com/anten-ka/gotelegram_pro.git
synced 2026-05-19 11:26:03 +00:00
v2.5.0: harden telemt user reloads
This commit is contained in:
@@ -210,6 +210,25 @@ first_telemt_user_secret() {
|
||||
get_telemt_users_block "$config" | head -1 | sed 's/^[^=]*=[[:space:]]*//; s/^"//; s/".*$//' | tr -d ' '
|
||||
}
|
||||
|
||||
telemt_users_block_has_main() {
|
||||
local users_block="$1"
|
||||
printf '%s\n' "$users_block" | awk -F= '
|
||||
/^[[:space:]]*#/ || ! /=/ { next }
|
||||
{
|
||||
key=$1
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", key)
|
||||
if (key ~ /^".*"$/ || key ~ /^\047.*\047$/) {
|
||||
key=substr(key, 2, length(key) - 2)
|
||||
}
|
||||
if (key == "main") {
|
||||
found=1
|
||||
exit
|
||||
}
|
||||
}
|
||||
END { exit found ? 0 : 1 }
|
||||
'
|
||||
}
|
||||
|
||||
replace_telemt_users_block() {
|
||||
local users_block="$1"
|
||||
local config="${2:-$TELEMT_CONFIG}"
|
||||
|
||||
Reference in New Issue
Block a user