add project
This commit is contained in:
15
src/routes/api/scan/+server.ts
Normal file
15
src/routes/api/scan/+server.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { RequestHandler } from './$types';
|
||||
import { getDb } from '$lib/server/db';
|
||||
import { scanLibraries } from '$lib/server/scanner';
|
||||
import { getSession } from '$lib/server/auth';
|
||||
|
||||
export const POST: RequestHandler = ({ cookies }) => {
|
||||
if (!getSession(cookies)) {
|
||||
return new Response('Unauthorized', { status: 401 });
|
||||
}
|
||||
const db = getDb();
|
||||
scanLibraries(db);
|
||||
return new Response(JSON.stringify({ ok: true }), {
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user