mirror of
https://github.com/umami-software/umami.git
synced 2026-02-22 05:25:36 +01:00
Return server error.
This commit is contained in:
parent
4d6ec631f7
commit
6466cef269
2 changed files with 146 additions and 142 deletions
|
|
@ -31,7 +31,7 @@ export async function POST(request: Request) {
|
||||||
|
|
||||||
const { id, role, createdAt } = user;
|
const { id, role, createdAt } = user;
|
||||||
|
|
||||||
let token = null;
|
let token: string;
|
||||||
|
|
||||||
if (redis.enabled) {
|
if (redis.enabled) {
|
||||||
token = await saveAuth({ userId: id, role });
|
token = await saveAuth({ userId: id, role });
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ const schema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
|
try {
|
||||||
// Bot check
|
// Bot check
|
||||||
if (!process.env.DISABLE_BOT_CHECK && isbot(request.headers.get('user-agent'))) {
|
if (!process.env.DISABLE_BOT_CHECK && isbot(request.headers.get('user-agent'))) {
|
||||||
return json({ beep: 'boop' });
|
return json({ beep: 'boop' });
|
||||||
|
|
@ -195,4 +196,7 @@ export async function POST(request: Request) {
|
||||||
const token = createToken({ websiteId, sessionId, visitId, iat }, secret());
|
const token = createToken({ websiteId, sessionId, visitId, iat }, secret());
|
||||||
|
|
||||||
return json({ cache: token });
|
return json({ cache: token });
|
||||||
|
} catch (e) {
|
||||||
|
return serverError(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue