mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
fix: move isbot check after body parsing
This commit is contained in:
parent
38ab685143
commit
eafd08b4ee
1 changed files with 5 additions and 5 deletions
|
|
@ -34,11 +34,6 @@ const schema = z.object({
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
try {
|
try {
|
||||||
// Bot check
|
|
||||||
if (!process.env.DISABLE_BOT_CHECK && isbot(request.headers.get('user-agent'))) {
|
|
||||||
return json({ beep: 'boop' });
|
|
||||||
}
|
|
||||||
|
|
||||||
const { body, error } = await parseRequest(request, schema, { skipAuth: true });
|
const { body, error } = await parseRequest(request, schema, { skipAuth: true });
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
@ -86,6 +81,11 @@ export async function POST(request: Request) {
|
||||||
const { ip, userAgent, device, browser, os, country, subdivision1, subdivision2, city } =
|
const { ip, userAgent, device, browser, os, country, subdivision1, subdivision2, city } =
|
||||||
await getClientInfo(request, payload);
|
await getClientInfo(request, payload);
|
||||||
|
|
||||||
|
// Bot check
|
||||||
|
if (!process.env.DISABLE_BOT_CHECK && isbot(userAgent)) {
|
||||||
|
return json({ beep: 'boop' });
|
||||||
|
}
|
||||||
|
|
||||||
// IP block
|
// IP block
|
||||||
if (hasBlockedIp(ip)) {
|
if (hasBlockedIp(ip)) {
|
||||||
return forbidden();
|
return forbidden();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue