fix(backend): fixes Jellyfin/Emby links if server is initially setup with a trailing /

Fixes #168 and #220
This commit is contained in:
Fallenbagel
2022-09-26 10:17:18 +05:00
parent e0f9a6e12f
commit 66357019f0
4 changed files with 28 additions and 7 deletions

View File

@@ -205,10 +205,16 @@ class Media {
? externalHostname
: hostname;
if (this.jellyfinMediaId) {
this.mediaUrl = `${jellyfinHost}/web/index.html#!/${pageName}?id=${this.jellyfinMediaId}&context=home&serverId=${serverId}`;
this.mediaUrl = new URL(
`/web/index.html#!/${pageName}?id=${this.jellyfinMediaId}&context=home&serverId=${serverId}`,
jellyfinHost
).href;
}
if (this.jellyfinMediaId4k) {
this.mediaUrl4k = `${jellyfinHost}/web/index.html#!/${pageName}?id=${this.jellyfinMediaId4k}&context=home&serverId=${serverId}`;
this.mediaUrl4k = new URL(
`/web/index.html#!/${pageName}?id=${this.jellyfinMediaId4k}&context=home&serverId=${serverId}`,
jellyfinHost
).href;
}
}
}