fix: Prevent unauthed users from uploading

This commit is contained in:
April Hall 2025-02-21 18:37:54 -05:00
parent d0ee1296c4
commit 724e473755
Signed by: arithefirst
GPG Key ID: 4508A15C4DB91C5B

View File

@ -1,3 +1,14 @@
export const POST = async () => {
import { error } from '@sveltejs/kit';
import { auth } from '$lib/server/db/auth';
export const POST = async ({ request }) => {
const session = await auth.api.getSession({
headers: request.headers,
});
if (!session) {
return error(401, 'Not authorized. Please sign up at /sign-up');
}
return new Response(undefined, { status: 204 });
};