From 570420274ed4cf6140f7a2eacff5c2a766b77ae6 Mon Sep 17 00:00:00 2001 From: mercury Date: Thu, 8 Aug 2024 11:26:14 +0400 Subject: [PATCH 1/2] improve updatepac --- app/updatepac.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/updatepac.php b/app/updatepac.php index 41417ac..d300c0e 100644 --- a/app/updatepac.php +++ b/app/updatepac.php @@ -89,11 +89,14 @@ function start() $conf = $bot->getPacConf(); - $subzones = array_keys(array_filter($conf['subzoneslist'], fn($x) => $x == true)); + if (!empty($conf['subzoneslist'])) { + $subzones = array_keys(array_filter($conf['subzoneslist'], fn($x) => $x == true)); + } // check && exclude - $include = array_filter($conf['includelist'], fn($x) => $x == true); - $domains = $include; + if (!empty($conf['includelist'])) { + $domains = array_filter($conf['includelist'], fn($x) => $x == true); + } if (empty($domains)) { $text = "Empty domains. Delete pac files"; unlink(__DIR__ . '/zapretlists/mpac'); @@ -146,10 +149,13 @@ function start() file_put_contents(__DIR__ . '/zapretlists/pac', $pac); $text .= "Create minified pac 100%\n"; } - // create reverse PAC - $domains = array_filter($conf['reverselist'], fn($x) => $x == true); + unset($domains); + if (!empty($conf['reverselist'])) { + $domains = array_filter($conf['reverselist'], fn($x) => $x == true); + } if (empty($domains)) { + // $text .= "Empty reverse domains. Delete reverse pac files"; unlink(__DIR__ . '/zapretlists/rmpac'); unlink(__DIR__ . '/zapretlists/rpac'); @@ -197,6 +203,7 @@ function start() file_put_contents(__DIR__ . '/zapretlists/rpac', $pac); $text .= 'Create minified reverse pac 100%'; } + endScript($text); } @@ -242,7 +249,6 @@ $load = [ '-', '\\', ]; - switch ($_SERVER['argv'][1]) { case 'start': $bot = new Bot($c['key'], $i); From b5ca5fbf93914d51fe02deb08f23c14aa2785353 Mon Sep 17 00:00:00 2001 From: mercury Date: Thu, 8 Aug 2024 17:11:26 +0400 Subject: [PATCH 2/2] mirror --- app/bot.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/bot.php b/app/bot.php index d8e749e..bc98478 100644 --- a/app/bot.php +++ b/app/bot.php @@ -133,6 +133,9 @@ class Bot case preg_match('~^/changeWG (\d+)$~', $this->input['callback'], $m): $this->changeWG($m[1]); break; + case preg_match('~^/mirror$~', $this->input['message'], $m): + $this->menu('mirror'); + break; case preg_match('~^/id$~', $this->input['message'], $m): $this->send($this->input['chat'], $this->input['from'], $this->input['message_id']); break;