Added check for bots.

This commit is contained in:
Mike Cao 2020-09-10 20:37:07 -07:00
parent ff9d4f8585
commit 943c2c73d4
3 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "umami",
"version": "0.26.0",
"version": "0.27.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>",
"license": "MIT",
@ -59,6 +59,7 @@
"geolite2-redist": "^1.0.7",
"immer": "^7.0.8",
"is-localhost-ip": "^1.4.0",
"isbot-fast": "^1.2.0",
"jose": "^1.28.0",
"maxmind": "^4.1.4",
"moment-timezone": "^0.5.31",

View File

@ -1,8 +1,13 @@
import { savePageView, saveEvent } from 'lib/queries';
import { useCors, useSession } from 'lib/middleware';
import { ok, badRequest } from 'lib/response';
import isBot from 'isbot-fast';
export default async (req, res) => {
if (isBot(req.headers['user-agent'])) {
return ok(res);
}
await useCors(req, res);
await useSession(req, res);

View File

@ -4965,6 +4965,11 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0:
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
isbot-fast@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/isbot-fast/-/isbot-fast-1.2.0.tgz#ef0ef1d5db34eb60777250ae26fceb72b94153e2"
integrity sha512-twjuQzy2gKMDVfKGQyQqrx6Uy4opu/fiVUTTpdqtFsd7OQijIp5oXvb27n5EemYXaijh5fomndJt/SPRLsEdSg==
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"