Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fb1931c2d | |||
| 6a31985863 | |||
| f4a9e63793 | |||
| 581e3a9bd1 | |||
| 8491ee9f51 | |||
| 49cefc3231 |
+51
-3
@@ -1477,14 +1477,19 @@ class Bot
|
||||
$cl = $client;
|
||||
$client = $this->readClients()[$client];
|
||||
$name = $this->getName($client['interface']);
|
||||
$code = $this->createConfig($client);
|
||||
if ($this->getWGType() == 'awg') {
|
||||
$sl = $this->getAmneziaShortLink($client);
|
||||
$code = preg_replace('/^vpn:\/\//', '', $sl);
|
||||
} else {
|
||||
$code = $this->createConfig($client);
|
||||
}
|
||||
$qr = preg_replace(['~\s+~', '~\(~', '~\)~'], ['_'], $name);
|
||||
$qr_file = __DIR__ . "/qr/$qr.png";
|
||||
exec("qrencode -t png -o $qr_file '$code'");
|
||||
$r = $this->sendPhoto(
|
||||
$this->input['chat'],
|
||||
curl_file_create($qr_file),
|
||||
$name,
|
||||
($this->getWGType() == 'awg') ? "$name for AmneziaVPN" : $name
|
||||
);
|
||||
unlink($qr_file);
|
||||
if ($this->getPacConf()['blinkmenu']) {
|
||||
@@ -3366,6 +3371,49 @@ DNS-over-HTTPS with IP:
|
||||
return "vless://{$c['inbounds'][0]['settings']['clients'][$i]['id']}@$domain:443?security=reality&sni={$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0]}&fp=chrome&pbk={$pac['xray']}&sid={$c['inbounds'][0]['streamSettings']['realitySettings']['shortIds'][0]}&type=tcp&flow=xtls-rprx-vision#vpnbot";
|
||||
}
|
||||
|
||||
public function dockerApi($url, $method = 'GET', $data = [])
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_CUSTOMREQUEST => $method,
|
||||
CURLOPT_POSTFIELDS => !empty($data) ? json_encode($data) : null,
|
||||
CURLOPT_URL => "http://localhost$url",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_UNIX_SOCKET_PATH => '/var/run/docker.sock'
|
||||
]);
|
||||
$r = json_decode(curl_exec($ch), true);
|
||||
curl_close($ch);
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function cleanDocker()
|
||||
{
|
||||
$r = $this->dockerApi('/images/json');
|
||||
foreach ($r as $v) {
|
||||
if (!empty($v['RepoTags'])) {
|
||||
foreach ($v['RepoTags'] as $j) {
|
||||
if (preg_match('~^mercurykd/vpnbot~', $j)) {
|
||||
$i[] = $v['Id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$r = $this->dockerApi('/containers/json?all=1');
|
||||
foreach ($r as $v) {
|
||||
if (preg_match('~^mercurykd/vpnbot~', $v['Image'])) {
|
||||
$c[] = $v['ImageID'];
|
||||
}
|
||||
}
|
||||
if (!empty($d = array_diff($i, $c))) {
|
||||
foreach ($d as $v) {
|
||||
$this->dockerApi("/images/$v", 'DELETE');
|
||||
}
|
||||
}
|
||||
$this->dockerApi('/images/prune', 'POST', ['dangling' => true]);
|
||||
$this->dockerApi('/build/prune', 'POST');
|
||||
}
|
||||
|
||||
public function naiveMenu()
|
||||
{
|
||||
$pac = $this->getPacConf();
|
||||
@@ -3699,7 +3747,7 @@ DNS-over-HTTPS with IP:
|
||||
'web_app' => ['url' => "https://$domain/pac?h=$hash&t=te&ty=$type"],
|
||||
],
|
||||
[
|
||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][$pac["default{$type}template"]]) ? 'off' : 'on'),
|
||||
'text' => $this->i18n($pac["default{$type}template"] && !empty($pac["{$type}templates"][base64_decode($pac["default{$type}template"])]) ? 'off' : 'on'),
|
||||
'callback_data' => "/defaultTemplate $type",
|
||||
],
|
||||
];
|
||||
|
||||
@@ -40,3 +40,4 @@ file_put_contents('/update/message', '');
|
||||
file_put_contents('/update/reload_message', '');
|
||||
$bot->restartTG();
|
||||
$bot->sslip();
|
||||
$bot->cleanDocker();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div style="position:absolute;top:0;right:0;width:35%;text-align:center;background-color: #17212b;">
|
||||
<img src="toncoin.png" width="100%" alt="">
|
||||
<a href="javascript:;" id="copy" style="color:white;text-decoration:none" data-id="UQCDDkaX3fCAFBek28Hx4TfvDDRqeizOW74blVMVAM4_m4OW">copy</a>
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=mercurykd&repo=vpnbot&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
|
||||
<!-- <iframe src="https://ghbtns.com/github-btn.html?user=mercurykd&repo=vpnbot&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe> -->
|
||||
</div>
|
||||
<a style="background-color: #8B3FFD;height: 46px;display:inline-block;padding:0 54px;color: white;border-radius: 12px;text-decoration: none;font-size: 20px;line-height: 46px;font-family: arial;" href="https://yoomoney.ru/to/410011827900450">
|
||||
<svg style="width: 24px;fill: white;position: relative;top: 4px;" class="qa-fundraise-button-logo mui-m0okdh" viewBox="0 0 16 16"><path d="M4.638 8.5a5.67 5.67 0 015.681-5.68A5.693 5.693 0 0116 8.5a5.693 5.693 0 01-5.68 5.682A5.67 5.67 0 014.637 8.5zm3.56 0c0 1.151.97 2.122 2.121 2.122 1.15 0 2.085-.97 2.121-2.121 0-1.15-.97-2.121-2.12-2.121-1.151 0-2.122.97-2.122 2.12zm-3.596 4.243v-8.27H0l2.589 8.27h2.013z" clip-rule="evenodd"></path></svg>
|
||||
|
||||
+3
-1
@@ -116,6 +116,7 @@ services:
|
||||
- ./update:/update
|
||||
- ./.git:/.git
|
||||
- ./singbox_windows:/singbox
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
environment:
|
||||
IP: ${IP}
|
||||
VER: ${VER}
|
||||
@@ -142,7 +143,7 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
service:
|
||||
image: mercurykd/vpnbot-php:1.2
|
||||
image: mercurykd/vpnbot-php:1.5
|
||||
build:
|
||||
dockerfile: dockerfile/php.dockerfile
|
||||
args:
|
||||
@@ -157,6 +158,7 @@ services:
|
||||
- ./logs/:/logs/
|
||||
- ./update:/update
|
||||
- ./scripts/start_service.sh:/start_service.sh
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
environment:
|
||||
IP: ${IP}
|
||||
VER: ${VER}
|
||||
|
||||
@@ -9,7 +9,7 @@ d: # остановка контейнеров
|
||||
docker compose down --remove-orphans
|
||||
dv: # остановка контейнеров
|
||||
docker compose down -v
|
||||
r: d cleanf u cleanf
|
||||
r: d u
|
||||
ps: # список контейнеров
|
||||
docker compose ps
|
||||
l: # логи из контейнеров
|
||||
|
||||
Reference in New Issue
Block a user