From 7df97c6ca13ccb9a578b457b8bbe37111bff8b42 Mon Sep 17 00:00:00 2001 From: mercury Date: Thu, 8 Aug 2024 12:43:55 +0400 Subject: [PATCH] update singbox --- app/bot.php | 31 +++++++++++++++++++------------ docker-compose.yml | 2 +- dockerfile/singbox.dockerfile | 10 +++++----- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/app/bot.php b/app/bot.php index 4a87d5c..e9ca808 100644 --- a/app/bot.php +++ b/app/bot.php @@ -517,14 +517,18 @@ class Bot { $c = $c ?: $this->getXray(); $p = $this->getPacConf(); - $cl = array_filter($p['xrusers'], fn ($e) => empty($e['off']) && (empty($e['time']) || $e['time'] >= time())); + if (!empty($p['xrusers'])) { + $cl = array_filter($p['xrusers'], fn ($e) => empty($e['off']) && (empty($e['time']) || $e['time'] >= time())); + } switch ($p['xtlsmode']) { case 'shadow': - foreach ($cl as $v) { - $t[] = [ - "name" => $v['name'], - "password" => $v['uuid'], - ]; + if (!empty($cl)) { + foreach ($cl as $v) { + $t[] = [ + "name" => $v['name'], + "password" => $v['uuid'], + ]; + } } $c['inbounds'] = [ [ @@ -564,12 +568,14 @@ class Bot break; default: - foreach ($cl as $v) { - $t[] = [ - "uuid" => $v['uuid'], - "flow" => 'xtls-rprx-vision', - "name" => $v['name'], - ]; + if (!empty($cl)) { + foreach ($cl as $v) { + $t[] = [ + "uuid" => $v['uuid'], + "flow" => 'xtls-rprx-vision', + "name" => $v['name'], + ]; + } } $c['inbounds'] = [ [ @@ -4012,6 +4018,7 @@ DNS-over-HTTPS with IP: $pac = $this->getPacConf(); if (!$this->ssh('pgrep sing-box', 'si') || empty($pac['xray']['private'])) { $this->generateSecretXray(); + $pac = $this->getPacConf(); } $text[] = "Menu -> " . $this->i18n('xray'); $text[] = "\nfake domain: {$pac['xray']['domain']}"; diff --git a/docker-compose.yml b/docker-compose.yml index 12cf9e5..24852ae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -391,7 +391,7 @@ services: ipv4_address: 10.10.0.8 logging: *default-logging si: - image: mercurykd/vpnbot-sb:1.1 + image: mercurykd/vpnbot-sb:1.2 build: dockerfile: dockerfile/singbox.dockerfile args: diff --git a/dockerfile/singbox.dockerfile b/dockerfile/singbox.dockerfile index d5de434..5cb78fa 100644 --- a/dockerfile/singbox.dockerfile +++ b/dockerfile/singbox.dockerfile @@ -2,8 +2,8 @@ ARG image FROM $image RUN apk add openssh openssl jq \ && mkdir /root/.ssh \ - && wget https://github.com/SagerNet/sing-box/releases/download/v1.8.13/sing-box-1.8.13-linux-amd64.tar.gz \ - && tar -xf sing-box-1.8.13-linux-amd64.tar.gz \ - && mv sing-box-1.8.13-linux-amd64/sing-box /usr/bin \ - && rm sing-box-1.8.13-linux-amd64.tar.gz \ - && rm -rf /sing-box-1.8.13-linux-amd64 + && wget https://github.com/SagerNet/sing-box/releases/download/v1.9.3/sing-box-1.9.3-linux-amd64.tar.gz \ + && tar -xf sing-box-1.9.3-linux-amd64.tar.gz \ + && mv sing-box-1.9.3-linux-amd64/sing-box /usr/bin \ + && rm sing-box-1.9.3-linux-amd64.tar.gz \ + && rm -rf /sing-box-1.9.3-linux-amd64