Compare commits

...

4 Commits

Author SHA1 Message Date
mercury ef3d40c098 update version 2024-08-09 23:59:48 +04:00
mercury ded85fb79f fix "delete all" 2024-08-09 23:56:57 +04:00
mercury b5ca5fbf93 mirror 2024-08-08 17:11:26 +04:00
mercury 570420274e improve updatepac 2024-08-08 12:45:44 +04:00
3 changed files with 75 additions and 24 deletions
+61 -18
View File
@@ -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;
@@ -142,11 +145,11 @@ class Bot
case preg_match('~^/mtproto$~', $this->input['callback'], $m):
$this->mtproto();
break;
case preg_match('~^/deletePac$~', $this->input['callback'], $m):
$this->deletePac();
case preg_match('~^/deleteAll (\w+)$~', $this->input['callback'], $m):
$this->deleteAll($m[1]);
break;
case preg_match('~^/deletePacYes$~', $this->input['callback'], $m):
$this->deletePacYes();
case preg_match('~^/deleteYes (\w+)$~', $this->input['callback'], $m):
$this->deleteYes($m[1]);
break;
case preg_match('~^/addCommunityFilter$~', $this->input['callback'], $m):
$this->addCommunityFilter();
@@ -3145,32 +3148,72 @@ DNS-over-HTTPS with IP:
);
}
public function deletePacYes()
public function deleteYes($type)
{
$c = $this->getPacConf();
unset($c['includelist']);
unset($c[$type]);
$this->setPacConf($c);
$this->pacUpdate();
$this->menu('pac');
switch ($type) {
case 'includelist':
$this->pacUpdate();
break;
case 'blocklist':
$this->xtlsblock();
break;
case 'warplist':
$this->xtlswarp();
break;
}
}
public function deletePac($page = 0)
public function deleteAll($type)
{
switch ($type) {
case 'includelist':
$dir = 'PAC';
break;
case 'warplist':
$dir = 'WARP';
break;
case 'blocklist':
$dir = 'BLOCK';
break;
}
$text = <<<text
Menu -> PAC -> delete all
Menu -> $dir -> delete all
text;
$data[] = [
[
'text' => $this->i18n('yes'),
'callback_data' => "/deletePacYes",
],
];
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/pacMenu 0",
'callback_data' => "/deleteYes $type",
],
];
switch ($type) {
case 'includelist':
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/pacMenu 0",
],
];
break;
case 'warplist':
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/xtlswarp",
],
];
break;
case 'blocklist':
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/xtlsblock",
],
];
break;
}
$this->update(
$this->input['chat'],
$this->input['message_id'],
@@ -3259,7 +3302,7 @@ DNS-over-HTTPS with IP:
$data[] = [
[
'text' => $this->i18n('delete all'),
'callback_data' => "/deletePac",
'callback_data' => "/deleteAll $type",
],
];
}
+12 -6
View File
@@ -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);
+2
View File
@@ -1,3 +1,5 @@
09.08.2024 v1.41.1
- фикс для "удалить все" в списках доменов
06.08.2024 v1.41
- возможность очистить РАС лист
03.08.2024 v1.40