mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 13:17:19 +01:00
Merge branch 'dev' into jajaja
# Conflicts: # package.json # yarn.lock
This commit is contained in:
commit
c71e9b5707
11 changed files with 126 additions and 30 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { parseRequest } from '@/lib/request';
|
||||
import { json } from '@/lib/response';
|
||||
|
||||
export async function GET(request: Request) {
|
||||
export async function POST(request: Request) {
|
||||
const { auth, error } = await parseRequest(request);
|
||||
|
||||
if (error) {
|
||||
|
|
|
|||
|
|
@ -34,11 +34,6 @@ const schema = z.object({
|
|||
|
||||
export async function POST(request: Request) {
|
||||
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 });
|
||||
|
||||
if (error) {
|
||||
|
|
@ -86,6 +81,11 @@ export async function POST(request: Request) {
|
|||
const { ip, userAgent, device, browser, os, country, subdivision1, subdivision2, city } =
|
||||
await getClientInfo(request, payload);
|
||||
|
||||
// Bot check
|
||||
if (!process.env.DISABLE_BOT_CHECK && isbot(userAgent)) {
|
||||
return json({ beep: 'boop' });
|
||||
}
|
||||
|
||||
// IP block
|
||||
if (hasBlockedIp(ip)) {
|
||||
return forbidden();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue