feat: revamp login page and support disabling media server login (#1286)

* feat: support disabling jellyfin login

* feat: revamp login screen

Update the login screen for better usability, especially with OpenID
Connect and Plex login, allowing one-click login and removing the
accordion layout. Additionally, ensures that media server login is
hidden when disabled in the settings.

* test: update cypress login command
This commit is contained in:
Michael Thomas
2025-02-22 11:40:38 -05:00
committed by GitHub
parent 9712f56054
commit 73d8efaa54
23 changed files with 921 additions and 639 deletions

37
src/hooks/usePlexLogin.ts Normal file
View File

@@ -0,0 +1,37 @@
import PlexOAuth from '@app/utils/plex';
import { useState } from 'react';
const plexOAuth = new PlexOAuth();
function usePlexLogin({
onAuthToken,
onError,
}: {
onAuthToken: (authToken: string) => void;
onError?: (err: string) => void;
}) {
const [loading, setLoading] = useState(false);
const getPlexLogin = async () => {
setLoading(true);
try {
const authToken = await plexOAuth.login();
setLoading(false);
onAuthToken(authToken);
} catch (e) {
if (onError) {
onError(e.message);
}
setLoading(false);
}
};
const login = () => {
plexOAuth.preparePopup();
setTimeout(() => getPlexLogin(), 1500);
};
return { loading, login };
}
export default usePlexLogin;