Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e1f14d85e0 | |||
| dc65e65e20 | |||
| 486a2c5959 | |||
| 39643bf681 |
+65
-11
@@ -482,8 +482,8 @@ class Bot
|
||||
case preg_match('~^/proxy$~', $this->input['callback'], $m):
|
||||
$this->proxy();
|
||||
break;
|
||||
case preg_match('~^/showpac$~', $this->input['callback'], $m):
|
||||
$this->showpac();
|
||||
case preg_match('~^/addOverrideHtml$~', $this->input['callback'], $m):
|
||||
$this->addOverrideHtml();
|
||||
break;
|
||||
case preg_match('~^/export$~', $this->input['callback'], $m):
|
||||
$this->exportManual();
|
||||
@@ -809,6 +809,30 @@ class Bot
|
||||
];
|
||||
}
|
||||
|
||||
public function addOverrideHtml()
|
||||
{
|
||||
$r = $this->send(
|
||||
$this->input['chat'],
|
||||
"@{$this->input['username']} attach html",
|
||||
$this->input['message_id'],
|
||||
reply: 'attach html',
|
||||
);
|
||||
$_SESSION['reply'][$r['result']['message_id']] = [
|
||||
'start_message' => $this->input['message_id'],
|
||||
'start_callback' => $this->input['callback_id'],
|
||||
'callback' => 'setOverrideHtml',
|
||||
'args' => [],
|
||||
];
|
||||
}
|
||||
|
||||
public function setOverrideHtml()
|
||||
{
|
||||
$r = $this->request('getFile', ['file_id' => $this->input['file_id']]);
|
||||
if (!empty($f = file_get_contents($this->file . $r['result']['file_path']))) {
|
||||
file_put_contents('/app/webapp/override.html', $f);
|
||||
}
|
||||
}
|
||||
|
||||
public function restartOcserv($conf)
|
||||
{
|
||||
file_put_contents('/config/ocserv.conf', $conf);
|
||||
@@ -4847,12 +4871,11 @@ DNS-over-HTTPS with IP:
|
||||
exit;
|
||||
case 'w':
|
||||
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
||||
file_put_contents('/singbox/winsw3.xml', preg_replace('#~url~#', $link, file_get_contents('/singbox/winsw3.xml')));
|
||||
$n = "singbox_$uid.zip";
|
||||
$n = "singbox_$uid.zip";
|
||||
copy('/singbox/singbox.zip', $n);
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($n, ZipArchive::CREATE);
|
||||
$zip->addFile('/singbox/winsw3.xml', 'winsw3.xml');
|
||||
$zip->addFromString('winsw3.xml', preg_replace('#~url~#', $link, file_get_contents('/singbox/winsw3.xml')));
|
||||
$zip->close();
|
||||
header('Content-Disposition: attachment; filename="singbox.zip"');
|
||||
echo file_get_contents($n);
|
||||
@@ -4959,6 +4982,7 @@ DNS-over-HTTPS with IP:
|
||||
$c['route']['rules'] = array_values($c['route']['rules']);
|
||||
$c['route'] = $this->addRuleSet($c['route']);
|
||||
$c['route'] = $this->addPackageRule($c['route']);
|
||||
$c['route'] = $this->addProcessRule($c['route']);
|
||||
$c['route'] = $this->createRuleSet($c['route'], $uid, $domain);
|
||||
$c['route'] = $this->clearEmptyRules($c['route']);
|
||||
break;
|
||||
@@ -4981,12 +5005,36 @@ DNS-over-HTTPS with IP:
|
||||
|
||||
public function addPackageRule($route)
|
||||
{
|
||||
$p = $this->getPacConf();
|
||||
if (!empty($t = array_filter($p['packagelist'] ?: []))) {
|
||||
$route['rules'][] = [
|
||||
'package_name' => array_keys($t),
|
||||
'outbound' => $p['app_outbound'] ? 'direct' : 'proxy',
|
||||
];
|
||||
foreach ($route['rules'] as $k => $v) {
|
||||
if (array_key_exists('package_name', $v)) {
|
||||
$p = $this->getPacConf();
|
||||
if (!empty($t = array_filter($p['packagelist'] ?: []))) {
|
||||
$route['rules'][$k] = [
|
||||
'package_name' => array_keys($t),
|
||||
'outbound' => $p['app_outbound'] ? 'direct' : 'proxy',
|
||||
];
|
||||
} else {
|
||||
unset($route['rules'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
|
||||
public function addProcessRule($route)
|
||||
{
|
||||
foreach ($route['rules'] as $k => $v) {
|
||||
if (array_key_exists('process_name', $v)) {
|
||||
$p = $this->getPacConf();
|
||||
if (!empty($t = array_filter($p['processlist'] ?: []))) {
|
||||
$route['rules'][$k] = [
|
||||
'process_name' => array_keys($t),
|
||||
'outbound' => $p['process_outbound'] ? 'direct' : 'proxy',
|
||||
];
|
||||
} else {
|
||||
unset($route['rules'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $route;
|
||||
}
|
||||
@@ -5518,6 +5566,12 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/backup",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('fake html'),
|
||||
'callback_data' => "/addOverrideHtml",
|
||||
],
|
||||
];
|
||||
$data[] = [
|
||||
[
|
||||
'text' => $this->i18n('logs'),
|
||||
|
||||
@@ -337,4 +337,8 @@ $i = [
|
||||
'en' => '🟢 have updates',
|
||||
'ru' => '🟢 есть обновления',
|
||||
],
|
||||
'fake html' => [
|
||||
'en' => 'fake html',
|
||||
'ru' => 'фейк заглушка',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -110,6 +110,16 @@
|
||||
"protocol": "dns",
|
||||
"outbound": "dns-out"
|
||||
},
|
||||
{
|
||||
"package_name": [
|
||||
],
|
||||
"outbound": "proxy"
|
||||
},
|
||||
{
|
||||
"process_name": [
|
||||
],
|
||||
"outbound": "proxy"
|
||||
},
|
||||
{
|
||||
"createruleset": [
|
||||
{
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
13.10.2024 v1.66
|
||||
- singbox template: изменен порядок правил маршрутизации для package_name
|
||||
10.10.2024 v1.65.1
|
||||
- фикс создания архива windows service singbox 2
|
||||
09.10.2024 v1.65
|
||||
- фикс создания архива windows service singbox
|
||||
06.10.2024 v1.64.1
|
||||
- добавление html заглушки через меню
|
||||
06.10.2024 v1.64
|
||||
- возможность установить свою html-заглушку
|
||||
06.10.2024 v1.63
|
||||
|
||||
Reference in New Issue
Block a user