1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

wizard takes highest priority when selecting a server

This commit is contained in:
dkanada 2020-11-07 16:02:28 +09:00
parent e60f01b3a3
commit d4c8d1a334

View file

@ -18,11 +18,13 @@ export async function serverAddress() {
} }
}); });
if (current) return Promise.resolve(current); // TODO this makes things faster but it also blocks the wizard in some scenarios
// if (current) return Promise.resolve(current);
const urls = []; const urls = [];
urls.push(window.location.origin); urls.push(window.location.origin);
urls.push(`${window.location.protocol}//${window.location.hostname}:8096`); urls.push(`https://${window.location.hostname}:8920`);
urls.push(`http://${window.location.hostname}:8096`);
urls.push(...await webSettings.getServers()); urls.push(...await webSettings.getServers());
const promises = urls.map(url => { const promises = urls.map(url => {
@ -32,8 +34,13 @@ export async function serverAddress() {
}); });
return Promise.all(promises).then(responses => { return Promise.all(promises).then(responses => {
return responses.find(response => response && response.ok); responses = responses.filter(response => response && response.ok);
}).then(response => response.url.replace('/System/Info/Public', '')).catch(error => { return Promise.all(responses.map(response => response.json()));
}).then(configs => {
const selection = configs.find(config => !config.StartupWizardCompleted)
if (!selection) selection = configs[0];
return Promise.resolve(selection.LocalAddress);
}).catch(error => {
console.log(error); console.log(error);
return Promise.resolve(); return Promise.resolve();
}); });