1
Fork 0
mirror of https://github.com/diced/zipline.git synced 2025-04-11 23:31:17 -05:00

Merge branch 'trunk' into trunk

This commit is contained in:
dicedtomato 2025-02-20 11:52:42 -08:00 committed by GitHub
commit ce084eb72a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 12 deletions

View file

@ -357,7 +357,9 @@ export default function Layout({ children, config }: { children: React.ReactNode
}
})}
<ScrollArea mah={200} mt='auto'>
<Divider mt='auto' />
<ScrollArea mah='auto'>
<Box>
{config.website.externalLinks.map(({ name, url }, i) => (
<NavLink

View file

@ -40,6 +40,7 @@ export function settingsOnSubmit(router: NextRouter, form: ReturnType<typeof use
});
await fetch('/reload');
await fetch('/api/reload');
mutate('/api/server/settings', data);
router.replace(router.asPath, undefined, { scroll: false });
}

View file

@ -95,6 +95,7 @@ export default function ImportButton() {
});
await fetch('/reload');
await fetch('/api/reload');
}
};

25
src/pages/api/reload.ts Normal file
View file

@ -0,0 +1,25 @@
import { reloadSettings } from '@/lib/config';
import { prisma } from '@/lib/db';
import { isAdministrator } from '@/lib/role';
import { getSession } from '@/server/session';
import { NextApiRequest, NextApiResponse } from 'next/types';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession(req, res);
if (!session.id || !session.sessionId) return res.redirect(302, '/auth/login');
const user = await prisma.user.findFirst({
where: {
sessions: {
has: session.sessionId,
},
},
});
if (!user) return res.redirect(302, '/dashboard');
if (!isAdministrator(user.role)) return res.redirect(302, '/dashboard');
await reloadSettings();
return res.json({ success: true });
}

View file

@ -296,17 +296,19 @@ export default function Login({ config }: InferGetServerSidePropsType<typeof get
<Divider label='or' />
)}
<Button
onClick={handlePasskeyLogin}
size='md'
fullWidth
variant='outline'
leftSection={<IconKey size='1rem' />}
color={passkeyErrored ? 'red' : undefined}
loading={passkeyLoading}
>
Login with passkey
</Button>
{config.mfa.passkeys && (
<Button
onClick={handlePasskeyLogin}
size='md'
fullWidth
variant='outline'
leftSection={<IconKey size='1rem' />}
color={passkeyErrored ? 'red' : undefined}
loading={passkeyLoading}
>
Login with passkey
</Button>
)}
{config.features.userRegistration && (
<Button