mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
Make bot check return 200. Closes #1555
This commit is contained in:
parent
2555ee09d1
commit
6145b31ce5
@ -1,7 +1,7 @@
|
|||||||
const { Resolver } = require('dns').promises;
|
const { Resolver } = require('dns').promises;
|
||||||
import isbot from 'isbot';
|
import isbot from 'isbot';
|
||||||
import ipaddr from 'ipaddr.js';
|
import ipaddr from 'ipaddr.js';
|
||||||
import { createToken, unauthorized, send, badRequest, forbidden } from 'next-basics';
|
import { createToken, ok, send, badRequest, forbidden } from 'next-basics';
|
||||||
import { savePageView, saveEvent } from 'queries';
|
import { savePageView, saveEvent } from 'queries';
|
||||||
import { useCors, useSession } from 'lib/middleware';
|
import { useCors, useSession } from 'lib/middleware';
|
||||||
import { getJsonBody, getIpAddress } from 'lib/request';
|
import { getJsonBody, getIpAddress } from 'lib/request';
|
||||||
@ -11,7 +11,7 @@ export default async (req, res) => {
|
|||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
|
|
||||||
if (isbot(req.headers['user-agent']) && !process.env.DISABLE_BOT_CHECK) {
|
if (isbot(req.headers['user-agent']) && !process.env.DISABLE_BOT_CHECK) {
|
||||||
return unauthorized(res);
|
return ok(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ignoreIps = process.env.IGNORE_IP;
|
const ignoreIps = process.env.IGNORE_IP;
|
||||||
|
Loading…
Reference in New Issue
Block a user