From 66cee61d41ea7015858b0fae4e328b319a4aa949 Mon Sep 17 00:00:00 2001 From: mercury Date: Sun, 17 Nov 2024 15:08:01 +0400 Subject: [PATCH] allow telegram ip --- app/bot.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/bot.php b/app/bot.php index b160697..cfbc23e 100644 --- a/app/bot.php +++ b/app/bot.php @@ -4687,6 +4687,18 @@ DNS-over-HTTPS with IP: public function syncDeny() { $pac = $this->getPacConf(); + if ($r = fopen('/logs/nginx_tlgrm_access', 'r')) { + while (feof($r) === false) { + $l = fgets($r); + if (preg_match('~(\d+\.\d+\.\d+\.\d+)~', $l, $m)) { + $xr[$m[1]] = true; + } + } + fclose($r); + } + foreach (array_keys($xr) as $v) { + $text .= "allow $v;\n"; + } if (!empty($pac['white'])) { $pac['white'] = array_unique($pac['white']); sort($pac['white']);