chore: better error message for API url without http protocol prefix
This commit is contained in:
parent
9b52b33180
commit
55b13e25df
1 changed files with 7 additions and 0 deletions
|
@ -112,6 +112,13 @@ async function verify(apiConfig: ClashAPIConfig): Promise<[number, string?]> {
|
||||||
try {
|
try {
|
||||||
new URL(apiConfig.baseURL);
|
new URL(apiConfig.baseURL);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (apiConfig.baseURL) {
|
||||||
|
const prefix = apiConfig.baseURL.substring(0, 7);
|
||||||
|
if (prefix !== 'http://' && prefix !== 'https:/') {
|
||||||
|
return [1, 'Must starts with http:// or https://'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [1, 'Invalid URL'];
|
return [1, 'Invalid URL'];
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue