mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Address review
This commit is contained in:
parent
27b113efba
commit
1d51b94d41
1 changed files with 4 additions and 5 deletions
|
@ -29,10 +29,10 @@ export async function serverAddress() {
|
||||||
// if (current) return Promise.resolve(current);
|
// if (current) return Promise.resolve(current);
|
||||||
|
|
||||||
const urls = [];
|
const urls = [];
|
||||||
if (window.location.href.indexOf('/web/') !== -1) { // Do we polyfill String.prototype.includes?
|
if (window.location.href.indexOf('/web/') !== -1) {
|
||||||
const split = window.location.href.split('/web/');
|
const split = window.location.href.split('/web/');
|
||||||
|
|
||||||
for (let i = split.length - 1; i ; i--) {
|
for (let i = split.length - 1; i > 0; i--) {
|
||||||
urls.push(split.slice(0, i).join('/web/'));
|
urls.push(split.slice(0, i).join('/web/'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ export async function serverAddress() {
|
||||||
|
|
||||||
urls.push(...await webSettings.getServers());
|
urls.push(...await webSettings.getServers());
|
||||||
|
|
||||||
console.log('URL candidates:', urls);
|
console.debug('URL candidates:', urls);
|
||||||
|
|
||||||
const promises = urls.map(url => {
|
const promises = urls.map(url => {
|
||||||
return fetch(`${url}/System/Info/Public`).then(resp => {
|
return fetch(`${url}/System/Info/Public`).then(resp => {
|
||||||
|
@ -67,8 +67,7 @@ export async function serverAddress() {
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
}).then(configs => {
|
}).then(configs => {
|
||||||
let selection = configs.find(obj => !obj.config.StartupWizardCompleted);
|
let selection = configs.find(obj => !obj.config.StartupWizardCompleted) || configs[0];
|
||||||
if (!selection) selection = configs[0];
|
|
||||||
return Promise.resolve(selection.url);
|
return Promise.resolve(selection.url);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue