Merge 91987eb813
into e71f6cd159
This commit is contained in:
commit
0792f02548
|
@ -12,6 +12,7 @@ const withPWA = require("next-pwa")({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
reloadOnOnline: false,
|
reloadOnOnline: false,
|
||||||
|
pathPrefix: '/pengvin-share',
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = withPWA({
|
module.exports = withPWA({
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const Logo = ({ height, width }: { height: number; width: number }) => {
|
const Logo = ({ height, width }: { height: number; width: number }) => {
|
||||||
return <img src="/img/logo.png" alt="logo" height={height} width={width} />;
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
return <img src={webroot + "/img/logo.png"} alt="logo" height={height} width={width} />;
|
||||||
};
|
};
|
||||||
export default Logo;
|
export default Logo;
|
||||||
|
|
|
@ -13,6 +13,8 @@ import { FormattedMessage } from "react-intl";
|
||||||
import useConfig from "../../../hooks/config.hook";
|
import useConfig from "../../../hooks/config.hook";
|
||||||
import Logo from "../../Logo";
|
import Logo from "../../Logo";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const ConfigurationHeader = ({
|
const ConfigurationHeader = ({
|
||||||
isMobileNavBarOpened,
|
isMobileNavBarOpened,
|
||||||
setIsMobileNavBarOpened,
|
setIsMobileNavBarOpened,
|
||||||
|
@ -42,7 +44,7 @@ const ConfigurationHeader = ({
|
||||||
</Group>
|
</Group>
|
||||||
</Link>
|
</Link>
|
||||||
<MediaQuery smallerThan="sm" styles={{ display: "none" }}>
|
<MediaQuery smallerThan="sm" styles={{ display: "none" }}>
|
||||||
<Button variant="light" component={Link} href="/admin">
|
<Button variant="light" component={Link} href={webroot + "/admin"}>
|
||||||
<FormattedMessage id="common.button.go-back" />
|
<FormattedMessage id="common.button.go-back" />
|
||||||
</Button>
|
</Button>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
|
|
|
@ -14,6 +14,8 @@ import { Dispatch, SetStateAction } from "react";
|
||||||
import { TbAt, TbMail, TbShare, TbSocial, TbSquare } from "react-icons/tb";
|
import { TbAt, TbMail, TbShare, TbSocial, TbSquare } from "react-icons/tb";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const categories = [
|
const categories = [
|
||||||
{ name: "General", icon: <TbSquare /> },
|
{ name: "General", icon: <TbSquare /> },
|
||||||
{ name: "Email", icon: <TbMail /> },
|
{ name: "Email", icon: <TbMail /> },
|
||||||
|
@ -69,7 +71,7 @@ const ConfigurationNavBar = ({
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
key={category.name}
|
key={category.name}
|
||||||
href={`/admin/config/${category.name.toLowerCase()}`}
|
href={`${webroot}/admin/config/${category.name.toLowerCase()}`}
|
||||||
>
|
>
|
||||||
<Group>
|
<Group>
|
||||||
<ThemeIcon
|
<ThemeIcon
|
||||||
|
@ -92,7 +94,7 @@ const ConfigurationNavBar = ({
|
||||||
</Stack>
|
</Stack>
|
||||||
</Navbar.Section>
|
</Navbar.Section>
|
||||||
<MediaQuery largerThan="sm" styles={{ display: "none" }}>
|
<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" />
|
<FormattedMessage id="common.button.go-back" />
|
||||||
</Button>
|
</Button>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
|
|
|
@ -26,6 +26,8 @@ import authService from "../../services/auth.service";
|
||||||
import { getOAuthIcon, getOAuthUrl } from "../../utils/oauth.util";
|
import { getOAuthIcon, getOAuthUrl } from "../../utils/oauth.util";
|
||||||
import toast from "../../utils/toast.util";
|
import toast from "../../utils/toast.util";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const useStyles = createStyles((theme) => ({
|
const useStyles = createStyles((theme) => ({
|
||||||
or: {
|
or: {
|
||||||
"&:before": {
|
"&:before": {
|
||||||
|
@ -145,7 +147,7 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => {
|
||||||
/>
|
/>
|
||||||
{config.get("smtp.enabled") && (
|
{config.get("smtp.enabled") && (
|
||||||
<Group position="right" mt="xs">
|
<Group position="right" mt="xs">
|
||||||
<Anchor component={Link} href="/auth/resetPassword" size="xs">
|
<Anchor component={Link} href={webroot + "/auth/resetPassword"} size="xs">
|
||||||
<FormattedMessage id="resetPassword.title" />
|
<FormattedMessage id="resetPassword.title" />
|
||||||
</Anchor>
|
</Anchor>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
|
@ -19,6 +19,8 @@ import useUser from "../../hooks/user.hook";
|
||||||
import authService from "../../services/auth.service";
|
import authService from "../../services/auth.service";
|
||||||
import toast from "../../utils/toast.util";
|
import toast from "../../utils/toast.util";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const SignUpForm = () => {
|
const SignUpForm = () => {
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -52,9 +54,9 @@ const SignUpForm = () => {
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const user = await refreshUser();
|
const user = await refreshUser();
|
||||||
if (user?.isAdmin) {
|
if (user?.isAdmin) {
|
||||||
router.replace("/admin/intro");
|
router.replace(webroot + "/admin/intro");
|
||||||
} else {
|
} else {
|
||||||
router.replace("/upload");
|
router.replace(webroot + "/upload");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(toast.axiosError);
|
.catch(toast.axiosError);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import useUser from "../../hooks/user.hook";
|
||||||
import authService from "../../services/auth.service";
|
import authService from "../../services/auth.service";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const ActionAvatar = () => {
|
const ActionAvatar = () => {
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
|
||||||
|
@ -16,13 +18,13 @@ const ActionAvatar = () => {
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
<Menu.Dropdown>
|
<Menu.Dropdown>
|
||||||
<Menu.Item component={Link} href="/account" icon={<TbUser size={14} />}>
|
<Menu.Item component={Link} href={webroot + "/account"} icon={<TbUser size={14} />}>
|
||||||
<FormattedMessage id="navbar.avatar.account" />
|
<FormattedMessage id="navbar.avatar.account" />
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
{user!.isAdmin && (
|
{user!.isAdmin && (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
component={Link}
|
component={Link}
|
||||||
href="/admin"
|
href={webroot + "/admin"}
|
||||||
icon={<TbSettings size={14} />}
|
icon={<TbSettings size={14} />}
|
||||||
>
|
>
|
||||||
<FormattedMessage id="navbar.avatar.admin" />
|
<FormattedMessage id="navbar.avatar.admin" />
|
||||||
|
|
|
@ -22,6 +22,7 @@ import ActionAvatar from "./ActionAvatar";
|
||||||
import NavbarShareMenu from "./NavbarShareMenu";
|
import NavbarShareMenu from "./NavbarShareMenu";
|
||||||
|
|
||||||
const HEADER_HEIGHT = 60;
|
const HEADER_HEIGHT = 60;
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
type NavLink = {
|
type NavLink = {
|
||||||
link?: string;
|
link?: string;
|
||||||
|
@ -125,7 +126,7 @@ const Header = () => {
|
||||||
|
|
||||||
const authenticatedLinks: NavLink[] = [
|
const authenticatedLinks: NavLink[] = [
|
||||||
{
|
{
|
||||||
link: "/upload",
|
link: webroot + "/upload",
|
||||||
label: t("navbar.upload"),
|
label: t("navbar.upload"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -138,27 +139,27 @@ const Header = () => {
|
||||||
|
|
||||||
let unauthenticatedLinks: NavLink[] = [
|
let unauthenticatedLinks: NavLink[] = [
|
||||||
{
|
{
|
||||||
link: "/auth/signIn",
|
link: webroot + "/auth/signIn",
|
||||||
label: t("navbar.signin"),
|
label: t("navbar.signin"),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (config.get("share.allowUnauthenticatedShares")) {
|
if (config.get("share.allowUnauthenticatedShares")) {
|
||||||
unauthenticatedLinks.unshift({
|
unauthenticatedLinks.unshift({
|
||||||
link: "/upload",
|
link: webroot + "/upload",
|
||||||
label: t("navbar.upload"),
|
label: t("navbar.upload"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.get("general.showHomePage"))
|
if (config.get("general.showHomePage"))
|
||||||
unauthenticatedLinks.unshift({
|
unauthenticatedLinks.unshift({
|
||||||
link: "/",
|
link: webroot + "/",
|
||||||
label: t("navbar.home"),
|
label: t("navbar.home"),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (config.get("share.allowRegistration"))
|
if (config.get("share.allowRegistration"))
|
||||||
unauthenticatedLinks.push({
|
unauthenticatedLinks.push({
|
||||||
link: "/auth/signUp",
|
link: webroot + "/auth/signUp",
|
||||||
label: t("navbar.signup"),
|
label: t("navbar.signup"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ const Header = () => {
|
||||||
return (
|
return (
|
||||||
<MantineHeader height={HEADER_HEIGHT} mb={40} className={classes.root}>
|
<MantineHeader height={HEADER_HEIGHT} mb={40} className={classes.root}>
|
||||||
<Container className={classes.header}>
|
<Container className={classes.header}>
|
||||||
<Link href="/" passHref>
|
<Link href={webroot + "/"} passHref>
|
||||||
<Group>
|
<Group>
|
||||||
<Logo height={35} width={35} />
|
<Logo height={35} width={35} />
|
||||||
<Text weight={600}>{config.get("general.appName")}</Text>
|
<Text weight={600}>{config.get("general.appName")}</Text>
|
||||||
|
|
|
@ -3,6 +3,8 @@ import Link from "next/link";
|
||||||
import { TbArrowLoopLeft, TbLink } from "react-icons/tb";
|
import { TbArrowLoopLeft, TbLink } from "react-icons/tb";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const NavbarShareMneu = () => {
|
const NavbarShareMneu = () => {
|
||||||
return (
|
return (
|
||||||
<Menu position="bottom-start" withinPortal>
|
<Menu position="bottom-start" withinPortal>
|
||||||
|
@ -12,12 +14,12 @@ const NavbarShareMneu = () => {
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
<Menu.Dropdown>
|
<Menu.Dropdown>
|
||||||
<Menu.Item component={Link} href="/account/shares" icon={<TbLink />}>
|
<Menu.Item component={Link} href={webroot + "/account/shares"} icon={<TbLink />}>
|
||||||
<FormattedMessage id="navbar.links.shares" />
|
<FormattedMessage id="navbar.links.shares" />
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
component={Link}
|
component={Link}
|
||||||
href="/account/reverseShares"
|
href={webroot + "/account/reverseShares"}
|
||||||
icon={<TbArrowLoopLeft />}
|
icon={<TbArrowLoopLeft />}
|
||||||
>
|
>
|
||||||
<FormattedMessage id="navbar.links.reverse" />
|
<FormattedMessage id="navbar.links.reverse" />
|
||||||
|
|
|
@ -13,6 +13,8 @@ import { FormattedMessage } from "react-intl";
|
||||||
import api from "../../services/api.service";
|
import api from "../../services/api.service";
|
||||||
import Markdown from "markdown-to-jsx";
|
import Markdown from "markdown-to-jsx";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const FilePreviewContext = React.createContext<{
|
const FilePreviewContext = React.createContext<{
|
||||||
shareId: string;
|
shareId: string;
|
||||||
fileId: string;
|
fileId: string;
|
||||||
|
@ -49,7 +51,7 @@ const FilePreview = ({
|
||||||
component={Link}
|
component={Link}
|
||||||
onClick={() => modals.closeAll()}
|
onClick={() => modals.closeAll()}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={`/api/shares/${shareId}/files/${fileId}?download=false`}
|
href={`${webroot}/api/shares/${shareId}/files/${fileId}?download=false`}
|
||||||
>
|
>
|
||||||
View original file
|
View original file
|
||||||
{/* Add translation? */}
|
{/* Add translation? */}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import Link from "next/link";
|
||||||
import Meta from "../components/Meta";
|
import Meta from "../components/Meta";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const useStyles = createStyles((theme) => ({
|
const useStyles = createStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
paddingTop: 80,
|
paddingTop: 80,
|
||||||
|
@ -53,7 +55,7 @@ const ErrorNotFound = () => {
|
||||||
className={classes.description}
|
className={classes.description}
|
||||||
></Text>
|
></Text>
|
||||||
<Group position="center">
|
<Group position="center">
|
||||||
<Button component={Link} href="/" variant="light">
|
<Button component={Link} href={webroot + "/"} variant="light">
|
||||||
<FormattedMessage id="404.button.home" />
|
<FormattedMessage id="404.button.home" />
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
|
@ -28,6 +28,8 @@ import shareService from "../../services/share.service";
|
||||||
import { MyShare } from "../../types/share.type";
|
import { MyShare } from "../../types/share.type";
|
||||||
import toast from "../../utils/toast.util";
|
import toast from "../../utils/toast.util";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const MyShares = () => {
|
const MyShares = () => {
|
||||||
const modals = useModals();
|
const modals = useModals();
|
||||||
const clipboard = useClipboard();
|
const clipboard = useClipboard();
|
||||||
|
@ -58,7 +60,7 @@ const MyShares = () => {
|
||||||
<FormattedMessage id="account.shares.description.empty" />
|
<FormattedMessage id="account.shares.description.empty" />
|
||||||
</Text>
|
</Text>
|
||||||
<Space h={5} />
|
<Space h={5} />
|
||||||
<Button component={Link} href="/upload" variant="light">
|
<Button component={Link} href={webroot + "/upload"} variant="light">
|
||||||
<FormattedMessage id="account.shares.button.create" />
|
<FormattedMessage id="account.shares.button.create" />
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
|
@ -11,6 +11,8 @@ import Link from "next/link";
|
||||||
import Logo from "../../components/Logo";
|
import Logo from "../../components/Logo";
|
||||||
import Meta from "../../components/Meta";
|
import Meta from "../../components/Meta";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const Intro = () => {
|
const Intro = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -43,10 +45,10 @@ const Intro = () => {
|
||||||
<Text>Enough talked, have fun with Pingvin Share!</Text>
|
<Text>Enough talked, have fun with Pingvin Share!</Text>
|
||||||
<Text mt="lg">How to you want to continue?</Text>
|
<Text mt="lg">How to you want to continue?</Text>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Button href="/admin/config/general" component={Link}>
|
<Button href={webroot + "/admin/config/general"} component={Link}>
|
||||||
Customize configuration
|
Customize configuration
|
||||||
</Button>
|
</Button>
|
||||||
<Button href="/" component={Link} variant="light">
|
<Button href={webroot + "/"} component={Link} variant="light">
|
||||||
Explore Pingvin Share
|
Explore Pingvin Share
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
|
@ -21,6 +21,8 @@ import useTranslate from "../../../hooks/useTranslate.hook";
|
||||||
import authService from "../../../services/auth.service";
|
import authService from "../../../services/auth.service";
|
||||||
import toast from "../../../utils/toast.util";
|
import toast from "../../../utils/toast.util";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const useStyles = createStyles((theme) => ({
|
const useStyles = createStyles((theme) => ({
|
||||||
title: {
|
title: {
|
||||||
fontSize: 26,
|
fontSize: 26,
|
||||||
|
@ -93,7 +95,7 @@ const ResetPassword = () => {
|
||||||
color="dimmed"
|
color="dimmed"
|
||||||
size="sm"
|
size="sm"
|
||||||
className={classes.control}
|
className={classes.control}
|
||||||
href={"/auth/signIn"}
|
href={webroot + "/auth/signIn"}
|
||||||
>
|
>
|
||||||
<Center inline>
|
<Center inline>
|
||||||
<TbArrowLeft size={12} />
|
<TbArrowLeft size={12} />
|
||||||
|
|
|
@ -7,6 +7,8 @@ import Meta from "../../components/Meta";
|
||||||
import useUser from "../../hooks/user.hook";
|
import useUser from "../../hooks/user.hook";
|
||||||
import useTranslate from "../../hooks/useTranslate.hook";
|
import useTranslate from "../../hooks/useTranslate.hook";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
export function getServerSideProps(context: GetServerSidePropsContext) {
|
export function getServerSideProps(context: GetServerSidePropsContext) {
|
||||||
return {
|
return {
|
||||||
props: { redirectPath: context.query.redirect ?? null },
|
props: { redirectPath: context.query.redirect ?? null },
|
||||||
|
@ -25,7 +27,7 @@ const SignIn = ({ redirectPath }: { redirectPath?: string }) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
refreshUser().then((user) => {
|
refreshUser().then((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
router.replace(redirectPath ?? "/upload");
|
router.replace(redirectPath ?? webroot + "/upload");
|
||||||
} else {
|
} else {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ import Logo from "../components/Logo";
|
||||||
import Meta from "../components/Meta";
|
import Meta from "../components/Meta";
|
||||||
import useUser from "../hooks/user.hook";
|
import useUser from "../hooks/user.hook";
|
||||||
|
|
||||||
|
const webroot = process.env.WEBROOT || "";
|
||||||
|
|
||||||
const useStyles = createStyles((theme) => ({
|
const useStyles = createStyles((theme) => ({
|
||||||
inner: {
|
inner: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
@ -78,7 +80,7 @@ export default function Home() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
refreshUser().then((user) => {
|
refreshUser().then((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
router.replace("/upload");
|
router.replace(webroot + "/upload");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -142,7 +144,7 @@ export default function Home() {
|
||||||
<Group mt={30}>
|
<Group mt={30}>
|
||||||
<Button
|
<Button
|
||||||
component={Link}
|
component={Link}
|
||||||
href="/auth/signUp"
|
href={webroot + "/auth/signUp"}
|
||||||
radius="xl"
|
radius="xl"
|
||||||
size="md"
|
size="md"
|
||||||
className={classes.control}
|
className={classes.control}
|
||||||
|
|
Loading…
Reference in New Issue