From 405f6bbb7ffc390327c99dcef2cbbf9b3bc75f01 Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Tue, 7 Nov 2023 04:13:19 +0500 Subject: [PATCH] fix(jellyfinlogin): use externalHostname if set for forgetpassword link Implemented dynamic URL generation for the 'Forgot Password' feature. If jellyfin external hostname is set, the URL is generated based on it; otherwise, jellyfin hostname is used as the base URL. The URL includes additional parameters to handle emby support. fix #199, fix #424, re #212 --- server/interfaces/api/settingsInterfaces.ts | 1 + server/lib/settings.ts | 2 ++ src/components/Login/JellyfinLogin.tsx | 16 +++++++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/server/interfaces/api/settingsInterfaces.ts b/server/interfaces/api/settingsInterfaces.ts index 32ed6a542..b709a0c4b 100644 --- a/server/interfaces/api/settingsInterfaces.ts +++ b/server/interfaces/api/settingsInterfaces.ts @@ -22,6 +22,7 @@ export interface SettingsAboutResponse { export interface PublicSettingsResponse { jellyfinHost?: string; + jellyfinExternalHost?: string; jellyfinServerName?: string; initialized: boolean; applicationTitle: string; diff --git a/server/lib/settings.ts b/server/lib/settings.ts index 97eff35af..133d0e327 100644 --- a/server/lib/settings.ts +++ b/server/lib/settings.ts @@ -130,6 +130,7 @@ interface FullPublicSettings extends PublicSettings { originalLanguage: string; mediaServerType: number; jellyfinHost?: string; + jellyfinExternalHost?: string; jellyfinServerName?: string; partialRequestsEnabled: boolean; cacheImages: boolean; @@ -543,6 +544,7 @@ class Settings { originalLanguage: this.data.main.originalLanguage, mediaServerType: this.main.mediaServerType, jellyfinHost: this.jellyfin.hostname, + jellyfinExternalHost: this.jellyfin.externalHostname, partialRequestsEnabled: this.data.main.partialRequestsEnabled, cacheImages: this.data.main.cacheImages, vapidPublic: this.vapidPublic, diff --git a/src/components/Login/JellyfinLogin.tsx b/src/components/Login/JellyfinLogin.tsx index ff9575ff8..126fa4f76 100644 --- a/src/components/Login/JellyfinLogin.tsx +++ b/src/components/Login/JellyfinLogin.tsx @@ -67,6 +67,7 @@ const JellyfinLogin: React.FC = ({ ), password: Yup.string(), }); + const mediaServerFormatValues = { mediaServerName: publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', @@ -218,6 +219,9 @@ const JellyfinLogin: React.FC = ({ ), password: Yup.string(), }); + const baseUrl = settings.currentSettings.jellyfinExternalHost + ? settings.currentSettings.jellyfinExternalHost + : settings.currentSettings.jellyfinHost; return (
= ({