mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-03 03:02:26 -06:00
[feature] Create/update/remove domain permission subscriptions (#3623)
* [feature] Create/update/remove domain permission subscriptions * lint * envparsing * remove errant fmt.Println * create drafts, subs, exclude, from snapshot models * name etag column correctly * remove count column * lint
This commit is contained in:
parent
77f1e79532
commit
e9bb7ddd3a
50 changed files with 4630 additions and 172 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue