diff --git a/src/scripts/servers.js b/src/scripts/servers.js index b64be4b5b1..cfcc72bb8a 100644 --- a/src/scripts/servers.js +++ b/src/scripts/servers.js @@ -126,8 +126,16 @@ class Servers extends EventEmitter { } async validateHost(hostUrl, timeout = 5000) { + const headers = new Headers(); + + if (hostUrl.includes('@')) { + const url = new URL(hostUrl); + hostUrl = url.origin; + headers.set('Authorization', `Basic ${ btoa(`${ url.username }:${ url.password }`) }`); + } + const response = await Promise.race([ - fetch(`${ hostUrl }/api/info`), + fetch(`${ hostUrl }/api/info`, { headers }), new Promise((resolve, reject) => setTimeout(() => reject('timeout'), timeout)), ]);