diff --git a/src/components/pages/Files/FilePagation.tsx b/src/components/pages/Files/FilePagation.tsx index 56516fa4..5ad894c3 100644 --- a/src/components/pages/Files/FilePagation.tsx +++ b/src/components/pages/Files/FilePagation.tsx @@ -3,10 +3,12 @@ import File from 'components/File'; import { FileIcon } from 'components/icons'; import MutedText from 'components/MutedText'; import { usePaginatedFiles } from 'lib/queries/files'; +import { showNonMediaSelector } from 'lib/recoil/settings'; import { useState } from 'react'; +import { useRecoilState } from 'recoil'; export default function FilePagation({ disableMediaPreview, exifEnabled }) { - const [checked, setChecked] = useState(false); + const [checked, setChecked] = useRecoilState(showNonMediaSelector); const pages = usePaginatedFiles(!checked ? { filter: 'media' } : {}); const [page, setPage] = useState(1); diff --git a/src/lib/recoil/settings.ts b/src/lib/recoil/settings.ts index e11c3061..e8abe333 100644 --- a/src/lib/recoil/settings.ts +++ b/src/lib/recoil/settings.ts @@ -26,7 +26,7 @@ export const settingsState = atom({ }); export const showNonMediaSelector = selector({ - key: 'settingsState', + key: 'settingsShowNonMediaSelector', get: ({ get }) => get(settingsState).showNonMedia, set: ({ set }, newValue) => set(settingsState, { showNonMedia: newValue }), }); diff --git a/src/server/index.ts b/src/server/index.ts index f9abbe55..e916c3ed 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -71,7 +71,7 @@ async function start() { }); server.addHook('onResponse', (req, reply, done) => { - if (config.core.logger || dev || process.env.DEBUG) { + if (config.core.logger) { if (req.url.startsWith('/_next')) return done(); server.logger.child('response').info(`${req.method} ${req.url} -> ${reply.statusCode}`); @@ -151,6 +151,7 @@ async function start() { server.get('/r/:id', rawRoute.bind(server)); server.get('/', (_, reply) => reply.redirect('/dashboard')); + // initialize next routes after all other routes have been registered so theres no overlap server.after(() => { // overrides fastify's default parser so that next.js can handle the request // in the future Zipline's api will probably be entirely handled by fastify @@ -166,9 +167,9 @@ async function start() { server.next('/api/*', { method: 'ALL' }); }); - server.setDefaultRoute((req, res) => { - server.nextHandle(req, res); - }); + // server.setDefaultRoute((req, res) => { + // server.nextHandle(req, res); + // }); await server.listen({ port: config.core.port,