Compare commits

...

5 Commits

Author SHA1 Message Date
mercury e1902827ce singbox for windows as service 2024-04-13 19:20:54 +04:00
mercury 95fea3bb7b improve xtls user menu 2024-04-13 04:22:09 +04:00
mercury 80a9f9f32d github btns 2024-04-12 21:38:54 +04:00
mercury 7fc1105728 update readme 2024-04-12 17:05:48 +04:00
mercury d46679caf6 log upstream 2024-04-12 15:47:58 +04:00
16 changed files with 83 additions and 11 deletions
+23 -6
View File
@@ -3764,7 +3764,7 @@ DNS-over-HTTPS with IP:
);
}
public function userXr($i, $fs = 0, $fv = 0)
public function userXr($i, $fs = 0, $fv = 0, $a = 0)
{
$c = $this->getXray();
$pac = $this->getPacConf() ?: $this->ip;
@@ -3781,12 +3781,28 @@ DNS-over-HTTPS with IP:
if (!empty($fv)) {
return $fullv2ray;
}
if (!empty($a)) {
return "$scheme://{$domain}/pac?h=$hash&t=si&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}";
}
$text[] = "Menu -> " . $this->i18n('xray') . " -> {$c['inbounds'][0]['settings']['clients'][$i]['email']}\n";
$text[] = "<code>{$this->linkXray($i)}</code>\n";
$text[] = "v2ray: <a href='$v2ray'>$v2ray</a>\n";
$text[] = "sing-box: <a href='$sing'>$sing</a>";
$text[] = "v2ray import: <a href='$v2ray'>v2rayng://install-config</a>";
$text[] = "v2ray config: <code>$scheme://{$domain}/pac?h=$hash&t=s&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}</code>\n";
$text[] = "sing-box import (Android, IOS): <a href='$sing'>sing-box://import-remote-profile</a>";
$text[] = "sing-box windows: <a href='$scheme://{$domain}/pac?h=$hash&t=si&b=2&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}'>windows service</a>";
$text[] = "sing-box config: <code>$scheme://{$domain}/pac?h=$hash&t=si&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}</code>";
$data[] = [
[
'text' => 'v2ray',
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=s&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}"],
],
[
'text' => 'sing-box',
'web_app' => ['url' => "https://{$domain}/pac?h=$hash&t=si&s={$c['inbounds'][0]['settings']['clients'][$i]['id']}"],
],
];
$data[] = [
[
'text' => $c['inbounds'][0]['settings']['clients'][$i]['time'] ? "timer: " . $this->getTime($c['inbounds'][0]['settings']['clients'][$i]['time']) : $this->i18n('timer'),
@@ -3815,8 +3831,6 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('rename'),
'callback_data' => "/renameXrUser $i",
],
];
$data[] = [
[
'text' => $this->i18n('delete'),
'callback_data' => "/delxr $i",
@@ -3875,7 +3889,7 @@ DNS-over-HTTPS with IP:
echo json_encode($c);
}
public function singboxSubscription($key, $fs = 0)
public function singboxSubscription($key, $fs = 0, $a = 0)
{
$pac = $this->getPacConf();
$domain = $pac['domain'] ?: $this->ip;
@@ -3887,6 +3901,9 @@ DNS-over-HTTPS with IP:
if (!empty($fs)) {
return $this->userXr($k, 1);
}
if (!empty($a)) {
return $this->userXr($k, a: 1);
}
if (empty($v['off'])) {
$flag = false;
}
+22 -3
View File
@@ -49,9 +49,28 @@ if ($hash == substr(md5($c['key']), 0, 8)) {
require __DIR__ . '/i18n.php';
$bot = new Bot($c['key'], $i);
if (!empty($_GET['b'])) {
$fs = $bot->singboxSubscription($_GET['s'], 1);
header("Location: $fs");
exit;
switch ($_GET['b']) {
case '1':
$fs = $bot->singboxSubscription($_GET['s'], 1);
header("Location: $fs");
exit;
case '2':
$link = htmlspecialchars($bot->singboxSubscription($_GET['s'], a: 1), ENT_XML1, 'UTF-8');
file_put_contents('/singbox/winsw.xml', preg_replace('#~url~#', $link, file_get_contents('/singbox/winsw.xml')));
$zip = new ZipArchive();
$n = "singbox_$v.zip";
$zip->open($n, ZipArchive::CREATE | ZipArchive::OVERWRITE);
foreach (scandir('/singbox') as $k => $v) {
if (!empty(!in_array($v, ['.', '..']))) {
$zip->addFile("/singbox/$v", $v);
}
}
$zip->close();
header('Content-Disposition: attachment; filename="singbox.zip"');
echo file_get_contents('singbox.zip');
unlink($n);
break;
}
} else {
header('Content-Type: application/json');
echo $bot->singboxSubscription($_GET['s']);
+1
View File
@@ -16,6 +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>
</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>
+1 -1
View File
@@ -3,7 +3,7 @@ worker_processes auto;
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
error_log /logs/nginx_error;
error_log /logs/upstream_error;
pid /var/run/nginx.pid;
events {
+2 -1
View File
@@ -93,7 +93,7 @@ services:
ipv4_address: 10.10.1.2
logging: *default-logging
php:
image: mercurykd/vpnbot-php:1.3
image: mercurykd/vpnbot-php:1.4
build:
dockerfile: dockerfile/php.dockerfile
args:
@@ -115,6 +115,7 @@ services:
- ./.env:/mirror/.env
- ./update:/update
- ./.git:/.git
- ./singbox_windows:/singbox
environment:
IP: ${IP}
VER: ${VER}
+1
View File
@@ -4,6 +4,7 @@ RUN apk add --no-cache --update php81 \
php81-mbstring \
php81-session \
php81-phar \
php81-zip \
php81-curl \
php81-opcache \
php81-openssl \
+4
View File
@@ -6,6 +6,10 @@ telegram bot to manage servers (inside the bot)
- change secret
- qr/config
- change fake domain
- multiple users
- subscriptions with routing
- routing templates per user
- steal from yourself
<img src="https://github.com/mercurykd/vpnbot/assets/30900414/39bdf4e0-96a6-4257-b61e-30a14122e236" width="200">
### NaiveProxy
+2
View File
@@ -0,0 +1,2 @@
winsw.exe install
pause
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
winsw.exe start
+2
View File
@@ -0,0 +1,2 @@
winsw.exe status
pause
+1
View File
@@ -0,0 +1 @@
winsw.exe stop
+2
View File
@@ -0,0 +1,2 @@
winsw.exe uninstall
pause
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
<service>
<id>singbox</id>
<name>singbox</name>
<description>singbox</description>
<executable>%BASE%\sing-box.exe</executable>
<arguments>run -c %BASE%\config.json</arguments>
<logmode>rotate</logmode>
<onfailure action="restart" delay="10 sec" />
<onfailure action="restart" delay="20 sec" />
<onfailure action="restart" delay="30 sec" />
<onfailure action="none" />
<onexit action="restart" />
<onexit action="restart" />
<onexit action="restart" />
<onexit action="none" />
<configuration>
<download from="~url~" to="%BASE%\config.json" interval="1 minute" />
</configuration>
</service>
+2
View File
@@ -1,3 +1,5 @@
13.04.2024 v1.27
- архив сингбокса для windows, работает как служба
12.04.2024 v1.26
- имя клиента xtls подтягивается по подписке из бота
11.04.2024 v1.25