fix(proxy): Improve proxy URL handling for non-standard ports
This commit is contained in:
parent
8766eaae21
commit
81aaaab76d
2 changed files with 5 additions and 1 deletions
|
|
@ -300,6 +300,10 @@ async function connect (connectOptions: ConnectOptions) {
|
|||
if (connectOptions.proxy?.startsWith(':')) {
|
||||
connectOptions.proxy = `${location.protocol}//${location.hostname}${connectOptions.proxy}`
|
||||
}
|
||||
if (connectOptions.proxy && location.port !== '80' && location.port !== '443' && !/:\d+$/.test(connectOptions.proxy)) {
|
||||
const https = connectOptions.proxy.startsWith('https://') || location.protocol === 'https:'
|
||||
connectOptions.proxy = `${connectOptions.proxy}:${https ? 443 : 80}`
|
||||
}
|
||||
const proxy = cleanConnectIp(connectOptions.proxy, undefined)
|
||||
let { username } = connectOptions
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ const Inner = ({ hidden, customServersList }: { hidden?: boolean, customServersL
|
|||
try {
|
||||
lastRequestStart = Date.now()
|
||||
if (signal.aborted) return
|
||||
const response = await fetch(`https://api.mcstatus.io/v2/status/java/${server.ip}`, {
|
||||
const response = await fetch(`https://api.mcstatus.io/v2/status/java/${server.ip}`, {
|
||||
// signal // DONT ADD SIGNAL IT WILL CRUSH JS RUNTIME
|
||||
})
|
||||
const data: ServerResponse = await response.json()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue