1
0
Fork 0

use config.webroot

This commit is contained in:
gluzzati 2024-03-21 20:31:25 +00:00
parent 7d93cc6c63
commit 231876e794
13 changed files with 23 additions and 22 deletions

View File

@ -20,5 +20,6 @@ module.exports = withPWA({
},
serverRuntimeConfig: {
apiURL: process.env.API_URL ?? 'http://localhost:8080',
webroot: process.env.WEBROOT ?? '',
},
});

View File

@ -42,7 +42,7 @@ const ConfigurationHeader = ({
</Group>
</Link>
<MediaQuery smallerThan="sm" styles={{ display: "none" }}>
<Button variant="light" component={Link} href={config.get("general.appUrl") + "/admin"}>
<Button variant="light" component={Link} href={config.get("general.webroot") + "/admin"}>
<FormattedMessage id="common.button.go-back" />
</Button>
</MediaQuery>

View File

@ -71,7 +71,7 @@ const ConfigurationNavBar = ({
: undefined
}
key={category.name}
href={`${config.get("general.appUrl")}/admin/config/${category.name.toLowerCase()}`}
href={`${config.get("general.webroot")}/admin/config/${category.name.toLowerCase()}`}
>
<Group>
<ThemeIcon
@ -94,7 +94,7 @@ const ConfigurationNavBar = ({
</Stack>
</Navbar.Section>
<MediaQuery largerThan="sm" styles={{ display: "none" }}>
<Button mt="xl" variant="light" component={Link} href={config.get("general.appUrl") + "/admin"}>
<Button mt="xl" variant="light" component={Link} href={config.get("general.webroot") + "/admin"}>
<FormattedMessage id="common.button.go-back" />
</Button>
</MediaQuery>

View File

@ -145,7 +145,7 @@ const SignInForm = ({ redirectPath }: { redirectPath: string }) => {
/>
{config.get("smtp.enabled") && (
<Group position="right" mt="xs">
<Anchor component={Link} href={config.get("general.appUrl") + "/auth/resetPassword"} size="xs">
<Anchor component={Link} href={config.get("general.webroot") + "/auth/resetPassword"} size="xs">
<FormattedMessage id="resetPassword.title" />
</Anchor>
</Group>

View File

@ -18,13 +18,13 @@ const ActionAvatar = () => {
</ActionIcon>
</Menu.Target>
<Menu.Dropdown>
<Menu.Item component={Link} href={config.get("general.appUrl") + "/account"} icon={<TbUser size={14} />}>
<Menu.Item component={Link} href={config.get("general.webroot") + "/account"} icon={<TbUser size={14} />}>
<FormattedMessage id="navbar.avatar.account" />
</Menu.Item>
{user!.isAdmin && (
<Menu.Item
component={Link}
href={config.get("general.appUrl") + "/admin"}
href={config.get("general.webroot") + "/admin"}
icon={<TbSettings size={14} />}
>
<FormattedMessage id="navbar.avatar.admin" />

View File

@ -125,7 +125,7 @@ const Header = () => {
const authenticatedLinks: NavLink[] = [
{
link: config.get("general.appUrl") + "/upload",
link: config.get("general.webroot") + "/upload",
label: t("navbar.upload"),
},
{
@ -138,27 +138,27 @@ const Header = () => {
let unauthenticatedLinks: NavLink[] = [
{
link: config.get("general.appUrl") + "/auth/signIn",
link: config.get("general.webroot") + "/auth/signIn",
label: t("navbar.signin"),
},
];
if (config.get("share.allowUnauthenticatedShares")) {
unauthenticatedLinks.unshift({
link: config.get("general.appUrl") + "/upload",
link: config.get("general.webroot") + "/upload",
label: t("navbar.upload"),
});
}
if (config.get("general.showHomePage"))
unauthenticatedLinks.unshift({
link: config.get("general.appUrl") + "/",
link: config.get("general.webroot") + "/",
label: t("navbar.home"),
});
if (config.get("share.allowRegistration"))
unauthenticatedLinks.push({
link: config.get("general.appUrl") + "/auth/signUp",
link: config.get("general.webroot") + "/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={config.get("general.appUrl")+"/"} passHref>
<Link href={config.get("general.webroot")+"/"} passHref>
<Group>
<Logo height={35} width={35} />
<Text weight={600}>{config.get("general.appName")}</Text>

View File

@ -14,12 +14,12 @@ const NavbarShareMneu = () => {
</ActionIcon>
</Menu.Target>
<Menu.Dropdown>
<Menu.Item component={Link} href={config.get("general.appUrl") + "/account/shares"} icon={<TbLink />}>
<Menu.Item component={Link} href={config.get("general.webroot") + "/account/shares"} icon={<TbLink />}>
<FormattedMessage id="navbar.links.shares" />
</Menu.Item>
<Menu.Item
component={Link}
href={config.get("general.appUrl") + "/account/reverseShares"}
href={config.get("general.webroot") + "/account/reverseShares"}
icon={<TbArrowLoopLeft />}
>
<FormattedMessage id="navbar.links.reverse" />

View File

@ -51,7 +51,7 @@ const FilePreview = ({
component={Link}
onClick={() => modals.closeAll()}
target="_blank"
href={`${config.get("general.appUrl")}/api/shares/${shareId}/files/${fileId}?download=false`}
href={`${config.get("general.webroot")}/api/shares/${shareId}/files/${fileId}?download=false`}
>
View original file
{/* Add translation? */}

View File

@ -54,7 +54,7 @@ const ErrorNotFound = () => {
className={classes.description}
></Text>
<Group position="center">
<Button component={Link} href={config.get("general.appUrl") + "/"} variant="light">
<Button component={Link} href={config.get("general.webroot") + "/"} variant="light">
<FormattedMessage id="404.button.home" />
</Button>
</Group>

View File

@ -58,7 +58,7 @@ const MyShares = () => {
<FormattedMessage id="account.shares.description.empty" />
</Text>
<Space h={5} />
<Button component={Link} href={config.get("general.appUrl") + "/upload"} variant="light">
<Button component={Link} href={config.get("general.webroot") + "/upload"} variant="light">
<FormattedMessage id="account.shares.button.create" />
</Button>
</Stack>

View File

@ -45,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={config.get("general.appUrl") + "/admin/config/general"} component={Link}>
<Button href={config.get("general.webroot") + "/admin/config/general"} component={Link}>
Customize configuration
</Button>
<Button href={config.get("general.appUrl") + "/"} component={Link} variant="light">
<Button href={config.get("general.webroot") + "/"} component={Link} variant="light">
Explore Pingvin Share
</Button>
</Stack>

View File

@ -95,7 +95,7 @@ const ResetPassword = () => {
color="dimmed"
size="sm"
className={classes.control}
href={config.get("general.appUrl") + "/auth/signIn"}
href={config.get("general.webroot") + "/auth/signIn"}
>
<Center inline>
<TbArrowLeft size={12} />

View File

@ -80,7 +80,7 @@ export default function Home() {
useEffect(() => {
refreshUser().then((user) => {
if (user) {
router.replace(config.get("general.appUrl") + "/upload");
router.replace(config.get("general.webroot") + "/upload");
}
});
}, []);
@ -144,7 +144,7 @@ export default function Home() {
<Group mt={30}>
<Button
component={Link}
href={config.get("general.appUrl") + "/auth/signUp"}
href={config.get("general.webroot") + "/auth/signUp"}
radius="xl"
size="md"
className={classes.control}