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

@@ -317,14 +317,14 @@ class Server extends Model
return "{$serverKey}:{$userKey}";
}
public static function normalizeType(string $type): string
public static function normalizeType(?string $type): string | null
{
return strtolower(self::TYPE_ALIASES[$type] ?? $type);
return $type ? strtolower(self::TYPE_ALIASES[$type] ?? $type) : null;
}
public static function isValidType(string $type): bool
public static function isValidType(?string $type): bool
{
return in_array(self::normalizeType($type), self::VALID_TYPES, true);
return $type ? in_array(self::normalizeType($type), self::VALID_TYPES, true) : true;
}
public function getAvailableStatusAttribute(): int