diff --git a/server/auth.go b/server/auth.go index a6a945df..c8b3165a 100644 --- a/server/auth.go +++ b/server/auth.go @@ -150,6 +150,7 @@ type AvailableAuthProvidersResponse struct { AvailableAuthProviders []string `json:"available"` SignupEnabled bool `json:"signupEnabled"` IsInSetup bool `json:"isInSetup"` + UseEmby bool `json:"useEmby"` } type ArgonParams struct { diff --git a/server/config.go b/server/config.go index a9e325aa..7de3e107 100644 --- a/server/config.go +++ b/server/config.go @@ -34,6 +34,9 @@ type ServerConfig struct { // to enable it as an auth provider. JELLYFIN_HOST string `json:",omitempty"` + // Optional: Use Emby instead of Jellyfin branding in the ui. + USE_EMBY bool + // Enable/disable signup functionality. // Set to `false` to disable registering an account. SIGNUP_ENABLED bool @@ -73,6 +76,7 @@ func (c *ServerConfig) GetSafe() ServerConfig { SIGNUP_ENABLED: c.SIGNUP_ENABLED, DEFAULT_COUNTRY: c.DEFAULT_COUNTRY, JELLYFIN_HOST: c.JELLYFIN_HOST, + USE_EMBY: c.USE_EMBY, TMDB_KEY: c.TMDB_KEY, PLEX_HOST: c.PLEX_HOST, PLEX_MACHINE_ID: c.PLEX_MACHINE_ID, @@ -150,6 +154,8 @@ func updateConfig(k string, v any) error { } if k == "JELLYFIN_HOST" { Config.JELLYFIN_HOST = v.(string) + } else if k == "USE_EMBY" { + Config.USE_EMBY = v.(bool) } else if k == "SIGNUP_ENABLED" { Config.SIGNUP_ENABLED = v.(bool) } else if k == "TMDB_KEY" { diff --git a/server/routes.go b/server/routes.go index 303edcec..f26bf7da 100644 --- a/server/routes.go +++ b/server/routes.go @@ -622,6 +622,7 @@ func (b *BaseRouter) addAuthRoutes() { AvailableAuthProviders: availableAuthProviders, SignupEnabled: Config.SIGNUP_ENABLED, IsInSetup: ServerInSetup, + UseEmby: Config.USE_EMBY, }) }) diff --git a/src/lib/Icon.svelte b/src/lib/Icon.svelte index fe3cfb11..91151983 100644 --- a/src/lib/Icon.svelte +++ b/src/lib/Icon.svelte @@ -58,6 +58,12 @@ d="M12 .002C8.826.002-1.398 18.537.16 21.666c1.56 3.129 22.14 3.094 23.682 0C25.384 18.573 15.177 0 12 0zm7.76 18.949c-1.008 2.028-14.493 2.05-15.514 0C3.224 16.9 9.92 4.755 12.003 4.755c2.081 0 8.77 12.166 7.759 14.196zM12 9.198c-1.054 0-4.446 6.15-3.93 7.189.518 1.04 7.348 1.027 7.86 0 .511-1.027-2.874-7.19-3.93-7.19z" /> +{:else if i === "emby"} + + + {:else if i === "plex"} diff --git a/src/routes/(app)/profile/+page.svelte b/src/routes/(app)/profile/+page.svelte index b2107a73..588e0a3b 100644 --- a/src/routes/(app)/profile/+page.svelte +++ b/src/routes/(app)/profile/+page.svelte @@ -292,7 +292,7 @@ {/if} {#if user?.type === UserType?.Jellyfin} {/if} {#if user?.type === UserType?.Plex} diff --git a/src/routes/(app)/profile/modals/SyncModal.svelte b/src/routes/(app)/profile/modals/SyncModal.svelte index 569d44fb..49e04429 100644 --- a/src/routes/(app)/profile/modals/SyncModal.svelte +++ b/src/routes/(app)/profile/modals/SyncModal.svelte @@ -113,7 +113,11 @@ diff --git a/src/routes/(app)/server/+page.svelte b/src/routes/(app)/server/+page.svelte index 301ba439..01392a94 100644 --- a/src/routes/(app)/server/+page.svelte +++ b/src/routes/(app)/server/+page.svelte @@ -39,6 +39,7 @@ let tmdbkDisabled = false; let plexHostDisabled = false; let countryDisabled = false; + let useEmbyDisabled = false; let selectedCountry: string; let countries: any; let countriesDropdown: DropDownItem[] = []; @@ -92,6 +93,11 @@ async function getServerStats() { return (await axios.get("/server/stats")).data as ServerStats; } + + let jellyfinOrEmby = "Jellyfin"; + $: { + jellyfinOrEmby = serverConfig?.USE_EMBY ? "Emby" : "Jellyfin"; + }
@@ -148,13 +154,13 @@ /> { jfDisabled = true; @@ -165,6 +171,23 @@ disabled={jfDisabled} /> + + { + useEmbyDisabled = true; + updateServerConfig("USE_EMBY", on, () => { + useEmbyDisabled = false; + }); + }} + /> + - Play On Jellyfin + {#if localStorage.getItem("useEmby")} + Play On Emby + {:else} + Play On Jellyfin + {/if} {/if} {#if $serverFeatures.sonarr && data.tvId} diff --git a/src/routes/(plain)/login/+page.svelte b/src/routes/(plain)/login/+page.svelte index 79828cc6..0acc6b5d 100644 --- a/src/routes/(plain)/login/+page.svelte +++ b/src/routes/(plain)/login/+page.svelte @@ -11,6 +11,7 @@ let login = true; let availableProviders: string[] = []; let signupEnabled = true; + let useEmby = false; onMount(() => { if (localStorage.getItem("token")) { @@ -25,6 +26,7 @@ } availableProviders = r.data.available; signupEnabled = r.data.signupEnabled; + useEmby = r.data.useEmby; } }); }); @@ -60,6 +62,11 @@ if (resp.data?.token) { console.log("Received token... logging in."); localStorage.setItem("token", resp.data.token); + if (useEmby) { + localStorage.setItem("useEmby", "1"); + } else { + localStorage.removeItem("useEmby"); + } goto("/"); notify({ id: nid, text: `Welcome ${user}!`, type: "success" }); } @@ -142,9 +149,19 @@ {#if availableProviders?.findIndex((provider) => provider == "plex") > -1} diff --git a/src/types.ts b/src/types.ts index 52d38eed..749ff87f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -11,6 +11,7 @@ export type Icon = | "play" | "pause" | "jellyfin" + | "emby" | "plex" | "trash" | "close" @@ -207,6 +208,7 @@ export interface AvailableAuthProviders { available: string[]; signupEnabled: boolean; isInSetup: boolean; + useEmby: boolean; } export interface TokenClaims { @@ -788,6 +790,7 @@ export interface ManagedUser { export interface ServerConfig { DEFAULT_COUNTRY: string; JELLYFIN_HOST: string; + USE_EMBY: boolean; SIGNUP_ENABLED: boolean; TMDB_KEY: string; PLEX_HOST: string;