From 410172fee2b123ff4032b3225f2f2abe832bd8a3 Mon Sep 17 00:00:00 2001 From: grimsi <9295182+grimsi@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:46:13 +0200 Subject: [PATCH] WIP: Create new start page --- .../administration/LogManagement.tsx | 2 +- .../administration/ProfileManagement.tsx | 4 +- .../administration/SystemManagement.tsx | 14 ++++ gameyfin/src/main/frontend/routes.tsx | 8 +- .../frontend/views/AdministrationView.tsx | 7 +- gameyfin/src/main/frontend/views/HomeView.tsx | 9 +++ gameyfin/src/main/frontend/views/TestView.tsx | 78 ------------------- .../passwordreset/PasswordResetService.kt | 5 +- 8 files changed, 38 insertions(+), 89 deletions(-) create mode 100644 gameyfin/src/main/frontend/components/administration/SystemManagement.tsx create mode 100644 gameyfin/src/main/frontend/views/HomeView.tsx delete mode 100644 gameyfin/src/main/frontend/views/TestView.tsx diff --git a/gameyfin/src/main/frontend/components/administration/LogManagement.tsx b/gameyfin/src/main/frontend/components/administration/LogManagement.tsx index c96516f..b96ad2a 100644 --- a/gameyfin/src/main/frontend/components/administration/LogManagement.tsx +++ b/gameyfin/src/main/frontend/components/administration/LogManagement.tsx @@ -42,7 +42,7 @@ function LogManagementLayout({getConfig, formik}: any) { } return ( -
+
diff --git a/gameyfin/src/main/frontend/components/administration/ProfileManagement.tsx b/gameyfin/src/main/frontend/components/administration/ProfileManagement.tsx index b3276ee..df32632 100644 --- a/gameyfin/src/main/frontend/components/administration/ProfileManagement.tsx +++ b/gameyfin/src/main/frontend/components/administration/ProfileManagement.tsx @@ -113,10 +113,10 @@ export default function ProfileManagement() {
- -
diff --git a/gameyfin/src/main/frontend/components/administration/SystemManagement.tsx b/gameyfin/src/main/frontend/components/administration/SystemManagement.tsx new file mode 100644 index 0000000..5f20de6 --- /dev/null +++ b/gameyfin/src/main/frontend/components/administration/SystemManagement.tsx @@ -0,0 +1,14 @@ +import React from "react"; +import {SystemEndpoint} from "Frontend/generated/endpoints"; +import withConfigPage from "Frontend/components/administration/withConfigPage"; +import {Button} from "@heroui/react"; + +function SystemManagementLayout() { + return ( +
+ +
+ ); +} + +export const SystemManagement = withConfigPage(SystemManagementLayout, "System", "system", null); \ No newline at end of file diff --git a/gameyfin/src/main/frontend/routes.tsx b/gameyfin/src/main/frontend/routes.tsx index 7337e65..516f793 100644 --- a/gameyfin/src/main/frontend/routes.tsx +++ b/gameyfin/src/main/frontend/routes.tsx @@ -2,7 +2,7 @@ import {protectRoutes} from '@vaadin/hilla-react-auth'; import {createBrowserRouter, RouteObject} from 'react-router'; import LoginView from "Frontend/views/LoginView"; import MainLayout from "Frontend/views/MainLayout"; -import TestView from "Frontend/views/TestView"; +import HomeView from "Frontend/views/HomeView"; import SetupView from "Frontend/views/SetupView"; import {ThemeSelector} from "Frontend/components/theming/ThemeSelector"; import App from "Frontend/App"; @@ -18,6 +18,7 @@ import PasswordResetView from "Frontend/views/PasswordResetView"; import EmailConfirmationView from "Frontend/views/EmailConfirmationView"; import InvitationRegistrationView from "Frontend/views/InvitationRegistrationView"; import PluginManagement from "Frontend/components/administration/PluginManagement"; +import {SystemManagement} from "Frontend/components/administration/SystemManagement"; export const routes = protectRoutes([ { @@ -29,7 +30,7 @@ export const routes = protectRoutes([ handle: {requiresLogin: true}, children: [ { - index: true, element: + index: true, element: }, { path: 'settings', @@ -48,7 +49,8 @@ export const routes = protectRoutes([ {path: 'sso', element: }, {path: 'messages', element: }, {path: 'plugins', element: }, - {path: 'logs', element: } + {path: 'logs', element: }, + {path: 'system', element: } ] } ] diff --git a/gameyfin/src/main/frontend/views/AdministrationView.tsx b/gameyfin/src/main/frontend/views/AdministrationView.tsx index ddf403b..6210fb8 100644 --- a/gameyfin/src/main/frontend/views/AdministrationView.tsx +++ b/gameyfin/src/main/frontend/views/AdministrationView.tsx @@ -1,4 +1,4 @@ -import {Envelope, GameController, LockKey, Log, Plug, Users} from "@phosphor-icons/react"; +import {Envelope, GameController, LockKey, Log, Plug, Users, Wrench} from "@phosphor-icons/react"; import withSideMenu, {MenuItem} from "Frontend/components/general/withSideMenu"; const menuItems: MenuItem[] = [ @@ -31,6 +31,11 @@ const menuItems: MenuItem[] = [ title: "Logs", url: "logs", icon: + }, + { + title: "System", + url: "system", + icon: } ] diff --git a/gameyfin/src/main/frontend/views/HomeView.tsx b/gameyfin/src/main/frontend/views/HomeView.tsx new file mode 100644 index 0000000..06db7f7 --- /dev/null +++ b/gameyfin/src/main/frontend/views/HomeView.tsx @@ -0,0 +1,9 @@ +export default function HomeView() { + return ( +
+
+

Welcome to Gameyfin!

+
+
+ ); +} \ No newline at end of file diff --git a/gameyfin/src/main/frontend/views/TestView.tsx b/gameyfin/src/main/frontend/views/TestView.tsx deleted file mode 100644 index 762e464..0000000 --- a/gameyfin/src/main/frontend/views/TestView.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import {Link} from "react-router"; -import {addToast, Button, Input} from "@heroui/react"; -import {LibraryEndpoint, SystemEndpoint} from "Frontend/generated/endpoints"; -import {useState} from "react"; -import GameDto from "Frontend/generated/de/grimsi/gameyfin/games/dto/GameDto"; -import {GameOverviewCard} from "Frontend/components/general/cards/GameOverviewCard"; - -export default function TestView() { - const [gameTitle, setGameTitle] = useState(""); - const [game, setGame] = useState(); - - function getGame() { - LibraryEndpoint.test(gameTitle).then(game => { - if (game == undefined) return; - setGame(game); - }); - } - - function removeGames() { - LibraryEndpoint.removeGames().then(() => { - setGame(undefined); - addToast({ - title: "Success", - description: "Games removed", - color: "success" - }) - }); - } - - function removeLibraries() { - LibraryEndpoint.removeLibraries().then(() => { - addToast({ - title: "Success", - description: "Libraries removed", - color: "success" - }) - }); - } - - return ( -
-
- Setup -
- - - -
- -
- - - - -
- {game && } - {game && <>{JSON.stringify(game, null, 2)}} -
-
- ); -} \ No newline at end of file diff --git a/gameyfin/src/main/kotlin/de/grimsi/gameyfin/users/passwordreset/PasswordResetService.kt b/gameyfin/src/main/kotlin/de/grimsi/gameyfin/users/passwordreset/PasswordResetService.kt index be89a2d..6c46187 100644 --- a/gameyfin/src/main/kotlin/de/grimsi/gameyfin/users/passwordreset/PasswordResetService.kt +++ b/gameyfin/src/main/kotlin/de/grimsi/gameyfin/users/passwordreset/PasswordResetService.kt @@ -41,14 +41,11 @@ class PasswordResetService( * - The user is not managed externally */ fun generate(username: String): TokenDto { - if (messageService.enabled) { - throw IllegalStateException("Cannot create password reset token for user '$username' because self-service is enabled") - } val user = userService.getByUsername(username) ?: throw IllegalArgumentException("Cannot create password reset token for user '$username' because user does not exist") - if (user.emailConfirmed) { + if (messageService.enabled && user.emailConfirmed) { throw IllegalStateException("Cannot create password reset token for user '$username' because self-service is enabled") }