From 9bc30ab62da3b9dd66c84ad823f4c93a2be651ad Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 8 Nov 2025 14:30:53 +0100 Subject: [PATCH 1/2] Add back search logic --- front/src/ui/browse/index.tsx | 20 ++++++++++++++------ front/src/ui/navbar/index.tsx | 32 +++++++++++++++++++++++++------- front/src/utils.ts | 14 +++++++------- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/front/src/ui/browse/index.tsx b/front/src/ui/browse/index.tsx index d438754c..5b126676 100644 --- a/front/src/ui/browse/index.tsx +++ b/front/src/ui/browse/index.tsx @@ -8,6 +8,7 @@ import type { SortBy, SortOrd } from "./types"; export const BrowsePage = () => { const [filter, setFilter] = useQueryState("filter", ""); const [sort, setSort] = useQueryState("sort", "name"); + const [search] = useQueryState("q", ""); const sortOrd = sort.startsWith("-") ? "desc" : "asc"; const sortBy = (sort.startsWith("-") ? sort.substring(1) : sort) as SortBy; @@ -17,7 +18,7 @@ export const BrowsePage = () => { return ( { ); }; -BrowsePage.query = ( - filter?: string, - sortBy?: SortBy, - sortOrd?: SortOrd, -): QueryIdentifier => { +BrowsePage.query = ({ + filter, + sortBy, + sortOrd, + search, +}: { + filter?: string; + sortBy?: SortBy; + sortOrd?: SortOrd; + search?: string; +}): QueryIdentifier => { return { parser: Show, path: ["api", "shows"], @@ -50,6 +57,7 @@ BrowsePage.query = ( params: { sort: sortBy ? `${sortOrd === "desc" ? "-" : ""}${sortBy}` : "name", filter, + query: search, }, }; }; diff --git a/front/src/ui/navbar/index.tsx b/front/src/ui/navbar/index.tsx index f8655f80..468a30a0 100644 --- a/front/src/ui/navbar/index.tsx +++ b/front/src/ui/navbar/index.tsx @@ -4,7 +4,8 @@ import Login from "@material-symbols/svg-400/rounded/login.svg"; import Logout from "@material-symbols/svg-400/rounded/logout.svg"; import Search from "@material-symbols/svg-400/rounded/search-fill.svg"; import Settings from "@material-symbols/svg-400/rounded/settings.svg"; -import type { Ref } from "react"; +import { useGlobalSearchParams, usePathname, useRouter } from "expo-router"; +import { type Ref, useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { Platform, @@ -28,7 +29,6 @@ import { } from "~/primitives"; import { useAccount, useAccounts } from "~/providers/account-context"; import { logout } from "~/ui/login/logic"; -import { useQueryState } from "~/utils"; import { KyooLongLogo } from "./icon"; export const NavbarTitle = (props: { onLayout?: ViewProps["onLayout"] }) => { @@ -52,13 +52,31 @@ const SearchBar = ({ }: TextInputProps & { ref?: Ref }) => { const { theme } = useYoshiki(); const { t } = useTranslation(); - const [query, setQuery] = useQueryState("q", ""); + const params = useGlobalSearchParams(); + const [query, setQuery] = useState((params.q as string) ?? ""); + const path = usePathname(); + const router = useRouter(); + const inputRef = useRef(null); + + useEffect(() => { + if (path === "/browse") { + inputRef.current?.focus(); + setQuery(params.q as string); + } else { + inputRef.current?.blur(); + setQuery(""); + } + }, [path, params.q]); return ( { + setQuery(q); + if (path !== "/browse") router.navigate(`/browse?q=${q}`); + else router.setParams({ q }); + }} placeholder={t("navbar.search")} placeholderTextColor={theme.contrast} containerStyle={{ @@ -153,7 +171,7 @@ export const NavbarRight = () => { icon={Search} color={theme.colors.white} as={Link} - href={"/search"} + href={"/browse"} {...tooltip(t("navbar.search"))} /> )} diff --git a/front/src/utils.ts b/front/src/utils.ts index 2d67999c..fc93627d 100644 --- a/front/src/utils.ts +++ b/front/src/utils.ts @@ -1,5 +1,5 @@ -import { NavigationContext, useRoute } from "@react-navigation/native"; -import { useCallback, useContext } from "react"; +import { useLocalSearchParams, useRouter } from "expo-router"; +import { useCallback } from "react"; import type { Movie, Show } from "~/models"; export function setServerData(_key: string, _val: any) {} @@ -8,15 +8,15 @@ export function getServerData(key: string) { } export const useQueryState = (key: string, initial: S) => { - const route = useRoute(); - const nav = useContext(NavigationContext); + const params = useLocalSearchParams(); + const router = useRouter(); - const state = ((route.params as any)?.[key] as S) ?? initial; + const state = (params[key] as S) ?? initial; const update = useCallback( (val: S | ((old: S) => S)) => { - nav!.setParams({ [key]: val }); + router.setParams({ [key]: val } as any); }, - [nav, key], + [router, key], ); return [state, update] as const; }; From ebaf6d21774a2043543d975a28dd28f2224e7565 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 8 Nov 2025 14:39:57 +0100 Subject: [PATCH 2/2] Delete old front routing --- .../mobile/app/(app)/(tabs)/downloads.tsx | 23 -- front/apps/mobile/app/(app)/(tabs)/index.tsx | 27 --- front/apps/mobile/app/(app)/admin/index.tsx | 23 -- .../app/(app)/collection/[slug]/index.tsx | 27 --- .../mobile/app/(app)/movie/[slug]/index.tsx | 27 --- .../mobile/app/(app)/movie/[slug]/watch.tsx | 35 --- front/apps/mobile/app/(app)/search/index.tsx | 60 ----- .../apps/mobile/app/(app)/settings/index.tsx | 23 -- front/apps/mobile/app/(app)/show/[slug].tsx | 27 --- front/apps/mobile/app/(app)/watch/[slug].tsx | 35 --- front/apps/mobile/app/(public)/_layout.tsx | 51 ---- .../mobile/app/(public)/connection-error.tsx | 23 -- .../mobile/app/(public)/login/callback.tsx | 24 -- .../apps/mobile/app/(public)/login/index.tsx | 24 -- .../mobile/app/(public)/register/index.tsx | 24 -- .../mobile/app/(public)/server-url/index.tsx | 23 -- .../mobile/app/(public)/settings/index.tsx | 23 -- front/apps/mobile/app/_layout.tsx | 156 ------------ front/apps/mobile/app/utils.tsx | 76 ------ front/apps/mobile/assets/icon.png | Bin 7692 -> 0 bytes front/apps/mobile/metro.config.js | 68 ------ front/apps/mobile/tsconfig.json | 12 - front/apps/web/next.config.js | 137 ----------- front/apps/web/src/i18n.tsx | 76 ------ front/apps/web/src/pages/_app.tsx | 227 ------------------ front/apps/web/src/pages/_document.tsx | 120 --------- front/apps/web/src/pages/admin/index.tsx | 24 -- front/apps/web/src/pages/browse/index.tsx | 24 -- .../web/src/pages/collection/[slug]/index.tsx | 24 -- front/apps/web/src/pages/index.tsx | 23 -- front/apps/web/src/pages/login/callback.tsx | 24 -- front/apps/web/src/pages/login/index.tsx | 24 -- .../apps/web/src/pages/movie/[slug]/index.tsx | 24 -- .../apps/web/src/pages/movie/[slug]/watch.tsx | 24 -- front/apps/web/src/pages/register/index.tsx | 24 -- front/apps/web/src/pages/search/index.tsx | 24 -- front/apps/web/src/pages/settings/index.tsx | 24 -- front/apps/web/src/pages/setup/index.tsx | 24 -- front/apps/web/src/pages/show/[slug].tsx | 24 -- front/apps/web/src/pages/watch/[slug].tsx | 24 -- front/apps/web/src/polyfill.ts | 34 --- front/apps/web/src/router.tsx | 47 ---- front/apps/web/tsconfig.json | 24 -- front/packages/ui/src/search/index.tsx | 101 -------- 44 files changed, 1912 deletions(-) delete mode 100644 front/apps/mobile/app/(app)/(tabs)/downloads.tsx delete mode 100644 front/apps/mobile/app/(app)/(tabs)/index.tsx delete mode 100644 front/apps/mobile/app/(app)/admin/index.tsx delete mode 100644 front/apps/mobile/app/(app)/collection/[slug]/index.tsx delete mode 100644 front/apps/mobile/app/(app)/movie/[slug]/index.tsx delete mode 100644 front/apps/mobile/app/(app)/movie/[slug]/watch.tsx delete mode 100644 front/apps/mobile/app/(app)/search/index.tsx delete mode 100644 front/apps/mobile/app/(app)/settings/index.tsx delete mode 100644 front/apps/mobile/app/(app)/show/[slug].tsx delete mode 100644 front/apps/mobile/app/(app)/watch/[slug].tsx delete mode 100644 front/apps/mobile/app/(public)/_layout.tsx delete mode 100644 front/apps/mobile/app/(public)/connection-error.tsx delete mode 100644 front/apps/mobile/app/(public)/login/callback.tsx delete mode 100644 front/apps/mobile/app/(public)/login/index.tsx delete mode 100644 front/apps/mobile/app/(public)/register/index.tsx delete mode 100644 front/apps/mobile/app/(public)/server-url/index.tsx delete mode 100644 front/apps/mobile/app/(public)/settings/index.tsx delete mode 100644 front/apps/mobile/app/_layout.tsx delete mode 100644 front/apps/mobile/app/utils.tsx delete mode 100644 front/apps/mobile/assets/icon.png delete mode 100644 front/apps/mobile/metro.config.js delete mode 100644 front/apps/mobile/tsconfig.json delete mode 100755 front/apps/web/next.config.js delete mode 100644 front/apps/web/src/i18n.tsx delete mode 100755 front/apps/web/src/pages/_app.tsx delete mode 100644 front/apps/web/src/pages/_document.tsx delete mode 100644 front/apps/web/src/pages/admin/index.tsx delete mode 100644 front/apps/web/src/pages/browse/index.tsx delete mode 100644 front/apps/web/src/pages/collection/[slug]/index.tsx delete mode 100755 front/apps/web/src/pages/index.tsx delete mode 100644 front/apps/web/src/pages/login/callback.tsx delete mode 100644 front/apps/web/src/pages/login/index.tsx delete mode 100644 front/apps/web/src/pages/movie/[slug]/index.tsx delete mode 100644 front/apps/web/src/pages/movie/[slug]/watch.tsx delete mode 100644 front/apps/web/src/pages/register/index.tsx delete mode 100644 front/apps/web/src/pages/search/index.tsx delete mode 100644 front/apps/web/src/pages/settings/index.tsx delete mode 100644 front/apps/web/src/pages/setup/index.tsx delete mode 100644 front/apps/web/src/pages/show/[slug].tsx delete mode 100644 front/apps/web/src/pages/watch/[slug].tsx delete mode 100644 front/apps/web/src/polyfill.ts delete mode 100644 front/apps/web/src/router.tsx delete mode 100755 front/apps/web/tsconfig.json delete mode 100644 front/packages/ui/src/search/index.tsx diff --git a/front/apps/mobile/app/(app)/(tabs)/downloads.tsx b/front/apps/mobile/app/(app)/(tabs)/downloads.tsx deleted file mode 100644 index dfb44d79..00000000 --- a/front/apps/mobile/app/(app)/(tabs)/downloads.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { DownloadPage } from "@kyoo/ui"; - -export default DownloadPage; diff --git a/front/apps/mobile/app/(app)/(tabs)/index.tsx b/front/apps/mobile/app/(app)/(tabs)/index.tsx deleted file mode 100644 index fb6a7dd1..00000000 --- a/front/apps/mobile/app/(app)/(tabs)/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { HomePage } from "@kyoo/ui"; -import { withRoute } from "../../utils"; - -export default withRoute(HomePage, { - options: { headerTransparent: true, headerStyle: { backgroundColor: "transparent" } }, - statusBar: { barStyle: "light-content" }, -}); diff --git a/front/apps/mobile/app/(app)/admin/index.tsx b/front/apps/mobile/app/(app)/admin/index.tsx deleted file mode 100644 index b057197b..00000000 --- a/front/apps/mobile/app/(app)/admin/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { AdminPage } from "@kyoo/ui"; - -export default AdminPage; diff --git a/front/apps/mobile/app/(app)/collection/[slug]/index.tsx b/front/apps/mobile/app/(app)/collection/[slug]/index.tsx deleted file mode 100644 index 58686664..00000000 --- a/front/apps/mobile/app/(app)/collection/[slug]/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { CollectionPage } from "@kyoo/ui"; -import { withRoute } from "../../../utils"; - -export default withRoute(CollectionPage, { - options: { headerTransparent: true, headerStyle: { backgroundColor: "transparent" } }, - statusBar: { barStyle: "light-content" }, -}); diff --git a/front/apps/mobile/app/(app)/movie/[slug]/index.tsx b/front/apps/mobile/app/(app)/movie/[slug]/index.tsx deleted file mode 100644 index fd97ad59..00000000 --- a/front/apps/mobile/app/(app)/movie/[slug]/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { MovieDetails } from "@kyoo/ui"; -import { withRoute } from "../../../utils"; - -export default withRoute(MovieDetails, { - options: { headerTransparent: true, headerStyle: { backgroundColor: "transparent" } }, - statusBar: { barStyle: "light-content" }, -}); diff --git a/front/apps/mobile/app/(app)/movie/[slug]/watch.tsx b/front/apps/mobile/app/(app)/movie/[slug]/watch.tsx deleted file mode 100644 index 9f86bca1..00000000 --- a/front/apps/mobile/app/(app)/movie/[slug]/watch.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { Player } from "@kyoo/ui"; -import { withRoute } from "../../../utils"; - -export default withRoute( - Player, - { - options: { - headerShown: false, - navigationBarHidden: true, - }, - statusBar: { hidden: true }, - fullscreen: true, - }, - { type: "movie" }, -); diff --git a/front/apps/mobile/app/(app)/search/index.tsx b/front/apps/mobile/app/(app)/search/index.tsx deleted file mode 100644 index 4c0d1c88..00000000 --- a/front/apps/mobile/app/(app)/search/index.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { SearchPage } from "@kyoo/ui"; -import { Stack, useLocalSearchParams } from "expo-router"; -import { useTranslation } from "react-i18next"; -import { createParam } from "solito"; -import { useRouter } from "solito/router"; -import { useTheme } from "yoshiki/native"; - -const { useParam } = createParam<{ q?: string }>(); - -const Search = () => { - const theme = useTheme(); - const { back } = useRouter(); - const { t } = useTranslation(); - const [query, setQuery] = useParam("q"); - const routeParams = useLocalSearchParams(); - - return ( - <> - null, - // TODO: this shouuld not be null but since the header right is on the left of the search bar. shrug - headerRight: () => null, - headerSearchBarOptions: { - autoFocus: true, - headerIconColor: theme.colors.white, - hintTextColor: theme.light.overlay1, - textColor: theme.paragraph, - placeholder: t("navbar.search")!, - onClose: () => back(), - onChangeText: (e) => setQuery(e.nativeEvent.text), - }, - }} - /> - - - ); -}; - -export default Search; diff --git a/front/apps/mobile/app/(app)/settings/index.tsx b/front/apps/mobile/app/(app)/settings/index.tsx deleted file mode 100644 index 7a987194..00000000 --- a/front/apps/mobile/app/(app)/settings/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { SettingsPage } from "@kyoo/ui"; - -export default SettingsPage; diff --git a/front/apps/mobile/app/(app)/show/[slug].tsx b/front/apps/mobile/app/(app)/show/[slug].tsx deleted file mode 100644 index 7cef6bda..00000000 --- a/front/apps/mobile/app/(app)/show/[slug].tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { ShowDetails } from "@kyoo/ui"; -import { withRoute } from "../../utils"; - -export default withRoute(ShowDetails, { - options: { headerTransparent: true, headerStyle: { backgroundColor: "transparent" } }, - statusBar: { barStyle: "light-content" }, -}); diff --git a/front/apps/mobile/app/(app)/watch/[slug].tsx b/front/apps/mobile/app/(app)/watch/[slug].tsx deleted file mode 100644 index 3b2e4e9f..00000000 --- a/front/apps/mobile/app/(app)/watch/[slug].tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { Player } from "@kyoo/ui"; -import { withRoute } from "../../utils"; - -export default withRoute( - Player, - { - options: { - headerShown: false, - navigationBarHidden: true, - }, - statusBar: { hidden: true }, - fullscreen: true, - }, - { type: "episode" }, -); diff --git a/front/apps/mobile/app/(public)/_layout.tsx b/front/apps/mobile/app/(public)/_layout.tsx deleted file mode 100644 index 90dfb3de..00000000 --- a/front/apps/mobile/app/(public)/_layout.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { type Account, ConnectionErrorContext, useAccount } from "@kyoo/models"; -import { NavbarProfile, NavbarTitle } from "@kyoo/ui"; -import { Redirect, Stack } from "expo-router"; -import { useContext, useRef } from "react"; -import { useTheme } from "yoshiki/native"; - -export default function PublicLayout() { - const theme = useTheme(); - const account = useAccount(); - const { error } = useContext(ConnectionErrorContext); - const oldAccount = useRef(account); - - if (account && !error && account !== oldAccount.current) return ; - oldAccount.current = account; - - return ( - , - headerRight: () => , - contentStyle: { - backgroundColor: theme.background, - }, - headerStyle: { - backgroundColor: theme.accent, - }, - headerTintColor: theme.colors.white, - }} - /> - ); -} diff --git a/front/apps/mobile/app/(public)/connection-error.tsx b/front/apps/mobile/app/(public)/connection-error.tsx deleted file mode 100644 index a7d7d1c7..00000000 --- a/front/apps/mobile/app/(public)/connection-error.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { ConnectionError } from "@kyoo/ui"; - -export default ConnectionError; diff --git a/front/apps/mobile/app/(public)/login/callback.tsx b/front/apps/mobile/app/(public)/login/callback.tsx deleted file mode 100644 index 2a69ad49..00000000 --- a/front/apps/mobile/app/(public)/login/callback.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { OidcCallbackPage } from "@kyoo/ui"; -import { withRoute } from "../../utils"; - -export default withRoute(OidcCallbackPage); diff --git a/front/apps/mobile/app/(public)/login/index.tsx b/front/apps/mobile/app/(public)/login/index.tsx deleted file mode 100644 index 43bc741c..00000000 --- a/front/apps/mobile/app/(public)/login/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { LoginPage } from "@kyoo/ui"; -import { withRoute } from "../../utils"; - -export default withRoute(LoginPage); diff --git a/front/apps/mobile/app/(public)/register/index.tsx b/front/apps/mobile/app/(public)/register/index.tsx deleted file mode 100644 index a44e4006..00000000 --- a/front/apps/mobile/app/(public)/register/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { RegisterPage } from "@kyoo/ui"; -import { withRoute } from "../../utils"; - -export default withRoute(RegisterPage); diff --git a/front/apps/mobile/app/(public)/server-url/index.tsx b/front/apps/mobile/app/(public)/server-url/index.tsx deleted file mode 100644 index 8b0fe80f..00000000 --- a/front/apps/mobile/app/(public)/server-url/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { ServerUrlPage } from "@kyoo/ui"; - -export default ServerUrlPage; diff --git a/front/apps/mobile/app/(public)/settings/index.tsx b/front/apps/mobile/app/(public)/settings/index.tsx deleted file mode 100644 index 7a987194..00000000 --- a/front/apps/mobile/app/(public)/settings/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { SettingsPage } from "@kyoo/ui"; - -export default SettingsPage; diff --git a/front/apps/mobile/app/_layout.tsx b/front/apps/mobile/app/_layout.tsx deleted file mode 100644 index cd9caf64..00000000 --- a/front/apps/mobile/app/_layout.tsx +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import "react-native-reanimated"; - -import { - Poppins_300Light, - Poppins_400Regular, - Poppins_900Black, - useFonts, -} from "@expo-google-fonts/poppins"; -import { PortalProvider } from "@gorhom/portal"; -import { AccountProvider, createQueryClient, storage, useUserTheme } from "@kyoo/models"; -import { SnackbarProvider, ThemeSelector } from "@kyoo/primitives"; -import { DownloadProvider } from "@kyoo/ui"; -import { ThemeProvider as RNThemeProvider } from "@react-navigation/native"; -import { createSyncStoragePersister } from "@tanstack/query-sync-storage-persister"; -import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client"; -import { getLocales } from "expo-localization"; -import { Slot } from "expo-router"; -import * as SplashScreen from "expo-splash-screen"; -import i18next from "i18next"; -import "intl-pluralrules"; -import { type ReactNode, useEffect, useState } from "react"; -import { initReactI18next } from "react-i18next"; -import { useColorScheme } from "react-native"; -import resources from "../../../translations"; - -import NetInfo from "@react-native-community/netinfo"; -import { onlineManager } from "@tanstack/react-query"; -import { useTheme } from "yoshiki/native"; - -onlineManager.setEventListener((setOnline) => { - return NetInfo.addEventListener((state) => { - setOnline(!!state.isConnected); - }); -}); - -const clientStorage = { - setItem: (key, value) => { - storage.set(key, value); - }, - getItem: (key) => { - const value = storage.getString(key); - return value === undefined ? null : value; - }, - removeItem: (key) => { - storage.delete(key); - }, -} satisfies Partial; - -export const clientPersister = createSyncStoragePersister({ storage: clientStorage }); - -const sysLang = getLocales()[0].languageCode ?? "en"; -i18next.use(initReactI18next).init({ - interpolation: { - escapeValue: false, - }, - returnEmptyString: false, - fallbackLng: "en", - lng: storage.getString("language") ?? sysLang, - resources, -}); -// @ts-expect-error Manually added value -i18next.systemLanguage = sysLang; - -const NavigationThemeProvider = ({ children }: { children: ReactNode }) => { - const theme = useTheme(); - return ( - - {children} - - ); -}; - -SplashScreen.preventAutoHideAsync(); - -export default function Root() { - const [queryClient] = useState(() => createQueryClient()); - let theme = useUserTheme(); - const systemTheme = useColorScheme(); - const [fontsLoaded] = useFonts({ Poppins_300Light, Poppins_400Regular, Poppins_900Black }); - - if (theme === "auto") theme = systemTheme ?? "light"; - - useEffect(() => { - if (fontsLoaded) SplashScreen.hideAsync(); - }, [fontsLoaded]); - - if (!fontsLoaded) return null; - return ( - false }, - }} - onSuccess={async () => { - await queryClient.resumePausedMutations(); - queryClient.invalidateQueries(); - }} - > - - - - - - - - - - - - - - - ); -} diff --git a/front/apps/mobile/app/utils.tsx b/front/apps/mobile/app/utils.tsx deleted file mode 100644 index 85725f30..00000000 --- a/front/apps/mobile/app/utils.tsx +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { type QueryPage, useHasPermission } from "@kyoo/models"; -import { Unauthorized } from "@kyoo/ui"; -import arrayShuffle from "array-shuffle"; -import * as NavigationBar from "expo-navigation-bar"; -import { Stack, useLocalSearchParams } from "expo-router"; -import * as ScreenOrientation from "expo-screen-orientation"; -import { type ComponentType, useEffect } from "react"; -import { StatusBar, type StatusBarProps } from "react-native"; - -const FullscreenProvider = () => { - useEffect(() => { - ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE); - NavigationBar.setVisibilityAsync("hidden"); - return () => { - ScreenOrientation.unlockAsync(); - NavigationBar.setVisibilityAsync("visible"); - }; - }, []); - return null; -}; - -export const withRoute = ( - Component: ComponentType, - options?: Parameters[0] & { - statusBar?: StatusBarProps; - fullscreen?: boolean; - }, - defaultProps?: Partial, -) => { - const { statusBar, fullscreen, ...routeOptions } = options ?? {}; - const WithUseRoute = (props: any) => { - const routeParams = useLocalSearchParams(); - const hasPermissions = useHasPermission((Component as QueryPage).requiredPermissions ?? []); - - if (!hasPermissions) - return ; - - return ( - <> - {routeOptions && } - {statusBar && } - {fullscreen && } - - - ); - }; - - const { ...all } = Component; - Object.assign(WithUseRoute, { ...all }); - return WithUseRoute; -}; diff --git a/front/apps/mobile/assets/icon.png b/front/apps/mobile/assets/icon.png deleted file mode 100644 index a395f0fe942ef7826d580fac8ded0386598a41c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7692 zcmbVR_g7O-u)hhBUV?zqAxIHIM|ukgQbLg?NEZ-9q$piVLQzqgibyYlND=8GQX~jc zl_FhQklsTN5RwzD%oi2N4> zP*aj0_K!;3$qyPo{oDQkKzH%q5A=H`k^lfa-wbrLEJL!la>5eqts}ZnO{%pU5t?e% zEM2poQ|isQVp;N`%&GG4K)W|<1cj{VzAKo=12o)%1s`-nV(z^Hi*bn|Jgsa#qDO9t zW|g7u88*hy(#Bol5;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a42fyZZ(ZV#x2K#plhKSg%-X^_qfu zzC?A}C?Ley72}?3sEZ1NsQGED?XuW4Nmf8yU4rt?Y%!+iG=gUb0Qumo=xLNRi4)N{ zT8z@y-?YKqh;>^s7Qktdk3@xep$sGrr&WLkFufEs!e7A{q%57krMM(n?qZPp@2zu6 z2Q@;z(8+#~13&QMOdZT;bA9syaEq7RfUpBO!z(R+T9huLs1Ou;70cWZjjFd3G{B#S zAe@O2guhWJ1DHry0s~BZX#NRNVBRK_MVMh6f}pxZ1DK9|azB`#r^tuEA^+?>mbL}T zZaI$j4`0M*59MiNV+38_{~H27H~mF)VuFU|uFUPrXg_HL;JgHavJKGy!W&?y@;u!? zKIx}}5Pm_p@As$bp+I_c5C|)j@#C+WS~x(jll9LECY+V-AHbRA#eZ}P7ma`e(=m0S z+#~96;2QLveEN-lcEKMG!Ge(n!oVGu7yq$?3s?c8u?zez1yH~y6kyj*2cvr$0rng0 z|K. - */ - -const { getDefaultConfig } = require("expo/metro-config"); -const path = require("node:path"); - -const projectRoot = __dirname; -const defaultConfig = getDefaultConfig(projectRoot); - -function addMonorepoSupport(config) { - const workspaceRoot = path.resolve(projectRoot, "../.."); - - return { - ...config, - watchFolders: [...config.watchFolders, workspaceRoot], - resolver: { - ...config.resolver, - nodeModulesPaths: [ - ...config.resolver.nodeModulesPaths, - path.resolve(projectRoot, "node_modules"), - path.resolve(workspaceRoot, "node_modules"), - ], - disableHierarchicalLookup: true, - }, - }; -} - -function addSvgTransformer(config) { - return { - ...config, - transformer: { - ...config.transformer, - babelTransformerPath: require.resolve("react-native-svg-transformer"), - }, - resolver: { - ...config.resolver, - assetExts: config.resolver.assetExts.filter((ext) => ext !== "svg"), - sourceExts: [...config.resolver.sourceExts, "svg"], - }, - }; -} - -module.exports = addMonorepoSupport( - addSvgTransformer({ - ...defaultConfig, - resolver: { - ...defaultConfig.resolver, - requireCycleIgnorePatterns: [...defaultConfig.resolver.requireCycleIgnorePatterns, /.*/], - }, - }), -); diff --git a/front/apps/mobile/tsconfig.json b/front/apps/mobile/tsconfig.json deleted file mode 100644 index 9eeb5906..00000000 --- a/front/apps/mobile/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "expo/tsconfig.base", - "compilerOptions": { - "strict": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "../../packages/ui/src/i18n-d.d.ts", - "../../packages/ui/src/svg.d.ts" - ] -} diff --git a/front/apps/web/next.config.js b/front/apps/web/next.config.js deleted file mode 100755 index 12d4c490..00000000 --- a/front/apps/web/next.config.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -const path = require("node:path"); -const CopyPlugin = require("copy-webpack-plugin"); -const DefinePlugin = require("webpack").DefinePlugin; - -const suboctopus = path.resolve(path.dirname(require.resolve("jassub")), "../dist"); - -/** - * @type {import("next").NextConfig} - */ -const nextConfig = { - swcMinify: true, - // can't be true since we would run hls cleanup twice and run on race conditions - reactStrictMode: false, - output: "standalone", - webpack: (config) => { - config.plugins = [ - ...config.plugins, - new CopyPlugin({ - patterns: [ - { - context: suboctopus, - from: "*", - filter: (filepath) => !filepath.endsWith(".es.js"), - to: "static/chunks/", - }, - ], - }), - ]; - config.resolve = { - ...config.resolve, - alias: { - ...config.resolve.alias, - "react-native$": "react-native-web", - // "react-native/Libraries/Image/AssetRegistry$": - // "react-native-web/dist/modules/AssetRegistry", - "react-native/Libraries/EventEmitter/RCTDeviceEventEmitter$": - "react-native-web/dist/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter", - "react-native/Libraries/vendor/emitter/EventEmitter$": - "react-native-web/dist/vendor/react-native/emitter/EventEmitter", - "react-native/Libraries/EventEmitter/NativeEventEmitter$": - "react-native-web/dist/vendor/react-native/NativeEventEmitter", - }, - extensions: [".web.ts", ".web.tsx", ".web.js", ".web.jsx", ...config.resolve.extensions], - }; - - if (!config.plugins) config.plugins = []; - config.plugins.push( - new DefinePlugin({ - __DEV__: JSON.stringify(process.env.NODE_ENV !== "production"), - }), - ); - - config.module.rules.push({ - test: /\.svg$/i, - issuer: /\.[jt]sx?$/, - use: [ - { - loader: "@svgr/webpack", - options: { - native: true, - svgoConfig: { - plugins: [ - { - name: "removeViewBox", - active: false, - }, - ], - }, - }, - }, - ], - }); - return config; - }, - i18n: { - locales: ["en", "fr"], - defaultLocale: "en", - }, - transpilePackages: [ - "@kyoo/ui", - "@kyoo/primitives", - "@kyoo/models", - "@react-native/assets-registry", - "solito", - "react-native", - "react-native-web", - "react-native-svg", - "react-native-reanimated", - "react-native-mmkv", - "moti", - "yoshiki", - "@expo/vector-icons", - "@expo/html-elements", - "expo-font", - "expo-asset", - "expo-av", - "expo-modules-core", - "expo-linear-gradient", - "expo-image-picker", - ], - experimental: { - outputFileTracingRoot: path.join(__dirname, "../../"), - }, -}; - -if (process.env.NODE_ENV !== "production") { - nextConfig.rewrites = async () => [ - { - source: "/api/:path*", - destination: process.env.KYOO_URL - ? `${process.env.KYOO_URL}/:path*` - : "http://localhost:5000/:path*", - }, - ]; -} - -module.exports = nextConfig; diff --git a/front/apps/web/src/i18n.tsx b/front/apps/web/src/i18n.tsx deleted file mode 100644 index af53fc3a..00000000 --- a/front/apps/web/src/i18n.tsx +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { readCookie } from "@kyoo/models/src/account-internal"; -import i18next, { type InitOptions } from "i18next"; -import type { AppContext, AppInitialProps, AppProps } from "next/app"; -import { type ComponentType, useState } from "react"; -import { I18nextProvider } from "react-i18next"; -import resources from "../../../translations"; - -export const withTranslations = ( - AppToTranslate: ComponentType & { - getInitialProps: (ctx: AppContext) => Promise; - }, -) => { - const i18n = i18next.createInstance(); - const commonOptions: InitOptions = { - interpolation: { - escapeValue: false, - }, - returnEmptyString: false, - fallbackLng: "en", - resources, - }; - - const AppWithTranslations = (props: AppProps) => { - const [li18n] = useState(() => { - if (typeof window === "undefined") return i18n; - i18next.init({ - ...commonOptions, - lng: props.pageProps.__lang, - }); - i18next.systemLanguage = props.pageProps?.__sysLang; - return i18next; - }); - - return ( - - - - ); - }; - AppWithTranslations.getInitialProps = async (ctx: AppContext) => { - const props: AppInitialProps = await AppToTranslate.getInitialProps(ctx); - const sysLng = ctx.router.locale || ctx.router.defaultLocale || "en"; - const lng = readCookie(ctx.ctx.req?.headers.cookie, "language") || sysLng; - await i18n.init({ - ...commonOptions, - lng, - }); - i18n.systemLanguage = sysLng; - props.pageProps ??= {}; - props.pageProps.__lang = lng; - props.pageProps.__sysLang = sysLng; - return props; - }; - - return AppWithTranslations; -}; diff --git a/front/apps/web/src/pages/_app.tsx b/front/apps/web/src/pages/_app.tsx deleted file mode 100755 index fd330e51..00000000 --- a/front/apps/web/src/pages/_app.tsx +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import "../polyfill"; - -import { PortalProvider } from "@gorhom/portal"; -import { - AccountP, - AccountProvider, - ConnectionErrorContext, - type QueryIdentifier, - type QueryPage, - type ServerInfo, - ServerInfoP, - SetupStep, - UserP, - createQueryClient, - fetchQuery, - getTokenWJ, - setSsrApiUrl, - useFetch, - useUserTheme, -} from "@kyoo/models"; -import { getCurrentAccount, readCookie, updateAccount } from "@kyoo/models/src/account-internal"; -import { - HiddenIfNoJs, - SkeletonCss, - SnackbarProvider, - ThemeSelector, - TouchOnlyCss, -} from "@kyoo/primitives"; -import { WebTooltip } from "@kyoo/primitives/src/tooltip.web"; -import { ConnectionError } from "@kyoo/ui"; -import { HydrationBoundary, QueryClientProvider, dehydrate } from "@tanstack/react-query"; -import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; -import arrayShuffle from "array-shuffle"; -import NextApp, { type AppContext, type AppProps } from "next/app"; -import { Poppins } from "next/font/google"; -import Head from "next/head"; -import { type NextRouter, useRouter } from "next/router"; -import { type ComponentType, useContext, useEffect, useState } from "react"; -import { Tooltip } from "react-tooltip"; -import superjson from "superjson"; -import { StyleRegistryProvider, useMobileHover, useStyleRegistry, useTheme } from "yoshiki/web"; -import { withTranslations } from "../i18n"; - -const font = Poppins({ weight: ["300", "400", "900"], subsets: ["latin"], display: "swap" }); - -const YoshikiDebug = ({ children }: { children: JSX.Element }) => { - if (typeof window === "undefined") return children; - const registry = useStyleRegistry(); - return {children}; -}; - -const ConnectionErrorVerifier = ({ - children, - skipErrors, -}: { - children: JSX.Element; - skipErrors?: boolean; -}) => { - const { error } = useContext(ConnectionErrorContext); - - if (!error || skipErrors) return children; - return ; -}; - -const SetupChecker = () => { - const { data } = useFetch({ path: ["info"], parser: ServerInfoP }); - const router = useRouter(); - - const step = data?.setupStatus; - - useEffect(() => { - if (!step) return; - if (step !== SetupStep.Done && !SetupChecker.isRouteAllowed(router, step)) - router.push(`/setup?step=${step}`); - if (step === SetupStep.Done && router.route === "/setup") router.replace("/"); - }, [router.route, step, router]); - - return null; -}; - -SetupChecker.isRouteAllowed = (router: NextRouter, step: SetupStep) => - (router.route === "/setup" && router.query.step === step) || - router.route === "/register" || - router.route.startsWith("/login") || - router.route === "/settings"; - -const WithLayout = ({ Component, ...props }: { Component: ComponentType }) => { - const layoutInfo = (Component as QueryPage).getLayout ?? (({ page }) => page); - const { Layout, props: layoutProps } = - typeof layoutInfo === "function" ? { Layout: layoutInfo, props: {} } : layoutInfo; - return } randomItems={[]} {...layoutProps} />; -}; - -const App = ({ Component, pageProps }: AppProps) => { - const [queryClient] = useState(() => createQueryClient()); - const { queryState, ssrError, token, randomItems, account, theme, ...props } = - superjson.deserialize(pageProps ?? { json: {} }); - const userTheme = useUserTheme(theme); - useMobileHover(); - - // Set the auth from the server (if the token was refreshed during SSR). - if (typeof window !== "undefined" && token) { - const account = getCurrentAccount(); - if (account) updateAccount(account.id, { ...account, token }); - } - - return ( - - <> - - Kyoo - - - - - - - - - - - - - - - - - - - - - - - - ); -}; - -App.getInitialProps = async (ctx: AppContext) => { - const appProps = await NextApp.getInitialProps(ctx); - const Component = ctx.Component as QueryPage; - - const items = arrayShuffle(Component.randomItems ?? []); - appProps.pageProps.randomItems = { - [Component.displayName!]: items, - }; - - if (typeof window !== "undefined") return { pageProps: superjson.serialize(appProps.pageProps) }; - - try { - const getUrl = Component.getFetchUrls; - const getLayoutUrl = - Component.getLayout && "Layout" in Component.getLayout - ? Component.getLayout.Layout.getFetchUrls - : Component.getLayout?.getFetchUrls; - const urls: QueryIdentifier[] = [ - ...(getUrl ? getUrl(ctx.router.query as any, items) : []), - ...(getLayoutUrl ? getLayoutUrl(ctx.router.query as any, items) : []), - // always include server info for guest permissions. - { path: ["info"], parser: ServerInfoP }, - ]; - - setSsrApiUrl(); - - appProps.pageProps.theme = readCookie(ctx.ctx.req?.headers.cookie, "theme") ?? "auto"; - - const account = readCookie(ctx.ctx.req?.headers.cookie, "account", AccountP); - if (account) urls.push({ path: ["auth", "me"], parser: UserP }); - const [authToken, token, error] = await getTokenWJ(account); - if (error) appProps.pageProps.ssrError = error; - const client = (await fetchQuery(urls, authToken))!; - appProps.pageProps.queryState = dehydrate(client); - if (account) { - appProps.pageProps.token = token; - appProps.pageProps.account = { - ...client.getQueryData(["auth", "me"]), - ...account, - }; - } - - const info = client.getQueryData(["info"]); - if ( - info!.setupStatus !== SetupStep.Done && - !SetupChecker.isRouteAllowed(ctx.router, info!.setupStatus) - ) { - ctx.ctx.res!.writeHead(307, { Location: `/setup?step=${info!.setupStatus}` }); - ctx.ctx.res!.end(); - return { pageProps: {} }; - } - if (info!.setupStatus === SetupStep.Done && ctx.router.route === "/setup") { - ctx.ctx.res!.writeHead(307, { Location: "/" }); - ctx.ctx.res!.end(); - return { pageProps: {} }; - } - } catch (e) { - console.error("SSR error, disabling it."); - } - return { pageProps: superjson.serialize(appProps.pageProps) }; -}; - -export default withTranslations(App); diff --git a/front/apps/web/src/pages/_document.tsx b/front/apps/web/src/pages/_document.tsx deleted file mode 100644 index 7583f1dd..00000000 --- a/front/apps/web/src/pages/_document.tsx +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { type DocumentContext, Head, Html, Main, NextScript } from "next/document"; -import { AppRegistry } from "react-native"; -import { StyleRegistryProvider, createStyleRegistry } from "yoshiki/web"; - -export const style = ` -/** - * Building on the RNWeb reset: - * https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/StyleSheet/initialRules.js - */ -html, body, #__next { - width: 100%; - /* To smooth any scrolling behavior */ - -webkit-overflow-scrolling: touch; - margin: 0px; - padding: 0px; - /* Allows content to fill the viewport and go beyond the bottom */ - min-height: 100%; -} -#__next { - flex-shrink: 0; - flex-basis: auto; - flex-direction: column; - flex-grow: 1; - display: flex; - flex: 1; - overflow: hidden; -} -html { - scroll-behavior: smooth; - /* Prevent text size change on orientation change https://gist.github.com/tfausak/2222823#file-ios-8-web-app-html-L138 */ - -webkit-text-size-adjust: 100%; - height: 100%; -} -body { - display: flex; - /* Allows you to scroll below the viewport; default value is visible */ - overflow-y: auto; - overscroll-behavior-y: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -ms-overflow-style: scrollbar; -} -`; - -const Document = () => { - return ( - - - - - - - - - -
- - - - ); -}; - -Document.getInitialProps = async (ctx: DocumentContext) => { - const renderPage = ctx.renderPage; - const registry = createStyleRegistry(); - - ctx.renderPage = () => - renderPage({ - enhanceApp: (App) => (props) => { - return ( - - - - ); - }, - }); - - const props = await ctx.defaultGetInitialProps(ctx); - - AppRegistry.registerComponent("Main", () => Main); - // @ts-ignore React native web missing type. - const { getStyleElement } = AppRegistry.getApplication("Main"); - const page = await ctx.renderPage(); - - return { - ...props, - ...page, - styles: ( - <> - {props.styles} - {page.styles} - - {getStyleElement()} - {registry.flushToComponent()} - - ), - }; -}; -export default Document; diff --git a/front/apps/web/src/pages/admin/index.tsx b/front/apps/web/src/pages/admin/index.tsx deleted file mode 100644 index 829344ec..00000000 --- a/front/apps/web/src/pages/admin/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { AdminPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(AdminPage); diff --git a/front/apps/web/src/pages/browse/index.tsx b/front/apps/web/src/pages/browse/index.tsx deleted file mode 100644 index e756ef4e..00000000 --- a/front/apps/web/src/pages/browse/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { BrowsePage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(BrowsePage); diff --git a/front/apps/web/src/pages/collection/[slug]/index.tsx b/front/apps/web/src/pages/collection/[slug]/index.tsx deleted file mode 100644 index afc0749b..00000000 --- a/front/apps/web/src/pages/collection/[slug]/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { CollectionPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(CollectionPage); diff --git a/front/apps/web/src/pages/index.tsx b/front/apps/web/src/pages/index.tsx deleted file mode 100755 index ecef0601..00000000 --- a/front/apps/web/src/pages/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { HomePage } from "@kyoo/ui"; - -export default HomePage; diff --git a/front/apps/web/src/pages/login/callback.tsx b/front/apps/web/src/pages/login/callback.tsx deleted file mode 100644 index 9735f32e..00000000 --- a/front/apps/web/src/pages/login/callback.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { OidcCallbackPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(OidcCallbackPage); diff --git a/front/apps/web/src/pages/login/index.tsx b/front/apps/web/src/pages/login/index.tsx deleted file mode 100644 index 8bc2c179..00000000 --- a/front/apps/web/src/pages/login/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { LoginPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(LoginPage); diff --git a/front/apps/web/src/pages/movie/[slug]/index.tsx b/front/apps/web/src/pages/movie/[slug]/index.tsx deleted file mode 100644 index 157b1ace..00000000 --- a/front/apps/web/src/pages/movie/[slug]/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { MovieDetails } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(MovieDetails); diff --git a/front/apps/web/src/pages/movie/[slug]/watch.tsx b/front/apps/web/src/pages/movie/[slug]/watch.tsx deleted file mode 100644 index 17349725..00000000 --- a/front/apps/web/src/pages/movie/[slug]/watch.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { Player } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(Player, { type: "movie" }); diff --git a/front/apps/web/src/pages/register/index.tsx b/front/apps/web/src/pages/register/index.tsx deleted file mode 100644 index 0558bfc1..00000000 --- a/front/apps/web/src/pages/register/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { RegisterPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(RegisterPage); diff --git a/front/apps/web/src/pages/search/index.tsx b/front/apps/web/src/pages/search/index.tsx deleted file mode 100644 index b85ad55d..00000000 --- a/front/apps/web/src/pages/search/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { SearchPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(SearchPage); diff --git a/front/apps/web/src/pages/settings/index.tsx b/front/apps/web/src/pages/settings/index.tsx deleted file mode 100644 index 22fe9369..00000000 --- a/front/apps/web/src/pages/settings/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { SettingsPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(SettingsPage); diff --git a/front/apps/web/src/pages/setup/index.tsx b/front/apps/web/src/pages/setup/index.tsx deleted file mode 100644 index 022e242e..00000000 --- a/front/apps/web/src/pages/setup/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { SetupPage } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(SetupPage); diff --git a/front/apps/web/src/pages/show/[slug].tsx b/front/apps/web/src/pages/show/[slug].tsx deleted file mode 100644 index 7d5aca9b..00000000 --- a/front/apps/web/src/pages/show/[slug].tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { ShowDetails } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(ShowDetails); diff --git a/front/apps/web/src/pages/watch/[slug].tsx b/front/apps/web/src/pages/watch/[slug].tsx deleted file mode 100644 index a26ad2ca..00000000 --- a/front/apps/web/src/pages/watch/[slug].tsx +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { Player } from "@kyoo/ui"; -import { withRoute } from "~/router"; - -export default withRoute(Player, { type: "episode" }); diff --git a/front/apps/web/src/polyfill.ts b/front/apps/web/src/polyfill.ts deleted file mode 100644 index a1b77565..00000000 --- a/front/apps/web/src/polyfill.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -// import "raf/polyfill"; -// import "setimmediate"; -// import "react-native-reanimated"; -import React from "react"; - -// // FIXME need reanimated update, see https://github.com/software-mansion/react-native-reanimated/issues/3355 -// if (typeof window !== "undefined") { -// // @ts-ignore -// window._frameTimestamp = null; -// } -// Simply silence a SSR warning (see https://github.com/facebook/react/issues/14927 for more details) -if (typeof window === "undefined") { - React.useLayoutEffect = React.useEffect; -} diff --git a/front/apps/web/src/router.tsx b/front/apps/web/src/router.tsx deleted file mode 100644 index dee9eb60..00000000 --- a/front/apps/web/src/router.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { type QueryPage, useHasPermission } from "@kyoo/models"; -import { Unauthorized } from "@kyoo/ui"; -import { useRouter } from "next/router"; -import type { ComponentType } from "react"; - -export const withRoute = ( - Component: ComponentType, - defaultProps?: Partial, -) => { - const WithUseRoute = (props: Props) => { - const router = useRouter(); - const hasPermissions = useHasPermission((Component as QueryPage).requiredPermissions ?? []); - - if (!hasPermissions) - return ; - return ; - }; - - const { ...all } = Component; - Object.assign(WithUseRoute, { ...all }); - if ("getFetchUrls" in Component) { - const oldGet = Component.getFetchUrls as (obj: object) => object; - WithUseRoute.getFetchUrls = (props: object) => oldGet({ ...defaultProps, ...props }); - } - - return WithUseRoute; -}; diff --git a/front/apps/web/tsconfig.json b/front/apps/web/tsconfig.json deleted file mode 100755 index 7ac1302d..00000000 --- a/front/apps/web/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "baseUrl": ".", - "paths": { - "~/*": ["src/*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../packages/ui/src/i18n-d.d.ts"], - "exclude": ["node_modules"] -} diff --git a/front/packages/ui/src/search/index.tsx b/front/packages/ui/src/search/index.tsx deleted file mode 100644 index fd1283cc..00000000 --- a/front/packages/ui/src/search/index.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Kyoo - A portable and vast media library solution. - * Copyright (c) Kyoo. - * - * See AUTHORS.md and LICENSE file in the project root for full license information. - * - * Kyoo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * Kyoo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kyoo. If not, see . - */ - -import { type LibraryItem, LibraryItemP, type QueryIdentifier, type QueryPage } from "@kyoo/models"; -import { usePageStyle } from "@kyoo/primitives"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { createParam } from "solito"; -import { createFilterString, getMediaTypeFromParam, itemMap } from "../browse"; -import { ItemGrid } from "../browse/grid"; -import { BrowseSettings } from "../browse/header"; -import { ItemList } from "../browse/list"; -import { Layout, type MediaType, MediaTypes, SearchSort, SortOrd } from "../browse/types"; -import { InfiniteFetch } from "../fetch-infinite"; -import { DefaultLayout } from "../layout"; - -const { useParam } = createParam<{ sortBy?: string; mediaType?: string }>(); - -const query = ( - mediaType: MediaType, - query?: string, - sortKey?: SearchSort, - sortOrd?: SortOrd, -): QueryIdentifier => ({ - parser: LibraryItemP, - path: ["search", "items"], - infinite: true, - params: { - q: query, - filter: createFilterString(mediaType), - sortBy: - sortKey && sortKey !== SearchSort.Relevance ? `${sortKey}:${sortOrd ?? "asc"}` : undefined, - }, -}); - -export const SearchPage: QueryPage<{ q?: string }> = ({ q }) => { - const pageStyle = usePageStyle(); - const { t } = useTranslation(); - const [sort, setSort] = useParam("sortBy"); - const [mediaTypeParam, setMediaTypeParam] = useParam("mediaType"); - const sortKey = (sort?.split(":")[0] as SearchSort) || SearchSort.Relevance; - const sortOrd = (sort?.split(":")[1] as SortOrd) || SortOrd.Asc; - const [layout, setLayout] = useState(Layout.Grid); - - const mediaType = getMediaTypeFromParam(mediaTypeParam); - const LayoutComponent = layout === Layout.Grid ? ItemGrid : ItemList; - - return ( - { - setSort(`${key}:${ord}`); - }} - mediaType={mediaType} - availableMediaTypes={MediaTypes} - setMediaType={(mediaType) => { - setMediaTypeParam(mediaType.key); - }} - layout={layout} - setLayout={setLayout} - /> - } - contentContainerStyle={pageStyle} - Render={({ item }) => } - Loader={LayoutComponent.Loader} - /> - ); -}; - -SearchPage.getLayout = DefaultLayout; -SearchPage.getFetchUrls = ({ q, sortBy, mediaType }) => { - const mediaTypeObj = getMediaTypeFromParam(mediaType); - return [ - query(mediaTypeObj, q, sortBy?.split("-")[0] as SearchSort, sortBy?.split("-")[1] as SortOrd), - ]; -};