diff options
| author | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2019-02-04 22:30:24 +0900 |
|---|---|---|
| committer | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2019-02-04 22:30:24 +0900 |
| commit | 9595a56346166b466903b2ed3f4dcfb3c3d5e514 (patch) | |
| tree | a9d55c0e91aeae7cb380dd0c7f0b8aa8535ea188 /src | |
| parent | Fix bug (diff) | |
| download | sharkey-9595a56346166b466903b2ed3f4dcfb3c3d5e514.tar.gz sharkey-9595a56346166b466903b2ed3f4dcfb3c3d5e514.tar.bz2 sharkey-9595a56346166b466903b2ed3f4dcfb3c3d5e514.zip | |
Revert "Update load.ts"
This reverts commit cf9e8ed39ec2acd098ba3587f0957a6afa641a74, commit 67792fcb5e866cfad6fc6788b8555526658099fc, and commit c7e8c27ce6652b64a55d7d5ea85c66b4a1cbc06c.
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/load.ts | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/config/load.ts b/src/config/load.ts index c0b966d531..fc3e699199 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -47,22 +47,14 @@ export default function load() { return Object.assign(config, mixin); } -function tryCreateUrl(url: string) { +function validateUrl(url: string) { try { return new URL(url); } catch (e) { - throw `url="${url}" is not a valid URL.`; + throw `url="${url}" is not a valid URL`; } } -function validateUrl(url: string) { - const result = tryCreateUrl(url); - if (result.pathname.replace('/', '').length) throw `url="${url}" is not a valid URL, has a pathname.`; - if (!url.includes(result.host)) throw `url="${url}" is not a valid URL, has an invalid hostname.`; - if (!/^https?:$/.test(result.protocol)) throw `url="${url}" is not a valid URL, has an invalid protocol.`; - return result; -} - function normalizeUrl(url: string) { return url.endsWith('/') ? url.substr(0, url.length - 1) : url; } |