fix: use current window url instead of app url in frontend

This commit is contained in:
Elias Schneider
2024-11-14 19:10:11 +01:00
parent ff2dd81055
commit 6f45c3b1fb
12 changed files with 24 additions and 56 deletions

View File

@@ -13,7 +13,6 @@ import CopyTextField from "../CopyTextField";
const showCompletedUploadModal = (
modals: ModalsContextProps,
share: CompletedShare,
appUrl: string,
) => {
const t = translateOutsideContext();
return modals.openModal({
@@ -21,18 +20,18 @@ const showCompletedUploadModal = (
withCloseButton: false,
closeOnEscape: false,
title: t("upload.modal.completed.share-ready"),
children: <Body share={share} appUrl={appUrl} />,
children: <Body share={share} />,
});
};
const Body = ({ share, appUrl }: { share: CompletedShare; appUrl: string }) => {
const Body = ({ share }: { share: CompletedShare }) => {
const modals = useModals();
const router = useRouter();
const t = useTranslate();
const isReverseShare = !!router.query["reverseShareToken"];
const link = `${appUrl}/s/${share.id}`;
const link = `${window.location.origin}/s/${share.id}`;
return (
<Stack align="stretch">

View File

@@ -19,7 +19,7 @@ import { useForm, yupResolver } from "@mantine/form";
import { useModals } from "@mantine/modals";
import { ModalsContextProps } from "@mantine/modals/lib/context";
import moment from "moment";
import { useState } from "react";
import React, { useState } from "react";
import { TbAlertCircle } from "react-icons/tb";
import { FormattedMessage } from "react-intl";
import * as yup from "yup";
@@ -30,7 +30,6 @@ import shareService from "../../../services/share.service";
import { FileUpload } from "../../../types/File.type";
import { CreateShare } from "../../../types/share.type";
import { getExpirationPreview } from "../../../utils/date.util";
import React from "react";
import toast from "../../../utils/toast.util";
const showCreateUploadModal = (
@@ -38,7 +37,6 @@ const showCreateUploadModal = (
options: {
isUserSignedIn: boolean;
isReverseShare: boolean;
appUrl: string;
allowUnauthenticatedShares: boolean;
enableEmailRecepients: boolean;
maxExpirationInHours: number;
@@ -101,7 +99,6 @@ const CreateUploadModalBody = ({
options: {
isUserSignedIn: boolean;
isReverseShare: boolean;
appUrl: string;
allowUnauthenticatedShares: boolean;
enableEmailRecepients: boolean;
maxExpirationInHours: number;
@@ -245,7 +242,7 @@ const CreateUploadModalBody = ({
color: theme.colors.gray[6],
})}
>
{`${options.appUrl}/s/${form.values.link}`}
{`${window.location.origin}/s/${form.values.link}`}
</Text>
{!options.isReverseShare && (
<>
@@ -461,7 +458,6 @@ const SimplifiedCreateUploadModalModal = ({
options: {
isUserSignedIn: boolean;
isReverseShare: boolean;
appUrl: string;
allowUnauthenticatedShares: boolean;
enableEmailRecepients: boolean;
maxExpirationInHours: number;