[feature] Create/update/remove domain permission subscriptions

This commit is contained in:
tobi 2024-12-14 15:01:58 +01:00
commit a3743f8234
44 changed files with 4389 additions and 171 deletions

View file

@ -46,3 +46,22 @@ export function formDomainValidator(domain: string): string {
return "invalid domain";
}
export function urlValidator(urlStr: string): string {
if (urlStr.length === 0) {
return "";
}
let url: URL;
try {
url = new URL(urlStr);
} catch (e) {
return e.message;
}
if (url.protocol !== "http:" && url.protocol !== "https:") {
return `invalid protocol, must be http or https`;
}
return formDomainValidator(url.host);
}