use uuid instead of playername to query player
All checks were successful
delpoy / build-and-deploy (push) Successful in 1m0s
All checks were successful
delpoy / build-and-deploy (push) Successful in 1m0s
This commit is contained in:
parent
6519a4071a
commit
7599f233a8
@ -6,14 +6,19 @@ export const GET = (async ({ url }) => {
|
|||||||
if (env.REPORT_SECRET && url.searchParams.get('secret') !== env.REPORT_SECRET)
|
if (env.REPORT_SECRET && url.searchParams.get('secret') !== env.REPORT_SECRET)
|
||||||
return new Response(null, { status: 401 });
|
return new Response(null, { status: 401 });
|
||||||
|
|
||||||
const username = url.searchParams.get('username');
|
const uuid = url.searchParams.get('uuid');
|
||||||
if (username == null) return new Response(null, { status: 400 });
|
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 });
|
if (user == null) return new Response(null, { status: 400 });
|
||||||
|
|
||||||
return new Response(
|
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 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
}) satisfies RequestHandler;
|
}) satisfies RequestHandler;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user