From 0e2d961902b93c3a3fc483a505e7709df2f7b7c4 Mon Sep 17 00:00:00 2001 From: George Date: Sun, 29 Sep 2024 11:28:18 +0800 Subject: [PATCH 1/5] [fix]: Loon Hysteria2 node cannot get SNI --- app/Protocols/Loon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Protocols/Loon.php b/app/Protocols/Loon.php index 570a380..56290ea 100644 --- a/app/Protocols/Loon.php +++ b/app/Protocols/Loon.php @@ -151,7 +151,7 @@ class Loon $server['host'], $server['port'], $password, - $server['server_name'] ? "tls={$server['server_name']}" : "(null)" + $server['server_name'] ? "sni={$server['server_name']}" : "(null)" ]; if ($server['insecure']) $config[] = "skip-cert-verify=true"; $config[] = "download-bandwidth=" . ($user->speed_limit ? min($server['down_mbps'], $user->speed_limit) : $server['down_mbps']); From a7f42a645970ec9aec1637c3e29f3500801ab1de Mon Sep 17 00:00:00 2001 From: xboard Date: Mon, 7 Oct 2024 00:27:11 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=AF=86=E9=92=A5=E6=9C=AA=E6=A0=A1=E9=AA=8C=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Middleware/Server.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Middleware/Server.php b/app/Http/Middleware/Server.php index 6feef83..3dcb858 100644 --- a/app/Http/Middleware/Server.php +++ b/app/Http/Middleware/Server.php @@ -26,6 +26,7 @@ class Server $request->validate([ 'token' => [ "string", + "required", function ($attribute, $value, $fail) { if ($value !== admin_setting('server_token')) { $fail('The ' . $attribute . ' is invalid.'); @@ -34,10 +35,11 @@ class Server ], 'node_id' => 'required', 'node_type' => [ + 'required', 'nullable', 'regex:/^(?i)(hysteria|hysteria2|vless|trojan|vmess|v2ray|tuic|shadowsocks|shadowsocks-plugin)$/', function ($attribute, $value, $fail) use ($aliasTypes, $request) { - $request->merge([$attribute => strtolower(isset ($aliasTypes[$value]) ? $aliasTypes[$value] : $value)]); + $request->merge([$attribute => strtolower(isset($aliasTypes[$value]) ? $aliasTypes[$value] : $value)]); }, ] ], [ From 47b0646811f1c89da3057f65c1c762dd050ceced Mon Sep 17 00:00:00 2001 From: xboard Date: Mon, 7 Oct 2024 02:47:54 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dvless=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=9A=84tls=5Finsecure=E5=9C=A8meta=E4=B8=AD=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Protocols/ClashMeta.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Protocols/ClashMeta.php b/app/Protocols/ClashMeta.php index aff8982..7b9fa1c 100644 --- a/app/Protocols/ClashMeta.php +++ b/app/Protocols/ClashMeta.php @@ -207,8 +207,8 @@ class ClashMeta $array['tls'] = true; if ($server['tls_settings']) { $tlsSettings = $server['tls_settings']; - if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) - $array['skip-cert-verify'] = ($tlsSettings['allowInsecure'] ? true : false); + if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure'])) + $array['skip-cert-verify'] = ($tlsSettings['allow_insecure'] ? true : false); if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) $array['servername'] = $tlsSettings['server_name']; } From af1f1e9fdf39af6355b2b1647fd49c12685de649 Mon Sep 17 00:00:00 2001 From: xboard Date: Mon, 7 Oct 2024 09:55:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B5=81=E9=87=8F?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=98=BE=E7=A4=BA=E6=89=80=E6=9C=89=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/V1/User/StatController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/V1/User/StatController.php b/app/Http/Controllers/V1/User/StatController.php index a7845d4..f93bab5 100644 --- a/app/Http/Controllers/V1/User/StatController.php +++ b/app/Http/Controllers/V1/User/StatController.php @@ -13,7 +13,7 @@ class StatController extends Controller { public function getTrafficLog(Request $request) { - $startDate = now()->startOfMonth(); + $startDate = now()->startOfMonth()->timestamp; $records = StatUser::query() ->where('user_id', $request->user['id']) ->where('record_at', '>=', $startDate) From f5746423bf496cac556b14c809f98f9f98be1bed Mon Sep 17 00:00:00 2001 From: Linux Date: Wed, 9 Oct 2024 22:55:26 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=BD=93=E6=97=A5=E6=B5=81?= =?UTF-8?q?=E9=87=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/StatisticalService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/StatisticalService.php b/app/Services/StatisticalService.php index 3ec016e..3a727f0 100644 --- a/app/Services/StatisticalService.php +++ b/app/Services/StatisticalService.php @@ -108,14 +108,14 @@ class StatisticalService /** * 获取指定用户的流量使用情况 */ - public function getStatUserByUserID($userId): array + public function getStatUserByUserID(int|string $userId): array { $stats = []; $statsUser = $this->redis->zrange($this->statUserKey, 0, -1, true); foreach ($statsUser as $member => $value) { list($rate, $uid, $type) = explode('_', $member); - if ($uid !== $userId) + if (intval($uid) !== intval($userId)) continue; $key = "{$rate}_{$uid}"; $stats[$key] = $stats[$key] ?? [