mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-10-02 01:20:11 +02:00
fix: share not found if unauthenticated
This commit is contained in:
parent
7d8fc72394
commit
aa5b125367
@ -99,12 +99,19 @@ export class ShareService {
|
|||||||
|
|
||||||
async getSharesByUser(userId: string) {
|
async getSharesByUser(userId: string) {
|
||||||
return await this.prisma.share.findMany({
|
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) {
|
async get(id: string) {
|
||||||
const share : any = await this.prisma.share.findUnique({
|
const share: any = await this.prisma.share.findUnique({
|
||||||
where: { id },
|
where: { id },
|
||||||
include: {
|
include: {
|
||||||
files: true,
|
files: true,
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
import { useColorScheme } from "@mantine/hooks";
|
import { useColorScheme } from "@mantine/hooks";
|
||||||
import { ModalsProvider } from "@mantine/modals";
|
import { ModalsProvider } from "@mantine/modals";
|
||||||
import { NotificationsProvider } from "@mantine/notifications";
|
import { NotificationsProvider } from "@mantine/notifications";
|
||||||
import { setCookies } from "cookies-next";
|
|
||||||
import type { AppProps } from "next/app";
|
import type { AppProps } from "next/app";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Footer from "../components/Footer";
|
import Footer from "../components/Footer";
|
||||||
@ -41,9 +40,6 @@ function App({ Component, pageProps }: AppProps) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCookies("color-schema", systemTheme, {
|
|
||||||
maxAge: 60 * 60 * 24 * 30,
|
|
||||||
});
|
|
||||||
setColorScheme(systemTheme);
|
setColorScheme(systemTheme);
|
||||||
}, [systemTheme]);
|
}, [systemTheme]);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Group } from "@mantine/core";
|
import { Group } from "@mantine/core";
|
||||||
import { useModals } from "@mantine/modals";
|
import { useModals } from "@mantine/modals";
|
||||||
import { useRouter } from "next/router";
|
import { GetServerSidePropsContext } from "next";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Meta from "../../components/Meta";
|
import Meta from "../../components/Meta";
|
||||||
import DownloadAllButton from "../../components/share/DownloadAllButton";
|
import DownloadAllButton from "../../components/share/DownloadAllButton";
|
||||||
@ -9,10 +9,14 @@ import showEnterPasswordModal from "../../components/share/showEnterPasswordModa
|
|||||||
import showErrorModal from "../../components/share/showErrorModal";
|
import showErrorModal from "../../components/share/showErrorModal";
|
||||||
import shareService from "../../services/share.service";
|
import shareService from "../../services/share.service";
|
||||||
|
|
||||||
const Share = () => {
|
export function getServerSideProps(context: GetServerSidePropsContext) {
|
||||||
const router = useRouter();
|
return {
|
||||||
|
props: { shareId: context.params!.shareId },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const Share = ({ shareId }: { shareId: string }) => {
|
||||||
const modals = useModals();
|
const modals = useModals();
|
||||||
const shareId = router.query.shareId as string;
|
|
||||||
const [fileList, setFileList] = useState<any[]>([]);
|
const [fileList, setFileList] = useState<any[]>([]);
|
||||||
|
|
||||||
const getShareToken = async (password?: string) => {
|
const getShareToken = async (password?: string) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user