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

@@ -1,18 +1,8 @@
import { ValidationResult } from './types';
// TODO refactor current validation and add tests
export function validateOutboundJson(value: string): ValidationResult {
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 {