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 {
|
||||
new URL(apiConfig.baseURL);
|
||||
} 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'];
|
||||
}
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue