From 2eb81924e4acab226f26dc12afa54edeae7ee1d3 Mon Sep 17 00:00:00 2001 From: xboard Date: Mon, 15 Apr 2024 00:01:14 +0800 Subject: [PATCH] =?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=E5=8C=85=E5=90=AB=E7=89=B9=E6=AE=8A=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E6=97=B6=E6=A0=A1=E9=AA=8C=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/Server.php b/app/Http/Middleware/Server.php index 57d10ab..6feef83 100644 --- a/app/Http/Middleware/Server.php +++ b/app/Http/Middleware/Server.php @@ -24,7 +24,14 @@ class Server 'hysteria2' => 'hysteria' ]; $request->validate([ - 'token' => ['required', 'string', 'in:' . admin_setting('server_token')], + 'token' => [ + "string", + function ($attribute, $value, $fail) { + if ($value !== admin_setting('server_token')) { + $fail('The ' . $attribute . ' is invalid.'); + } + }, + ], 'node_id' => 'required', 'node_type' => [ 'nullable', @@ -34,7 +41,6 @@ class Server }, ] ], [ - 'token.in' => 'Token is error!', 'node_type.regex' => 'node_type is error!' ]); $nodeInfo = ServerService::getServer($request->input('node_id'), $request->input('node_type') ?? $node_type);