mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-02-19 01:55:48 -05:00
fix: share not found if unauthenticated
This commit is contained in:
parent
7d8fc72394
commit
aa5b125367
3 changed files with 17 additions and 10 deletions
|
@ -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,
|
||||
|
|
|
@ -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]);
|
||||
|
||||
|
|
|
@ -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<any[]>([]);
|
||||
|
||||
const getShareToken = async (password?: string) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue