mirror of
https://github.com/sct/overseerr.git
synced 2025-12-26 08:25:07 +01:00
fix(backend): fixes Jellyfin/Emby links if server is initially setup with a trailing /
Fixes #168 and #220
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,10 @@ authRoutes.post('/jellyfin', async (req, res, next) => {
|
||||
|
||||
// Update the users avatar with their jellyfin profile pic (incase it changed)
|
||||
if (account.User.PrimaryImageTag) {
|
||||
user.avatar = `${jellyfinHost}/Users/${account.User.Id}/Images/Primary/?tag=${account.User.PrimaryImageTag}&quality=90`;
|
||||
user.avatar = new URL(
|
||||
`/Users/${account.User.Id}/Images/Primary/?tag=${account.User.PrimaryImageTag}&quality=90`,
|
||||
jellyfinHost
|
||||
).href;
|
||||
} else {
|
||||
user.avatar = '/os_logo_square.png';
|
||||
}
|
||||
@@ -309,7 +312,10 @@ authRoutes.post('/jellyfin', async (req, res, next) => {
|
||||
jellyfinAuthToken: account.AccessToken,
|
||||
permissions: Permission.ADMIN,
|
||||
avatar: account.User.PrimaryImageTag
|
||||
? `${jellyfinHost}/Users/${account.User.Id}/Images/Primary/?tag=${account.User.PrimaryImageTag}&quality=90`
|
||||
? new URL(
|
||||
`/Users/${account.User.Id}/Images/Primary/?tag=${account.User.PrimaryImageTag}&quality=90`,
|
||||
jellyfinHost
|
||||
).href
|
||||
: '/os_logo_square.png',
|
||||
userType: UserType.JELLYFIN,
|
||||
});
|
||||
@@ -339,7 +345,10 @@ authRoutes.post('/jellyfin', async (req, res, next) => {
|
||||
jellyfinAuthToken: account.AccessToken,
|
||||
permissions: settings.main.defaultPermissions,
|
||||
avatar: account.User.PrimaryImageTag
|
||||
? `${jellyfinHost}/Users/${account.User.Id}/Images/Primary/?tag=${account.User.PrimaryImageTag}&quality=90`
|
||||
? new URL(
|
||||
`/Users/${account.User.Id}/Images/Primary/?tag=${account.User.PrimaryImageTag}&quality=90`,
|
||||
jellyfinHost
|
||||
).href
|
||||
: '/os_logo_square.png',
|
||||
userType: UserType.JELLYFIN,
|
||||
});
|
||||
|
||||
@@ -330,7 +330,10 @@ settingsRoutes.get('/jellyfin/users', async (req, res) => {
|
||||
username: user.Name,
|
||||
id: user.Id,
|
||||
thumb: user.PrimaryImageTag
|
||||
? `${jellyfinHost}/Users/${user.Id}/Images/Primary/?tag=${user.PrimaryImageTag}&quality=90`
|
||||
? new URL(
|
||||
`/Users/${user.Id}/Images/Primary/?tag=${user.PrimaryImageTag}&quality=90`,
|
||||
jellyfinHost
|
||||
).href
|
||||
: '/os_logo_square.png',
|
||||
email: user.Name,
|
||||
}));
|
||||
|
||||
@@ -525,7 +525,10 @@ router.post(
|
||||
email: jellyfinUser?.Name,
|
||||
permissions: settings.main.defaultPermissions,
|
||||
avatar: jellyfinUser?.PrimaryImageTag
|
||||
? `${jellyfinHost}/Users/${jellyfinUser.Id}/Images/Primary/?tag=${jellyfinUser.PrimaryImageTag}&quality=90`
|
||||
? new URL(
|
||||
`/Users/${jellyfinUser.Id}/Images/Primary/?tag=${jellyfinUser.PrimaryImageTag}&quality=90`,
|
||||
jellyfinHost
|
||||
).href
|
||||
: '/os_logo_square.png',
|
||||
userType: UserType.JELLYFIN,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user