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

Fix server candidates

This commit is contained in:
Dmitry Lyzo 2021-09-20 00:22:56 +03:00
parent bae7575c96
commit 889dae9c7b

View file

@ -27,19 +27,22 @@ export async function serverAddress() {
const urls = await webSettings.getServers(); const urls = await webSettings.getServers();
if (urls.length === 0) { if (urls.length === 0) {
// Don't use app URL as server URL // Otherwise use computed base URL
if (window.NativeShell) { let url;
const index = window.location.href.toLowerCase().lastIndexOf('/web');
if (index != -1) {
url = window.location.href.substring(0, index);
} else {
// fallback to location without path
url = window.location.origin;
}
// Don't use bundled app URL (file:) as server URL
if (url.startsWith('file:')) {
return Promise.resolve(); return Promise.resolve();
} }
// Otherwise use computed base URL urls.push(url);
const index = window.location.href.toLowerCase().lastIndexOf('/web');
if (index != -1) {
urls.push(window.location.href.substring(0, index));
} else {
// fallback to location without path
urls.push(window.location.origin);
}
} }
console.debug('URL candidates:', urls); console.debug('URL candidates:', urls);