diff --git a/backend/src/share/share.service.ts b/backend/src/share/share.service.ts index e417fd93..602e82e0 100644 --- a/backend/src/share/share.service.ts +++ b/backend/src/share/share.service.ts @@ -99,12 +99,19 @@ export class ShareService { async getSharesByUser(userId: string) { return await this.prisma.share.findMany({ - where: { creator: { id: userId }, expiration: { gt: new Date() } }, + where: { + creator: { id: userId }, + expiration: { gt: new Date() }, + uploadLocked: true, + }, + orderBy: { + expiration: "desc", + }, }); } async get(id: string) { - const share : any = await this.prisma.share.findUnique({ + const share: any = await this.prisma.share.findUnique({ where: { id }, include: { files: true, diff --git a/frontend/src/pages/_app.tsx b/frontend/src/pages/_app.tsx index 266fcbca..78bd0e89 100644 --- a/frontend/src/pages/_app.tsx +++ b/frontend/src/pages/_app.tsx @@ -8,7 +8,6 @@ import { import { useColorScheme } from "@mantine/hooks"; import { ModalsProvider } from "@mantine/modals"; import { NotificationsProvider } from "@mantine/notifications"; -import { setCookies } from "cookies-next"; import type { AppProps } from "next/app"; import { useEffect, useState } from "react"; import Footer from "../components/Footer"; @@ -41,9 +40,6 @@ function App({ Component, pageProps }: AppProps) { }, []); useEffect(() => { - setCookies("color-schema", systemTheme, { - maxAge: 60 * 60 * 24 * 30, - }); setColorScheme(systemTheme); }, [systemTheme]); diff --git a/frontend/src/pages/share/[shareId].tsx b/frontend/src/pages/share/[shareId].tsx index 21b23fde..2555f792 100644 --- a/frontend/src/pages/share/[shareId].tsx +++ b/frontend/src/pages/share/[shareId].tsx @@ -1,6 +1,6 @@ import { Group } from "@mantine/core"; import { useModals } from "@mantine/modals"; -import { useRouter } from "next/router"; +import { GetServerSidePropsContext } from "next"; import { useEffect, useState } from "react"; import Meta from "../../components/Meta"; import DownloadAllButton from "../../components/share/DownloadAllButton"; @@ -9,10 +9,14 @@ import showEnterPasswordModal from "../../components/share/showEnterPasswordModa import showErrorModal from "../../components/share/showErrorModal"; import shareService from "../../services/share.service"; -const Share = () => { - const router = useRouter(); +export function getServerSideProps(context: GetServerSidePropsContext) { + return { + props: { shareId: context.params!.shareId }, + }; +} + +const Share = ({ shareId }: { shareId: string }) => { const modals = useModals(); - const shareId = router.query.shareId as string; const [fileList, setFileList] = useState([]); const getShareToken = async (password?: string) => {