refactor: change vless validation logic

This commit is contained in:
divocat
2025-10-05 18:13:19 +03:00
parent c5e19a0f2d
commit 341f260fcf
6 changed files with 418 additions and 274 deletions

View File

@@ -9,6 +9,13 @@ export function validateTrojanUrl(url: string): ValidationResult {
};
}
if (!url || /\s/.test(url)) {
return {
valid: false,
message: 'Invalid Trojan URL: must not contain spaces',
};
}
try {
const parsedUrl = new URL(url);