client: disable theme transitions on change

This commit is contained in:
Max Leiter 2022-03-23 18:54:42 -07:00
parent 6a4ff9c307
commit de68796101
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A3512F2F2F17EBDA
5 changed files with 15 additions and 4 deletions

View file

@ -31,7 +31,7 @@ function MyApp({ Component, pageProps }: AppProps) {
<meta name="theme-color" content="#ffffff" /> <meta name="theme-color" content="#ffffff" />
<title>Drift</title> <title>Drift</title>
</Head> </Head>
<ThemeProvider defaultTheme="system"> <ThemeProvider defaultTheme="system" disableTransitionOnChange>
<App Component={Component} pageProps={pageProps} /> <App Component={Component} pageProps={pageProps} />
</ThemeProvider> </ThemeProvider>
</div> </div>

View file

@ -11,6 +11,10 @@ const renderMarkdown: NextApiHandler = async (req, res) => {
Authorization: `Bearer ${req.cookies["drift-token"]}` Authorization: `Bearer ${req.cookies["drift-token"]}`
} }
}) })
console.log(file.status)
if (file.status !== 200) {
return res.status(404).json({ error: "File not found" })
}
const json = await file.json() const json = await file.json()
const { content, title } = json const { content, title } = json

View file

@ -9,10 +9,12 @@ const getRawFile = async (req: NextApiRequest, res: NextApiResponse) => {
Authorization: `Bearer ${req.cookies["drift-token"]}` Authorization: `Bearer ${req.cookies["drift-token"]}`
} }
}) })
const json = await file.json()
res.setHeader("Content-Type", "text/plain; charset=utf-8") res.setHeader("Content-Type", "text/plain; charset=utf-8")
res.setHeader("Cache-Control", "s-maxage=86400") res.setHeader("Cache-Control", "s-maxage=86400")
if (file.ok) { if (file.ok) {
const json = await file.json()
console.log(json)
const data = json const data = json
const { title, content } = data const { title, content } = data
// serve the file raw as plain text // serve the file raw as plain text

View file

@ -16,8 +16,8 @@ article img {
article [id]::before { article [id]::before {
content: ""; content: "";
display: block; display: block;
height: 70px; height: var(--gap-half);
margin-top: -70px; margin-top: calc(var(--gap-half) * -1);
visibility: hidden; visibility: hidden;
} }

View file

@ -13,6 +13,11 @@ files.get("/raw/:id", secretKey, async (req, res, next) => {
attributes: ["title", "content"], attributes: ["title", "content"],
}) })
if (!file) {
return res.status(404).json({ error: "File not found" })
}
// TODO: JWT-checkraw files // TODO: JWT-checkraw files
if (file?.post?.visibility === "private") { if (file?.post?.visibility === "private") {
// jwt(req as UserJwtRequest, res, () => { // jwt(req as UserJwtRequest, res, () => {