parent
6519a4071a
commit
7599f233a8
@ -6,14 +6,19 @@ export const GET = (async ({ url }) => {
|
||||
if (env.REPORT_SECRET && url.searchParams.get('secret') !== env.REPORT_SECRET)
|
||||
return new Response(null, { status: 401 });
|
||||
|
||||
const username = url.searchParams.get('username');
|
||||
if (username == null) return new Response(null, { status: 400 });
|
||||
const uuid = url.searchParams.get('uuid');
|
||||
if (uuid == null) return new Response(null, { status: 400 });
|
||||
|
||||
const user = await User.findOne({ where: { username: username } });
|
||||
const user = await User.findOne({ where: { uuid: uuid } });
|
||||
if (user == null) return new Response(null, { status: 400 });
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({ uuid: user.uuid, firstname: user.firstname, lastname: user.lastname }),
|
||||
JSON.stringify({
|
||||
uuid: user.uuid,
|
||||
username: user.username,
|
||||
firstname: user.firstname,
|
||||
lastname: user.lastname
|
||||
}),
|
||||
{ status: 200 }
|
||||
);
|
||||
}) satisfies RequestHandler;
|
||||
|
Loading…
x
Reference in New Issue
Block a user