feat: add v2node support

This commit is contained in:
xboard
2025-11-22 20:33:38 +08:00
parent 8d0e33ba23
commit 95e8e7bca7
5 changed files with 50 additions and 9 deletions

View File

@@ -14,10 +14,11 @@ class Server
public function handle(Request $request, Closure $next, ?string $nodeType = null)
{
$this->validateRequest($request);
$nodeType = $request->input('node_type', $nodeType);
$normalizedNodeType = ServerModel::normalizeType($nodeType);
$serverInfo = ServerService::getServer(
$request->input('node_id'),
$request->input('node_type') ?? $nodeType
$normalizedNodeType
);
if (!$serverInfo) {
throw new ApiException('Server does not exist');
@@ -43,6 +44,9 @@ class Server
'node_type' => [
'nullable',
function ($attribute, $value, $fail) use ($request) {
if ($value === "v2node") {
$value = null;
}
if (!ServerModel::isValidType($value)) {
$fail("Invalid node type specified");
return;