Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 54fa8d35b1 | |||
| ffe6bb4ba8 | |||
| 6be95533c4 | |||
| 8d13bee021 | |||
| db6a18f498 | |||
| 6954a16fa2 | |||
| ca7a9c955d | |||
| 852fbd55c6 | |||
| 3a8a843d8c | |||
| 90828d1117 | |||
| 37e8b96bcf | |||
| 306bc41813 | |||
| f6e5da382b |
@@ -26,3 +26,5 @@ docker-compose.override.yml
|
|||||||
backup.json
|
backup.json
|
||||||
app/webapp/override/
|
app/webapp/override/
|
||||||
.rest
|
.rest
|
||||||
|
|
||||||
|
subscription.php
|
||||||
+241
-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;
|
||||||
@@ -241,8 +244,7 @@ class Bot
|
|||||||
$this->addLinkDomain();
|
$this->addLinkDomain();
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/id$~', $this->input['message'], $m):
|
case preg_match('~^/id$~', $this->input['message'], $m):
|
||||||
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
|
$this->send($this->input['chat'], "your id: {$this->input['from']}\nchat id: {$this->input['chat']}", $this->input['message_id']);
|
||||||
$this->send($this->input['chat'], $this->input['chat'], $this->input['message_id']);
|
|
||||||
break;
|
break;
|
||||||
case preg_match('~^/adguardChBr$~', $this->input['callback'], $m):
|
case preg_match('~^/adguardChBr$~', $this->input['callback'], $m):
|
||||||
$this->adguardChBr();
|
$this->adguardChBr();
|
||||||
@@ -1337,6 +1339,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 +1447,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 +3421,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 +3664,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 +4167,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 +4310,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 +4367,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' => [
|
||||||
@@ -4323,47 +4438,47 @@ DNS-over-HTTPS with IP:
|
|||||||
'data' => [
|
'data' => [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title') . ' ' . $this->i18n($this->ssh($this->getPacConf()['amnezia'] ? 'awg' : 'wg', 'wg') ? 'on' : 'off'),
|
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title'),
|
||||||
'callback_data' => "/changeWG 0",
|
'callback_data' => "/changeWG 0",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title') . ' ' . $this->i18n($this->ssh($this->getPacConf()['wg1_amnezia'] ? 'awg' : 'wg', 'wg1') ? 'on' : 'off'),
|
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title'),
|
||||||
'callback_data' => "/changeWG 1",
|
'callback_data' => "/changeWG 1",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('xray') . ' ' . $this->i18n($this->ssh('pgrep xray', 'xr') ? 'on' : 'off'),
|
'text' => $this->i18n('xray'),
|
||||||
'callback_data' => "/xray",
|
'callback_data' => "/xray",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('naive') . ' ' . $this->i18n($this->ssh('pgrep caddy', 'np') ? 'on' : 'off'),
|
'text' => $this->i18n('naive'),
|
||||||
'callback_data' => "/menu naive",
|
'callback_data' => "/menu naive",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('ocserv') . ' ' . $this->i18n($this->ssh('pgrep ocserv', 'oc') ? 'on' : 'off'),
|
'text' => $this->i18n('ocserv'),
|
||||||
'callback_data' => "/menu oc",
|
'callback_data' => "/menu oc",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('mtproto') . ' ' . $this->i18n($this->ssh('pgrep mtproto-proxy', 'tg') ? 'on' : 'off'),
|
'text' => $this->i18n('mtproto'),
|
||||||
'callback_data' => "/mtproto",
|
'callback_data' => "/mtproto",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('ad_title') . ' ' . $this->i18n(exec("JSON=1 timeout 2 dnslookup google.com ad") ? 'on' : 'off'),
|
'text' => $this->i18n('ad_title'),
|
||||||
'callback_data' => "/menu adguard",
|
'callback_data' => "/menu adguard",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('warp') . ' ' . $this->i18n($this->warpStatus()),
|
'text' => $this->i18n('warp'),
|
||||||
'callback_data' => "/warp",
|
'callback_data' => "/warp",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('sh_title') . ' ' . $this->i18n($this->ssh('pgrep ssserver', 'ss') ? 'on' : 'off'),
|
'text' => $this->i18n('sh_title'),
|
||||||
'callback_data' => "/menu ss",
|
'callback_data' => "/menu ss",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -4459,6 +4574,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 +4802,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 +5015,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[] = [
|
||||||
@@ -5440,11 +5571,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)
|
||||||
@@ -5751,11 +5884,16 @@ DNS-over-HTTPS with IP:
|
|||||||
$st = $this->getXrayStats();
|
$st = $this->getXrayStats();
|
||||||
$td = $this->getBytes($st['global']['download'] + $st['session']['download']);
|
$td = $this->getBytes($st['global']['download'] + $st['session']['download']);
|
||||||
$tu = $this->getBytes($st['global']['upload'] + $st['session']['upload']);
|
$tu = $this->getBytes($st['global']['upload'] + $st['session']['upload']);
|
||||||
|
$text[] = "↓$td ↑$tu";
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('reset stats') . ": ↓$td ↑$tu",
|
'text' => $this->i18n('reset stats'),
|
||||||
'callback_data' => '/resetXrStats',
|
'callback_data' => '/resetXrStats',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'text' => $this->i18n('reset monthly') . ": " . $this->i18n($this->getPacConf()['reset_monthly'] ? 'on' : 'off'),
|
||||||
|
'callback_data' => '/switchMonthlyStats',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
$data[] = [
|
$data[] = [
|
||||||
[
|
[
|
||||||
@@ -5850,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[] = [
|
||||||
@@ -6174,6 +6316,9 @@ DNS-over-HTTPS with IP:
|
|||||||
$hash = $this->getHashBot();
|
$hash = $this->getHashBot();
|
||||||
|
|
||||||
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['email']}\n";
|
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['email']}\n";
|
||||||
|
if (file_exists(__DIR__ . '/subscription.php')) {
|
||||||
|
$text[] = "<a href='$scheme://{$domain}/pac$hash/sub?id={$c['id']}'>subscription</a>";
|
||||||
|
}
|
||||||
$text[] = "<pre><code>{$this->linkXray($i)}</code></pre>\n";
|
$text[] = "<pre><code>{$this->linkXray($i)}</code></pre>\n";
|
||||||
|
|
||||||
$text[] = "<a href='$scheme://{$domain}/pac$hash?t=s&r=v&s={$c['id']}#{$c['email']}'>import://v2rayng</a>";
|
$text[] = "<a href='$scheme://{$domain}/pac$hash?t=s&r=v&s={$c['id']}#{$c['email']}'>import://v2rayng</a>";
|
||||||
@@ -6301,6 +6446,47 @@ DNS-over-HTTPS with IP:
|
|||||||
return $c['domain'] ?: $this->ip;
|
return $c['domain'] ?: $this->ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sub()
|
||||||
|
{
|
||||||
|
$xr = $this->getXray();
|
||||||
|
$pac = $this->getPacConf();
|
||||||
|
$st = $this->getXrayStats();
|
||||||
|
$domain = $_GET['cdn'] ?: ($_SERVER['SERVER_NAME'] ?: $this->getDomain($pac['transport'] != 'Reality'));
|
||||||
|
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
|
||||||
|
$hash = $this->getHashBot();
|
||||||
|
$flag = true;
|
||||||
|
foreach ($xr['inbounds'][0]['settings']['clients'] as $k => $v) {
|
||||||
|
if ($v['id'] == $_GET['id']) {
|
||||||
|
if (empty($v['off'])) {
|
||||||
|
$flag = false;
|
||||||
|
}
|
||||||
|
$uid = $v['id'];
|
||||||
|
$email = $v['email'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$download = $this->getBytes($st['users'][$k]['global']['download'] + $st['users'][$k]['session']['download']);
|
||||||
|
$upload = $this->getBytes($st['users'][$k]['global']['upload'] + $st['users'][$k]['session']['upload']);
|
||||||
|
$singbox = "$scheme://{$domain}/pac$hash/" . base64_encode(serialize([
|
||||||
|
'h' => $hash,
|
||||||
|
't' => 'si',
|
||||||
|
's' => $uid,
|
||||||
|
]));
|
||||||
|
$xray = "$scheme://{$domain}/pac$hash/" . base64_encode(serialize([
|
||||||
|
'h' => $hash,
|
||||||
|
't' => 's',
|
||||||
|
's' => $uid,
|
||||||
|
]));
|
||||||
|
$clash = "$scheme://{$domain}/pac$hash/" . base64_encode(serialize([
|
||||||
|
'h' => $hash,
|
||||||
|
't' => 'cl',
|
||||||
|
's' => $uid,
|
||||||
|
]));
|
||||||
|
$vless = $this->linkXray($k);
|
||||||
|
$windows = "$scheme://{$domain}/pac$hash?t=si&r=w&s=$uid";
|
||||||
|
require __DIR__ . '/subscription.php';
|
||||||
|
}
|
||||||
|
|
||||||
public function subscription()
|
public function subscription()
|
||||||
{
|
{
|
||||||
switch ($_GET['t']) {
|
switch ($_GET['t']) {
|
||||||
@@ -7096,7 +7282,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()
|
||||||
@@ -7166,17 +7352,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 = [
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ switch (true) {
|
|||||||
echo "/adguard$hash/";
|
echo "/adguard$hash/";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case preg_match('~^' . preg_quote("/pac$hash/sub") . '~', $_SERVER['REQUEST_URI']) && file_exists(__DIR__ . '/subscription.php'):
|
||||||
|
$bot->sub();
|
||||||
|
exit;
|
||||||
|
|
||||||
// subs & pac
|
// subs & pac
|
||||||
case preg_match('~^' . preg_quote("/pac$hash") . '~', $_SERVER['REQUEST_URI']):
|
case preg_match('~^' . preg_quote("/pac$hash") . '~', $_SERVER['REQUEST_URI']):
|
||||||
if (!empty($t = unserialize(base64_decode(explode('/', $_SERVER['REQUEST_URI'])[2])))) { // fix sing-box import
|
if (!empty($t = unserialize(base64_decode(explode('/', $_SERVER['REQUEST_URI'])[2])))) { // fix sing-box import
|
||||||
|
|||||||
@@ -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,14 @@
|
|||||||
|
04.07.2025 v2.23
|
||||||
|
- фикс двойного /id
|
||||||
|
- фикс отображения статы vless на мобилке
|
||||||
|
- страница подписок app/subscription.php
|
||||||
|
18.06.2025 v2.22
|
||||||
|
- фикс определения айпи при запуске
|
||||||
|
11.06.2025 v2.21
|
||||||
|
- пагинация в списках
|
||||||
|
20.05.2025 v2.20
|
||||||
|
- коррекция главного меню
|
||||||
|
- vless: опция обнуления статы ежемесячно
|
||||||
17.05.2025 v2.19
|
17.05.2025 v2.19
|
||||||
- фикс падения vless при одинаковом имени пользователей
|
- фикс падения vless при одинаковом имени пользователей
|
||||||
- фикс падения vless при установке таймера для выключенного пользователя
|
- фикс падения vless при установке таймера для выключенного пользователя
|
||||||
|
|||||||
Reference in New Issue
Block a user