mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-02-05 01:38:56 -05:00
refactor: run formatter
This commit is contained in:
parent
416eba6ae6
commit
e572506d4f
3 changed files with 29 additions and 23 deletions
|
@ -139,7 +139,7 @@ export class AuthService {
|
||||||
|
|
||||||
async updatePassword(user: User, newPassword: string, oldPassword?: string) {
|
async updatePassword(user: User, newPassword: string, oldPassword?: string) {
|
||||||
const isPasswordValid =
|
const isPasswordValid =
|
||||||
!user.password || await argon.verify(user.password, oldPassword);
|
!user.password || (await argon.verify(user.password, oldPassword));
|
||||||
|
|
||||||
if (!isPasswordValid) throw new ForbiddenException("Invalid password");
|
if (!isPasswordValid) throw new ForbiddenException("Invalid password");
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { Button, Center, Stack, Text, Title, useMantineTheme } from "@mantine/core";
|
import {
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
useMantineTheme,
|
||||||
|
} from "@mantine/core";
|
||||||
import { modals } from "@mantine/modals";
|
import { modals } from "@mantine/modals";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import React, { Dispatch, SetStateAction, useEffect, useState } from "react";
|
import React, { Dispatch, SetStateAction, useEffect, useState } from "react";
|
||||||
|
@ -116,41 +123,38 @@ const ImagePreview = () => {
|
||||||
|
|
||||||
const TextPreview = () => {
|
const TextPreview = () => {
|
||||||
const { shareId, fileId } = React.useContext(FilePreviewContext);
|
const { shareId, fileId } = React.useContext(FilePreviewContext);
|
||||||
const [ text, setText ] = useState<string>("");
|
const [text, setText] = useState<string>("");
|
||||||
const { colorScheme } = useMantineTheme();
|
const { colorScheme } = useMantineTheme();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
api
|
api
|
||||||
.get(`/shares/${shareId}/files/${fileId}?download=false`)
|
.get(`/shares/${shareId}/files/${fileId}?download=false`)
|
||||||
.then((res) => setText(res.data ?? "Preview couldn't be fetched."));
|
.then((res) => setText(res.data ?? "Preview couldn't be fetched."));
|
||||||
}, [ shareId, fileId ]);
|
}, [shareId, fileId]);
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
overrides: {
|
overrides: {
|
||||||
pre: {
|
pre: {
|
||||||
props: {
|
props: {
|
||||||
style: {
|
style: {
|
||||||
backgroundColor: colorScheme == "dark"
|
backgroundColor:
|
||||||
|
colorScheme == "dark"
|
||||||
? "rgba(50, 50, 50, 0.5)"
|
? "rgba(50, 50, 50, 0.5)"
|
||||||
: "rgba(220, 220, 220, 0.5)",
|
: "rgba(220, 220, 220, 0.5)",
|
||||||
padding: "0.75em",
|
padding: "0.75em",
|
||||||
whiteSpace: "pre-wrap",
|
whiteSpace: "pre-wrap",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
props: {
|
props: {
|
||||||
className: "md"
|
className: "md",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return <Markdown options={options}>{text}</Markdown>;
|
||||||
<Markdown options={options}>
|
|
||||||
{text}
|
|
||||||
</Markdown>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const PdfPreview = () => {
|
const PdfPreview = () => {
|
||||||
|
|
|
@ -8,8 +8,10 @@ const GlobalStyle = () => {
|
||||||
color: "inherit",
|
color: "inherit",
|
||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
},
|
},
|
||||||
"table.md, table.md th:nth-of-type(odd), table.md td:nth-of-type(odd)": {
|
"table.md, table.md th:nth-of-type(odd), table.md td:nth-of-type(odd)":
|
||||||
background: theme.colorScheme == "dark"
|
{
|
||||||
|
background:
|
||||||
|
theme.colorScheme == "dark"
|
||||||
? "rgba(50, 50, 50, 0.5)"
|
? "rgba(50, 50, 50, 0.5)"
|
||||||
: "rgba(220, 220, 220, 0.5)",
|
: "rgba(220, 220, 220, 0.5)",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue