Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db6a18f498 | |||
| 6954a16fa2 | |||
| ca7a9c955d | |||
| 852fbd55c6 | |||
| 3a8a843d8c | |||
| 90828d1117 | |||
| 37e8b96bcf | |||
| 306bc41813 | |||
| f6e5da382b | |||
| d7ed7042ec | |||
| 4496a30552 | |||
| ca1a596f85 | |||
| b3edf1bdcc | |||
| c6306aa918 | |||
| d5bbc9a564 | |||
| d2aab8ee4b | |||
| 304217d36e |
+208
-48
@@ -162,6 +162,9 @@ class Bot
|
|||||||
case preg_match('~^/switchBanIp$~', $this->input['callback'], $m):
|
case preg_match('~^/switchBanIp$~', $this->input['callback'], $m):
|
||||||
$this->switchBanIp();
|
$this->switchBanIp();
|
||||||
break;
|
break;
|
||||||
|
case preg_match('~^/switchMonthlyStats$~', $this->input['callback'], $m):
|
||||||
|
$this->switchMonthlyStats();
|
||||||
|
break;
|
||||||
case preg_match('~^/setIpLimit$~', $this->input['callback'], $m):
|
case preg_match('~^/setIpLimit$~', $this->input['callback'], $m):
|
||||||
$this->setIpLimit();
|
$this->setIpLimit();
|
||||||
break;
|
break;
|
||||||
@@ -1337,6 +1340,7 @@ class Bot
|
|||||||
$this->checkVersion();
|
$this->checkVersion();
|
||||||
$this->checkBackup($period);
|
$this->checkBackup($period);
|
||||||
$this->checkLogs($period);
|
$this->checkLogs($period);
|
||||||
|
$this->checkResetXrayStats($period);
|
||||||
$this->checkCert();
|
$this->checkCert();
|
||||||
$this->autoAnalyzeLogs();
|
$this->autoAnalyzeLogs();
|
||||||
$this->xrayStatsUser();
|
$this->xrayStatsUser();
|
||||||
@@ -1444,6 +1448,29 @@ class Bot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function checkResetXrayStats($delta)
|
||||||
|
{
|
||||||
|
$pac = $this->getPacConf();
|
||||||
|
if (!empty($pac['reset_monthly'])) {
|
||||||
|
$now = strtotime(date('Y-m-d H:i:s'));
|
||||||
|
$start = strtotime('first day of previous month midnight');
|
||||||
|
$period = strtotime('1 month', 0);
|
||||||
|
if (
|
||||||
|
!empty($start)
|
||||||
|
&& !empty($period)
|
||||||
|
&& empty($this->backup)
|
||||||
|
&& $now - $start >= 0
|
||||||
|
&& (($now - $start) % $period < $delta)
|
||||||
|
) {
|
||||||
|
$this->resetXrStats(1);
|
||||||
|
require __DIR__ . '/config.php';
|
||||||
|
foreach ($c['admin'] as $admin) {
|
||||||
|
$this->send($admin, "vless: reset stats");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function checkLogs($delta)
|
public function checkLogs($delta)
|
||||||
{
|
{
|
||||||
$c = $this->getPacConf();
|
$c = $this->getPacConf();
|
||||||
@@ -3395,10 +3422,14 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => '<<',
|
'text' => '<<',
|
||||||
'callback_data' => "/subnet {$wgpage}_" . ($page - 1 >= 0 ? $page - 1 : $all - 1) . ($openconnect ? '_1' : ''),
|
'callback_data' => "/subnet {$wgpage}_" . ($page - 1 >= 0 ? $page - 1 : $all - 1) . ($openconnect ? '_1' : ''),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $page + 1,
|
||||||
|
'callback_data' => "/subnet {$wgpage}_$page" . ($openconnect ? '_1' : ''),
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'text' => '>>',
|
'text' => '>>',
|
||||||
'callback_data' => "/subnet {$wgpage}_" . ($page < $all - 1 ? $page + 1 : 0) . ($openconnect ? '_1' : ''),
|
'callback_data' => "/subnet {$wgpage}_" . ($page < $all - 1 ? $page + 1 : 0) . ($openconnect ? '_1' : ''),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3634,10 +3665,10 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => '<<',
|
'text' => '<<',
|
||||||
'callback_data' => "/menu wg " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
'callback_data' => "/menu wg " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
||||||
],
|
],
|
||||||
// [
|
[
|
||||||
// 'text' => 'all',
|
'text' => $page + 1,
|
||||||
// 'callback_data' => "/menu wg -1",
|
'callback_data' => "/menu wg $page",
|
||||||
// ],
|
],
|
||||||
[
|
[
|
||||||
'text' => '>>',
|
'text' => '>>',
|
||||||
'callback_data' => "/menu wg " . ($page < $all - 1 ? $page + 1 : 0),
|
'callback_data' => "/menu wg " . ($page < $all - 1 ? $page + 1 : 0),
|
||||||
@@ -4137,10 +4168,14 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => '<<',
|
'text' => '<<',
|
||||||
'callback_data' => "/$menu " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
'callback_data' => "/$menu " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $page + 1,
|
||||||
|
'callback_data' => "/$menu $page",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'text' => '>>',
|
'text' => '>>',
|
||||||
'callback_data' => "/$menu " . ($page < $all - 1 ? $page + 1 : 0),
|
'callback_data' => "/$menu " . ($page < $all - 1 ? $page + 1 : 0),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$data[] = [
|
$data[] = [
|
||||||
@@ -4276,6 +4311,43 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->menu('wg', 0);
|
$this->menu('wg', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function alignColumns(array $columns): string
|
||||||
|
{
|
||||||
|
// Находим максимальную длину для каждого столбца
|
||||||
|
$columnLengths = [];
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
$maxLength = 0;
|
||||||
|
foreach ($column as $cell) {
|
||||||
|
$len = mb_strlen($cell, 'UTF-8');
|
||||||
|
$maxLength = max($maxLength, $len);
|
||||||
|
}
|
||||||
|
$columnLengths[] = $maxLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Получаем количество строк из первого столбца
|
||||||
|
$rowCount = count($columns[0]);
|
||||||
|
$columnCount = count($columns);
|
||||||
|
|
||||||
|
// Формируем строки с выравниванием
|
||||||
|
$result = [];
|
||||||
|
for ($row = 0; $row < $rowCount; $row++) {
|
||||||
|
$line = '';
|
||||||
|
for ($col = 0; $col < $columnCount; $col++) {
|
||||||
|
$cell = $columns[$col][$row];
|
||||||
|
$padding = str_repeat(' ', $columnLengths[$col] - mb_strlen($cell, 'UTF-8'));
|
||||||
|
$line .= $cell . $padding;
|
||||||
|
|
||||||
|
// Добавляем разделитель между столбцами, кроме последнего
|
||||||
|
if ($col < $columnCount - 1) {
|
||||||
|
$line .= ' '; // Два пробела между столбцами
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result[] = $line;
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode("\n", $result);
|
||||||
|
}
|
||||||
|
|
||||||
public function menu($type = false, $arg = false, $return = false)
|
public function menu($type = false, $arg = false, $return = false)
|
||||||
{
|
{
|
||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
@@ -4296,26 +4368,70 @@ DNS-over-HTTPS with IP:
|
|||||||
$f = '/docker/compose';
|
$f = '/docker/compose';
|
||||||
$c = yaml_parse_file($f)['services'];
|
$c = yaml_parse_file($f)['services'];
|
||||||
$main[] = 'v' . getenv('VER') . " $branch" . ($update ? ' (have updates)' : '');
|
$main[] = 'v' . getenv('VER') . " $branch" . ($update ? ' (have updates)' : '');
|
||||||
$main[] = '';
|
|
||||||
$main[] = $cron;
|
|
||||||
$main[] = $this->i18n($backup ? 'on' : 'off') . ' autobackup' . ($backup ? " $backup" : '');
|
|
||||||
$main[] = $this->i18n($conf['autoupdate'] ? 'on' : 'off') . ' autoupdate';
|
|
||||||
$main[] = $this->i18n($conf['autoscan'] ? 'on' : 'off') . ' autoscan';
|
|
||||||
$main[] = $this->i18n($conf['autodeny'] ? 'on' : 'off') . ' autoblock' . ($conf['deny'] ? ': ' . count($conf['deny']) : '');
|
|
||||||
$main[] = '';
|
|
||||||
$main[] = $this->i18n($c['wg'] ? 'on' : 'off') . ' ' . getenv('WGPORT') . ' Wireguard';
|
|
||||||
$main[] = $this->i18n($c['wg1'] ? 'on' : 'off') . ' ' . getenv('WG1PORT') . ' Wireguard 1';
|
|
||||||
$main[] = $this->i18n($c['tg'] ? 'on' : 'off') . ' ' . getenv('TGPORT') . ' MTProto';
|
|
||||||
$main[] = $this->i18n($c['ad'] ? 'on' : 'off') . ' 853 AdguardHome DoT';
|
|
||||||
$main[] = $this->i18n($c['ss'] ? 'on' : 'off') . ' 8388 Shadowsocks';
|
|
||||||
if (!empty($conf['domain'])) {
|
if (!empty($conf['domain'])) {
|
||||||
$main[] = '';
|
$main[] = '';
|
||||||
$oc = $this->getHashSubdomain('oc');
|
$oc = $this->getHashSubdomain('oc');
|
||||||
$np = $this->getHashSubdomain('np');
|
$np = $this->getHashSubdomain('np');
|
||||||
$main[] = $conf['domain'] ? "Domains:\n{$conf['domain']}\n$np.{$conf['domain']} (for naiveproxy)\n$oc.{$conf['domain']} (for openconnect)" . ($conf['adguardkey'] ? "\n{$conf['adguardkey']}.{$conf['domain']} (for adguard DoT)" : '') : $this->i18n('domain explain');
|
if (!empty($conf['domain'])) {
|
||||||
$ssl = $this->expireCert();
|
$ssl_expiry = $this->expireCert();
|
||||||
$main[] = $conf['domain'] ? "\nSSL: " . ($ssl ? date('Y-m-d H:i:s', $this->expireCert()) . "\n" . $this->domainsCert() : 'none') : '';
|
$certs = $this->domainsCert() ?: [];
|
||||||
|
|
||||||
|
$main[] = "<blockquote>";
|
||||||
|
$main[] = "Domains:";
|
||||||
|
$main[] = $conf['domain'] . (in_array($conf['domain'], $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '');
|
||||||
|
$main[] = 'naive ' . "$np.{$conf['domain']}" . (in_array("$np.{$conf['domain']}", $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '');
|
||||||
|
$main[] = 'openconnect ' . "$oc.{$conf['domain']}" . (in_array("$oc.{$conf['domain']}", $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '');
|
||||||
|
if (!empty($conf['adguardkey'])) {
|
||||||
|
$main[] = "{$conf['adguardkey']}.{$conf['domain']}" . (in_array("{$conf['adguardkey']}.{$conf['domain']}", $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '') . ' adguard DOT';;
|
||||||
|
}
|
||||||
|
$main[] = "</blockquote>";
|
||||||
|
} else {
|
||||||
|
$main[] = $this->i18n('domain explain');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$main[] = '';
|
||||||
|
|
||||||
|
$main[] = '<code>';
|
||||||
|
$main[] = $this->alignColumns([
|
||||||
|
[
|
||||||
|
$this->i18n($this->ssh($this->getPacConf()['amnezia'] ? 'awg' : 'wg', 'wg') ? 'on' : 'off') . ' ' . $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title'),
|
||||||
|
$this->i18n($this->ssh($this->getPacConf()['wg1_amnezia'] ? 'awg' : 'wg', 'wg1') ? 'on' : 'off') . ' ' . $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title'),
|
||||||
|
$this->i18n($this->ssh('pgrep xray', 'xr') ? 'on' : 'off') . ' ' . $this->i18n('xray'),
|
||||||
|
$this->i18n($this->ssh('pgrep caddy', 'np') ? 'on' : 'off') . ' ' . $this->i18n('naive'),
|
||||||
|
$this->i18n($this->ssh('pgrep ocserv', 'oc') ? 'on' : 'off') . ' ' . $this->i18n('ocserv'),
|
||||||
|
$this->i18n($this->ssh('pgrep mtproto-proxy', 'tg') ? 'on' : 'off') . ' ' . $this->i18n('mtproto'),
|
||||||
|
$this->i18n(exec("JSON=1 timeout 2 dnslookup google.com ad") ? 'on' : 'off') . ' ' . $this->i18n('ad_title'),
|
||||||
|
$this->i18n($this->ssh('pgrep ssserver', 'ss') ? 'on' : 'off') . ' ' . $this->i18n('sh_title'),
|
||||||
|
$this->i18n($this->warpStatus()) . ' ' . $this->i18n('warp'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
$this->i18n($c['wg'] ? 'on' : 'off') . ' ' . getenv('WGPORT'),
|
||||||
|
$this->i18n($c['wg1'] ? 'on' : 'off') . ' ' . getenv('WG1PORT'),
|
||||||
|
$this->i18n('on') . ' 443',
|
||||||
|
$this->i18n('on') . ' 443',
|
||||||
|
$this->i18n('on') . ' 443',
|
||||||
|
$this->i18n($c['tg'] ? 'on' : 'off') . ' ' . getenv('TGPORT'),
|
||||||
|
$this->i18n($c['ad'] ? 'on' : 'off') . ' 853',
|
||||||
|
$this->i18n($c['ss'] ? 'on' : 'off') . ' ' . getenv('SSPORT'),
|
||||||
|
'',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$main[] = '';
|
||||||
|
$main[] = $this->alignColumns([
|
||||||
|
[
|
||||||
|
$this->i18n($backup ? 'on' : 'off') . ' autobackup',
|
||||||
|
$this->i18n($conf['autoupdate'] ? 'on' : 'off') . ' autoupdate',
|
||||||
|
$this->i18n($conf['autoscan'] ? 'on' : 'off') . ' autoscan',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
$this->i18n($conf['autodeny'] ? 'on' : 'off') . ' autoblock' . ($conf['deny'] ? ': ' . count($conf['deny']) : ''),
|
||||||
|
$this->i18n($conf['reset_monthly'] ? 'on' : 'off') . ' autoreset',
|
||||||
|
$cron,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$main[] = '</code>';
|
||||||
|
|
||||||
}
|
}
|
||||||
$menu = [
|
$menu = [
|
||||||
'main' => [
|
'main' => [
|
||||||
@@ -4357,7 +4473,7 @@ DNS-over-HTTPS with IP:
|
|||||||
'callback_data' => "/menu adguard",
|
'callback_data' => "/menu adguard",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('warp') . ': ' . $this->warpStatus(),
|
'text' => $this->i18n('warp'),
|
||||||
'callback_data' => "/warp",
|
'callback_data' => "/warp",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -4459,6 +4575,14 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->ipMenu();
|
$this->ipMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function switchMonthlyStats()
|
||||||
|
{
|
||||||
|
$c = $this->getPacConf();
|
||||||
|
$c['reset_monthly'] = $c['reset_monthly'] ? 0 : 1;
|
||||||
|
$this->setPacConf($c);
|
||||||
|
$this->xray();
|
||||||
|
}
|
||||||
|
|
||||||
public function switchIpLimit($limit)
|
public function switchIpLimit($limit)
|
||||||
{
|
{
|
||||||
$limit = explode(':', $limit);
|
$limit = explode(':', $limit);
|
||||||
@@ -4679,10 +4803,14 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => '<<',
|
'text' => '<<',
|
||||||
'callback_data' => "/analysisIp " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
'callback_data' => "/analysisIp " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $page + 1,
|
||||||
|
'callback_data' => "/analysisIp $page",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'text' => '>>',
|
'text' => '>>',
|
||||||
'callback_data' => "/analysisIp " . ($page < $all - 1 ? $page + 1 : 0),
|
'callback_data' => "/analysisIp " . ($page < $all - 1 ? $page + 1 : 0),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4888,10 +5016,14 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => '<<',
|
'text' => '<<',
|
||||||
'callback_data' => "/denyList " . ($page - 1 >= 0 ? $page - 1 : $all - 1) . ($white ? " 1" : ' 0'),
|
'callback_data' => "/denyList " . ($page - 1 >= 0 ? $page - 1 : $all - 1) . ($white ? " 1" : ' 0'),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $page + 1,
|
||||||
|
'callback_data' => "/denyList $page" . ($white ? " 1" : ' 0'),
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'text' => '>>',
|
'text' => '>>',
|
||||||
'callback_data' => "/denyList " . ($page < $all - 1 ? $page + 1 : 0) . ($white ? " 1" : ' 0'),
|
'callback_data' => "/denyList " . ($page < $all - 1 ? $page + 1 : 0) . ($white ? " 1" : ' 0'),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$data[] = [
|
$data[] = [
|
||||||
@@ -5345,8 +5477,16 @@ DNS-over-HTTPS with IP:
|
|||||||
$p = $this->getPacConf();
|
$p = $this->getPacConf();
|
||||||
$users = array_map(fn ($e) => trim($e), explode(',', $users));
|
$users = array_map(fn ($e) => trim($e), explode(',', $users));
|
||||||
$users = array_map(fn ($e) => explode(':', $e), $users);
|
$users = array_map(fn ($e) => explode(':', $e), $users);
|
||||||
|
foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) {
|
||||||
|
$uuids[] = $v['id'];
|
||||||
|
$emails[] = $v['email'];
|
||||||
|
}
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$uuid = $user[1] ?: trim($this->ssh('xray uuid', 'xr'));
|
$uuid = $user[1] ?: trim($this->ssh('xray uuid', 'xr'));
|
||||||
|
if (in_array($uuid, $uuids ?: []) || in_array($user[0], $emails ?: [])) {
|
||||||
|
$this->send($this->input['chat'], "user {$user[0]} already exists");
|
||||||
|
return $this->xray();
|
||||||
|
}
|
||||||
$c['inbounds'][0]['settings']['clients'][] = $p['transport'] != 'Reality' ? [
|
$c['inbounds'][0]['settings']['clients'][] = $p['transport'] != 'Reality' ? [
|
||||||
'id' => $uuid,
|
'id' => $uuid,
|
||||||
'email' => $user[0],
|
'email' => $user[0],
|
||||||
@@ -5376,20 +5516,22 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->send($this->input['chat'], 'wrong format');
|
$this->send($this->input['chat'], 'wrong format');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
|
||||||
$this->switchXr($i, 1);
|
|
||||||
$c = $this->getXray();
|
|
||||||
}
|
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['time'] = $time;
|
$c['inbounds'][0]['settings']['clients'][$i]['time'] = $time;
|
||||||
}
|
}
|
||||||
file_put_contents('/config/xray.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
$this->restartXray($c, 1);
|
||||||
$this->userXr($i);
|
if (!empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
||||||
|
$this->switchXr($i, 0, 1);
|
||||||
|
} else {
|
||||||
|
$this->userXr($i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchXr($i, $nm = 0)
|
public function switchXr($i, $nm = 0, $time = false)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
|
if (empty($time)) {
|
||||||
|
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
|
||||||
|
}
|
||||||
if (empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
if (empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['off'] = $c['inbounds'][0]['settings']['clients'][$i]['id'];
|
$c['inbounds'][0]['settings']['clients'][$i]['off'] = $c['inbounds'][0]['settings']['clients'][$i]['id'];
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['id'] = trim($this->ssh('xray uuid', 'xr'));
|
$c['inbounds'][0]['settings']['clients'][$i]['id'] = trim($this->ssh('xray uuid', 'xr'));
|
||||||
@@ -5430,11 +5572,13 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->userXr($i);
|
$this->userXr($i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetXrStats()
|
public function resetXrStats($nomenu = false)
|
||||||
{
|
{
|
||||||
$this->restartXray($this->getXray());
|
$this->restartXray($this->getXray());
|
||||||
$this->setXrayStats([]);
|
$this->setXrayStats([]);
|
||||||
$this->xray();
|
if (empty($nomenu)) {
|
||||||
|
$this->xray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listXr($i)
|
public function listXr($i)
|
||||||
@@ -5746,6 +5890,10 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => $this->i18n('reset stats') . ": ↓$td ↑$tu",
|
'text' => $this->i18n('reset stats') . ": ↓$td ↑$tu",
|
||||||
'callback_data' => '/resetXrStats',
|
'callback_data' => '/resetXrStats',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('reset monthly') . ": " . $this->i18n($this->getPacConf()['reset_monthly'] ? 'on' : 'off'),
|
||||||
|
'callback_data' => '/switchMonthlyStats',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
@@ -5840,10 +5988,14 @@ DNS-over-HTTPS with IP:
|
|||||||
'text' => '<<',
|
'text' => '<<',
|
||||||
'callback_data' => "/xray " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
'callback_data' => "/xray " . ($page - 1 >= 0 ? $page - 1 : $all - 1),
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $page + 1,
|
||||||
|
'callback_data' => "/xray $page",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'text' => '>>',
|
'text' => '>>',
|
||||||
'callback_data' => "/xray " . ($page < $all - 1 ? $page + 1 : 0),
|
'callback_data' => "/xray " . ($page < $all - 1 ? $page + 1 : 0),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$data[] = [
|
$data[] = [
|
||||||
@@ -6360,7 +6512,7 @@ DNS-over-HTTPS with IP:
|
|||||||
header("Location: hiddify://install-config/?url=$si");
|
header("Location: hiddify://install-config/?url=$si");
|
||||||
exit;
|
exit;
|
||||||
case 'c':
|
case 'c':
|
||||||
header("Location: clash://install-config/?url=$cl&name=$email");
|
header("Location: clash://install-config/?url=$cl&overwrite=no&name=$email");
|
||||||
exit;
|
exit;
|
||||||
case 'w':
|
case 'w':
|
||||||
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
||||||
@@ -7086,7 +7238,7 @@ DNS-over-HTTPS with IP:
|
|||||||
if (empty($domains)) {
|
if (empty($domains)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return implode("\n", array_map(fn($e) => trim($e), explode(',', str_replace('DNS:', '', $domains))));
|
return array_map(fn($e) => trim($e), explode(',', str_replace('DNS:', '', $domains)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatebot()
|
public function updatebot()
|
||||||
@@ -7156,17 +7308,24 @@ DNS-over-HTTPS with IP:
|
|||||||
public function configMenu()
|
public function configMenu()
|
||||||
{
|
{
|
||||||
$conf = $this->getPacConf();
|
$conf = $this->getPacConf();
|
||||||
if (!empty($conf['subdomain'])) {
|
|
||||||
$custom = "\ncustom:\n";
|
|
||||||
foreach ($conf['subdomain'] as $v) {
|
|
||||||
$custom .= "$v\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$oc = $this->getHashSubdomain('oc');
|
$oc = $this->getHashSubdomain('oc');
|
||||||
$np = $this->getHashSubdomain('np');
|
$np = $this->getHashSubdomain('np');
|
||||||
$text[] = $conf['domain'] ? "Domains:\n{$conf['domain']}\n$np.{$conf['domain']} (for naiveproxy)\n$oc.{$conf['domain']} (for openconnect)" . ($conf['adguardkey'] ? "\n{$conf['adguardkey']}.{$conf['domain']} (for adguard DoT)" : '') : $this->i18n('domain explain');
|
if (!empty($conf['domain'])) {
|
||||||
$ssl = $this->expireCert();
|
$ssl_expiry = $this->expireCert();
|
||||||
$text[] = $conf['domain'] ? "\nSSL: " . ($ssl ? date('Y-m-d H:i:s', $this->expireCert()) . "\n" . $this->domainsCert() : 'none') : '';
|
$certs = $this->domainsCert() ?: [];
|
||||||
|
|
||||||
|
$text[] = "<blockquote>";
|
||||||
|
$text[] = "Domains:";
|
||||||
|
$text[] = $conf['domain'] . (in_array($conf['domain'], $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '');
|
||||||
|
$text[] = 'naive ' . "$np.{$conf['domain']}" . (in_array("$np.{$conf['domain']}", $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '');
|
||||||
|
$text[] = 'openconnect ' . "$oc.{$conf['domain']}" . (in_array("$oc.{$conf['domain']}", $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '');
|
||||||
|
if (!empty($conf['adguardkey'])) {
|
||||||
|
$text[] = "{$conf['adguardkey']}.{$conf['domain']}" . (in_array("{$conf['adguardkey']}.{$conf['domain']}", $certs) ? ' (ssl: ' . date('Y-m-d H:i:s', $ssl_expiry) . ')' : '') . ' adguard DOT';;
|
||||||
|
}
|
||||||
|
$text[] = "</blockquote>";
|
||||||
|
} else {
|
||||||
|
$text[] = $this->i18n('domain explain');
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
[
|
[
|
||||||
@@ -8087,8 +8246,9 @@ DNS-over-HTTPS with IP:
|
|||||||
}
|
}
|
||||||
echo "$ip\n";
|
echo "$ip\n";
|
||||||
var_dump($r = $this->request('setWebhook', [
|
var_dump($r = $this->request('setWebhook', [
|
||||||
'url' => "https://$ip/tlgrm?k={$this->key}",
|
'url' => "https://$ip/tlgrm?k={$this->key}",
|
||||||
'certificate' => curl_file_create('/certs/self_public'),
|
'certificate' => curl_file_create('/certs/self_public'),
|
||||||
|
'allowed_updates' => json_encode(['*']),
|
||||||
]));
|
]));
|
||||||
if (!empty($r['result']) && $r['result'] == true) {
|
if (!empty($r['result']) && $r['result'] == true) {
|
||||||
file_put_contents('/start', 1);
|
file_put_contents('/start', 1);
|
||||||
|
|||||||
+11
-3
@@ -42,10 +42,18 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
php:
|
php:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
ng:
|
||||||
|
condition: service_started
|
||||||
ad:
|
ad:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
ss:
|
ss:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
|
xr:
|
||||||
|
condition: service_started
|
||||||
|
oc:
|
||||||
|
condition: service_started
|
||||||
|
np:
|
||||||
|
condition: service_started
|
||||||
env_file:
|
env_file:
|
||||||
- path: ./.env
|
- path: ./.env
|
||||||
required: true # default
|
required: true # default
|
||||||
@@ -79,9 +87,6 @@ services:
|
|||||||
- 80:80
|
- 80:80
|
||||||
hostname: nginx
|
hostname: nginx
|
||||||
container_name: nginx-${VER}
|
container_name: nginx-${VER}
|
||||||
depends_on:
|
|
||||||
up:
|
|
||||||
condition: service_started
|
|
||||||
env_file:
|
env_file:
|
||||||
- path: ./.env
|
- path: ./.env
|
||||||
required: true # default
|
required: true # default
|
||||||
@@ -95,6 +100,9 @@ services:
|
|||||||
xray:
|
xray:
|
||||||
ipv4_address: 10.10.1.2
|
ipv4_address: 10.10.1.2
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
depends_on:
|
||||||
|
php:
|
||||||
|
condition: service_healthy
|
||||||
php:
|
php:
|
||||||
image: mercurykd/vpnbot-php:1.7
|
image: mercurykd/vpnbot-php:1.7
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
b:
|
b:
|
||||||
docker compose build
|
docker compose build
|
||||||
u: # запуск контейнеров
|
u: # запуск контейнеров
|
||||||
$(eval IP := $(shell curl -s -t 1 2ip.io || curl -s -t 1 ipinfo.io/ip || curl -s -t 1 ifconfig.me))
|
$(eval IP := $(shell hostname -I | awk '{print $$1}'))
|
||||||
bash ./update/update.sh &
|
bash ./update/update.sh &
|
||||||
touch ./override.env ./docker-compose.override.yml
|
touch ./override.env ./docker-compose.override.yml
|
||||||
IP=$(IP) VER=$(shell git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
IP=$(IP) VER=$(shell git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ do
|
|||||||
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "launching the bot"/')"
|
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "launching the bot"/')"
|
||||||
> $pwd/update/key
|
> $pwd/update/key
|
||||||
> $pwd/update/curl
|
> $pwd/update/curl
|
||||||
IP=$(curl -s -t 1 2ip.io || curl -s -t 1 ipinfo.io/ip || curl -s -t 1 ifconfig.me) VER=$(git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
IP=$(hostname -I | awk '{print $1}') VER=$(git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
|
||||||
bash $pwd/update/update.sh &
|
bash $pwd/update/update.sh &
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
18.06.2025 v2.22
|
||||||
|
- фикс определения айпи при запуске
|
||||||
|
11.06.2025 v2.21
|
||||||
|
- пагинация в списках
|
||||||
|
20.05.2025 v2.20
|
||||||
|
- коррекция главного меню
|
||||||
|
- vless: опция обнуления статы ежемесячно
|
||||||
|
17.05.2025 v2.19
|
||||||
|
- фикс падения vless при одинаковом имени пользователей
|
||||||
|
- фикс падения vless при установке таймера для выключенного пользователя
|
||||||
|
- подсветка в меню работы процесса контейнера
|
||||||
|
- overwrite=no для импорта клеш подписки (legiz)
|
||||||
18.04.2025 v2.18
|
18.04.2025 v2.18
|
||||||
- фикс отсутствия ssl при первом старте
|
- фикс отсутствия ssl при первом старте
|
||||||
- iplimit уведомляет без отключения пользователя
|
- iplimit уведомляет без отключения пользователя
|
||||||
|
|||||||
Reference in New Issue
Block a user