refactor(jellyfinsettings): abstract jellyfin hostname, updated ui to reflect it, better validation
This PR refactors and abstracts jellyfin hostname into, jellyfin ip, jellyfin port, jellyfin useSsl, and jellyfin urlBase. This makes it more consistent with how plex settings are stored as well. In addition, this improves validation as validation can be applied seperately to them instead of as one whole regex doing the work to validate the url. UI was updated to reflect this. BREAKING CHANGE: Jellyfin settings now does not include a hostname. Instead it abstracted it to ip, port, useSsl, and urlBase. However, migration of old settings to new settings should work automatically.
This commit is contained in:
18
server/utils/getHostname.ts
Normal file
18
server/utils/getHostname.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { getSettings } from '@server/lib/settings';
|
||||
|
||||
interface HostnameParams {
|
||||
useSsl?: boolean;
|
||||
ip?: string;
|
||||
port?: number;
|
||||
urlBase?: string;
|
||||
}
|
||||
|
||||
export const getHostname = (params?: HostnameParams): string => {
|
||||
const settings = params ? params : getSettings().jellyfin;
|
||||
|
||||
const { useSsl, ip, port, urlBase } = settings;
|
||||
|
||||
const hostname = `${useSsl ? 'https' : 'http'}://${ip}:${port}${urlBase}`;
|
||||
|
||||
return hostname;
|
||||
};
|
||||
Reference in New Issue
Block a user