appUrl prefix
This commit is contained in:
parent
6d87e20e29
commit
8a5849dedb
|
@ -42,7 +42,7 @@ const ConfigurationHeader = ({
|
|||
</Group>
|
||||
</Link>
|
||||
<MediaQuery smallerThan="sm" styles={{ display: "none" }}>
|
||||
<Button variant="light" component={Link} href="/admin">
|
||||
<Button variant="light" component={Link} href={config.get("general.appUrl") + "/admin"}>
|
||||
<FormattedMessage id="common.button.go-back" />
|
||||
</Button>
|
||||
</MediaQuery>
|
||||
|
|
|
@ -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: <TbSquare /> },
|
||||
|
@ -46,6 +47,7 @@ const ConfigurationNavBar = ({
|
|||
setIsMobileNavBarOpened: Dispatch<SetStateAction<boolean>>;
|
||||
}) => {
|
||||
const { classes } = useStyles();
|
||||
const config = useConfig();
|
||||
return (
|
||||
<Navbar
|
||||
p="md"
|
||||
|
@ -69,7 +71,7 @@ const ConfigurationNavBar = ({
|
|||
: undefined
|
||||
}
|
||||
key={category.name}
|
||||
href={`/admin/config/${category.name.toLowerCase()}`}
|
||||
href={`${config.get("general.appUrl")}/admin/config/${category.name.toLowerCase()}`}
|
||||
>
|
||||
<Group>
|
||||
<ThemeIcon
|
||||
|
@ -92,7 +94,7 @@ const ConfigurationNavBar = ({
|
|||
</Stack>
|
||||
</Navbar.Section>
|
||||
<MediaQuery largerThan="sm" styles={{ display: "none" }}>
|
||||
<Button mt="xl" variant="light" component={Link} href="/admin">
|
||||
<Button mt="xl" variant="light" component={Link} href={webroot + "/admin"}>
|
||||
<FormattedMessage id="common.button.go-back" />
|
||||
</Button>
|
||||
</MediaQuery>
|
||||
|
|
|
@ -145,7 +145,7 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => {
|
|||
/>
|
||||
{config.get("smtp.enabled") && (
|
||||
<Group position="right" mt="xs">
|
||||
<Anchor component={Link} href="/auth/resetPassword" size="xs">
|
||||
<Anchor component={Link} href={config.get("general.appUrl") + "/auth/resetPassword"} size="xs">
|
||||
<FormattedMessage id="resetPassword.title" />
|
||||
</Anchor>
|
||||
</Group>
|
||||
|
|
|
@ -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 (
|
||||
<Menu position="bottom-start" withinPortal>
|
||||
|
@ -16,13 +18,13 @@ const ActionAvatar = () => {
|
|||
</ActionIcon>
|
||||
</Menu.Target>
|
||||
<Menu.Dropdown>
|
||||
<Menu.Item component={Link} href="/account" icon={<TbUser size={14} />}>
|
||||
<Menu.Item component={Link} href={config.get("general.appUrl") + "/account"} icon={<TbUser size={14} />}>
|
||||
<FormattedMessage id="navbar.avatar.account" />
|
||||
</Menu.Item>
|
||||
{user!.isAdmin && (
|
||||
<Menu.Item
|
||||
component={Link}
|
||||
href="/admin"
|
||||
href={config.get("general.appUrl") + "/admin"}
|
||||
icon={<TbSettings size={14} />}
|
||||
>
|
||||
<FormattedMessage id="navbar.avatar.admin" />
|
||||
|
|
|
@ -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 (
|
||||
<MantineHeader height={HEADER_HEIGHT} mb={40} className={classes.root}>
|
||||
<Container className={classes.header}>
|
||||
<Link href="/" passHref>
|
||||
<Link href={config.get("general.appUrl")+"/"} passHref>
|
||||
<Group>
|
||||
<Logo height={35} width={35} />
|
||||
<Text weight={600}>{config.get("general.appName")}</Text>
|
||||
|
|
|
@ -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 (
|
||||
<Menu position="bottom-start" withinPortal>
|
||||
<Menu.Target>
|
||||
|
@ -12,12 +14,12 @@ const NavbarShareMneu = () => {
|
|||
</ActionIcon>
|
||||
</Menu.Target>
|
||||
<Menu.Dropdown>
|
||||
<Menu.Item component={Link} href="/account/shares" icon={<TbLink />}>
|
||||
<Menu.Item component={Link} href={config.get("general.appUrl") + "/account/shares"} icon={<TbLink />}>
|
||||
<FormattedMessage id="navbar.links.shares" />
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
component={Link}
|
||||
href="/account/reverseShares"
|
||||
href={config.get("general.appUrl") + "/account/reverseShares"}
|
||||
icon={<TbArrowLoopLeft />}
|
||||
>
|
||||
<FormattedMessage id="navbar.links.reverse" />
|
||||
|
|
|
@ -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 <UnSupportedFile />;
|
||||
|
||||
const config = useConfig();
|
||||
return (
|
||||
<Stack>
|
||||
<FilePreviewContext.Provider
|
||||
|
@ -49,7 +50,7 @@ const FilePreview = ({
|
|||
component={Link}
|
||||
onClick={() => 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? */}
|
||||
|
|
|
@ -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 (
|
||||
<>
|
||||
<Meta title="Not found" />
|
||||
|
@ -53,7 +54,7 @@ const ErrorNotFound = () => {
|
|||
className={classes.description}
|
||||
></Text>
|
||||
<Group position="center">
|
||||
<Button component={Link} href="/" variant="light">
|
||||
<Button component={Link} href={config.get("general.appUrl") + "/"} variant="light">
|
||||
<FormattedMessage id="404.button.home" />
|
||||
</Button>
|
||||
</Group>
|
||||
|
|
|
@ -58,7 +58,7 @@ const MyShares = () => {
|
|||
<FormattedMessage id="account.shares.description.empty" />
|
||||
</Text>
|
||||
<Space h={5} />
|
||||
<Button component={Link} href="/upload" variant="light">
|
||||
<Button component={Link} href={config.get("general.appUrl") + "/upload"} variant="light">
|
||||
<FormattedMessage id="account.shares.button.create" />
|
||||
</Button>
|
||||
</Stack>
|
||||
|
|
|
@ -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 (
|
||||
<>
|
||||
<Meta title="Intro" />
|
||||
|
@ -43,10 +45,10 @@ const Intro = () => {
|
|||
<Text>Enough talked, have fun with Pingvin Share!</Text>
|
||||
<Text mt="lg">How to you want to continue?</Text>
|
||||
<Stack>
|
||||
<Button href="/admin/config/general" component={Link}>
|
||||
<Button href={config.get("general.appUrl") + "/admin/config/general"} component={Link}>
|
||||
Customize configuration
|
||||
</Button>
|
||||
<Button href="/" component={Link} variant="light">
|
||||
<Button href={config.get("general.appUrl") + "/"} component={Link} variant="light">
|
||||
Explore Pingvin Share
|
||||
</Button>
|
||||
</Stack>
|
||||
|
|
|
@ -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 (
|
||||
<Container size={460} my={30}>
|
||||
<Title order={2} weight={900} align="center">
|
||||
|
@ -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} />
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue