diff --git a/frontend/src/components/admin/configuration/ConfigurationHeader.tsx b/frontend/src/components/admin/configuration/ConfigurationHeader.tsx index a78dce1..8bb6caa 100644 --- a/frontend/src/components/admin/configuration/ConfigurationHeader.tsx +++ b/frontend/src/components/admin/configuration/ConfigurationHeader.tsx @@ -42,7 +42,7 @@ const ConfigurationHeader = ({ - diff --git a/frontend/src/components/admin/configuration/ConfigurationNavBar.tsx b/frontend/src/components/admin/configuration/ConfigurationNavBar.tsx index 9df1a19..dfd21ec 100644 --- a/frontend/src/components/admin/configuration/ConfigurationNavBar.tsx +++ b/frontend/src/components/admin/configuration/ConfigurationNavBar.tsx @@ -13,6 +13,7 @@ import Link from "next/link"; import { Dispatch, SetStateAction } from "react"; import { TbAt, TbMail, TbShare, TbSocial, TbSquare } from "react-icons/tb"; import { FormattedMessage } from "react-intl"; +import useConfig from "../../../hooks/config.hook"; const categories = [ { name: "General", icon: }, @@ -46,6 +47,7 @@ const ConfigurationNavBar = ({ setIsMobileNavBarOpened: Dispatch>; }) => { const { classes } = useStyles(); + const config = useConfig(); return ( - diff --git a/frontend/src/components/auth/SignInForm.tsx b/frontend/src/components/auth/SignInForm.tsx index e5bd96b..98394d7 100644 --- a/frontend/src/components/auth/SignInForm.tsx +++ b/frontend/src/components/auth/SignInForm.tsx @@ -145,7 +145,7 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => { /> {config.get("smtp.enabled") && ( - + diff --git a/frontend/src/components/header/ActionAvatar.tsx b/frontend/src/components/header/ActionAvatar.tsx index 414c5a0..818032e 100644 --- a/frontend/src/components/header/ActionAvatar.tsx +++ b/frontend/src/components/header/ActionAvatar.tsx @@ -4,9 +4,11 @@ import { TbDoorExit, TbSettings, TbUser } from "react-icons/tb"; import useUser from "../../hooks/user.hook"; import authService from "../../services/auth.service"; import { FormattedMessage, useIntl } from "react-intl"; +import useConfig from "../../hooks/config.hook"; const ActionAvatar = () => { const { user } = useUser(); + const config = useConfig(); return ( @@ -16,13 +18,13 @@ const ActionAvatar = () => { - }> + }> {user!.isAdmin && ( } > diff --git a/frontend/src/components/header/Header.tsx b/frontend/src/components/header/Header.tsx index d633104..2271ac3 100644 --- a/frontend/src/components/header/Header.tsx +++ b/frontend/src/components/header/Header.tsx @@ -125,7 +125,7 @@ const Header = () => { const authenticatedLinks: NavLink[] = [ { - link: "/upload", + link: config.get("general.appUrl") + "/upload", label: t("navbar.upload"), }, { @@ -138,27 +138,27 @@ const Header = () => { let unauthenticatedLinks: NavLink[] = [ { - link: "/auth/signIn", + link: config.get("general.appUrl") + "/auth/signIn", label: t("navbar.signin"), }, ]; if (config.get("share.allowUnauthenticatedShares")) { unauthenticatedLinks.unshift({ - link: "/upload", + link: config.get("general.appUrl") + "/upload", label: t("navbar.upload"), }); } if (config.get("general.showHomePage")) unauthenticatedLinks.unshift({ - link: "/", + link: config.get("general.appUrl") + "/", label: t("navbar.home"), }); if (config.get("share.allowRegistration")) unauthenticatedLinks.push({ - link: "/auth/signUp", + link: config.get("general.appUrl") + "/auth/signUp", label: t("navbar.signup"), }); @@ -191,7 +191,7 @@ const Header = () => { return ( - + {config.get("general.appName")} diff --git a/frontend/src/components/header/NavbarShareMenu.tsx b/frontend/src/components/header/NavbarShareMenu.tsx index 56775dc..2ba8153 100644 --- a/frontend/src/components/header/NavbarShareMenu.tsx +++ b/frontend/src/components/header/NavbarShareMenu.tsx @@ -2,8 +2,10 @@ import { ActionIcon, Menu } from "@mantine/core"; import Link from "next/link"; import { TbArrowLoopLeft, TbLink } from "react-icons/tb"; import { FormattedMessage } from "react-intl"; +import useConfig from "../../hooks/config.hook"; const NavbarShareMneu = () => { + const config = useConfig(); return ( @@ -12,12 +14,12 @@ const NavbarShareMneu = () => { - }> + }> } > diff --git a/frontend/src/components/share/FilePreview.tsx b/frontend/src/components/share/FilePreview.tsx index 71606ff..0d06f9c 100644 --- a/frontend/src/components/share/FilePreview.tsx +++ b/frontend/src/components/share/FilePreview.tsx @@ -12,6 +12,7 @@ import React, { Dispatch, SetStateAction, useEffect, useState } from "react"; import { FormattedMessage } from "react-intl"; import api from "../../services/api.service"; import Markdown from "markdown-to-jsx"; +import useConfig from "../../hooks/config.hook"; const FilePreviewContext = React.createContext<{ shareId: string; @@ -36,7 +37,7 @@ const FilePreview = ({ }) => { const [isNotSupported, setIsNotSupported] = useState(false); if (isNotSupported) return ; - + const config = useConfig(); return ( modals.closeAll()} target="_blank" - href={`/api/shares/${shareId}/files/${fileId}?download=false`} + href={`${config.get("general.appUrl")}/api/shares/${shareId}/files/${fileId}?download=false`} > View original file {/* Add translation? */} diff --git a/frontend/src/pages/404.tsx b/frontend/src/pages/404.tsx index 99a50aa..ebd5cc8 100644 --- a/frontend/src/pages/404.tsx +++ b/frontend/src/pages/404.tsx @@ -9,6 +9,7 @@ import { import Link from "next/link"; import Meta from "../components/Meta"; import { FormattedMessage } from "react-intl"; +import useConfig from "../hooks/config.hook"; const useStyles = createStyles((theme) => ({ root: { @@ -38,7 +39,7 @@ const useStyles = createStyles((theme) => ({ const ErrorNotFound = () => { const { classes } = useStyles(); - + const config = useConfig(); return ( <> @@ -53,7 +54,7 @@ const ErrorNotFound = () => { className={classes.description} > - diff --git a/frontend/src/pages/account/shares.tsx b/frontend/src/pages/account/shares.tsx index 9edb228..7c0b3ea 100644 --- a/frontend/src/pages/account/shares.tsx +++ b/frontend/src/pages/account/shares.tsx @@ -58,7 +58,7 @@ const MyShares = () => { - diff --git a/frontend/src/pages/admin/intro.tsx b/frontend/src/pages/admin/intro.tsx index 59833fd..79b3d6d 100644 --- a/frontend/src/pages/admin/intro.tsx +++ b/frontend/src/pages/admin/intro.tsx @@ -10,8 +10,10 @@ import { import Link from "next/link"; import Logo from "../../components/Logo"; import Meta from "../../components/Meta"; +import useConfig from "../../hooks/config.hook"; const Intro = () => { + const config = useConfig(); return ( <> @@ -43,10 +45,10 @@ const Intro = () => { Enough talked, have fun with Pingvin Share! How to you want to continue? - - diff --git a/frontend/src/pages/auth/resetPassword/index.tsx b/frontend/src/pages/auth/resetPassword/index.tsx index 2ac8e08..4062ca6 100644 --- a/frontend/src/pages/auth/resetPassword/index.tsx +++ b/frontend/src/pages/auth/resetPassword/index.tsx @@ -20,6 +20,7 @@ import * as yup from "yup"; import useTranslate from "../../../hooks/useTranslate.hook"; import authService from "../../../services/auth.service"; import toast from "../../../utils/toast.util"; +import useConfig from "../../../hooks/config.hook"; const useStyles = createStyles((theme) => ({ title: { @@ -61,6 +62,7 @@ const ResetPassword = () => { ), }); + const config = useConfig(); return ( @@ -93,7 +95,7 @@ const ResetPassword = () => { color="dimmed" size="sm" className={classes.control} - href={"/auth/signIn"} + href={config.get("general.appUrl") + "/auth/signIn"} > <Center inline> <TbArrowLeft size={12} /> diff --git a/frontend/src/pages/index.tsx b/frontend/src/pages/index.tsx index 227fad7..d9e7c7c 100644 --- a/frontend/src/pages/index.tsx +++ b/frontend/src/pages/index.tsx @@ -16,6 +16,7 @@ import { FormattedMessage } from "react-intl"; import Logo from "../components/Logo"; import Meta from "../components/Meta"; import useUser from "../hooks/user.hook"; +import useConfig from "../hooks/config.hook"; const useStyles = createStyles((theme) => ({ inner: { @@ -73,12 +74,13 @@ export default function Home() { const { classes } = useStyles(); const { refreshUser } = useUser(); const router = useRouter(); + const config = useConfig(); // If the user is already logged in, redirect to the upload page useEffect(() => { refreshUser().then((user) => { if (user) { - router.replace("/upload"); + router.replace(config.get("general.appUrl") + "/upload"); } }); }, []); @@ -142,7 +144,7 @@ export default function Home() { <Group mt={30}> <Button component={Link} - href="/auth/signUp" + href={config.get("general.appUrl") + "/auth/signUp"} radius="xl" size="md" className={classes.control}