feat: actualize json outbound validation

This commit is contained in:
divocat
2025-10-26 14:46:39 +02:00
parent 288b8d4cc2
commit fb54d62a7f
7 changed files with 29 additions and 62 deletions

View File

@@ -323,15 +323,7 @@ function validateVlessUrl(url) {
// src/validators/validateOutboundJson.ts
function validateOutboundJson(value) {
try {
const parsed = JSON.parse(value);
if (!parsed.type || !parsed.server || !parsed.server_port) {
return {
valid: false,
message: _(
'Outbound JSON must contain at least "type", "server" and "server_port" fields'
)
};
}
JSON.parse(value);
return { valid: true, message: _("Valid") };
} catch {
return { valid: false, message: _("Invalid JSON format") };