diff --git a/_packs/entry.js b/_packs/entry.js index 5de0945..5a612e6 100644 --- a/_packs/entry.js +++ b/_packs/entry.js @@ -1,15 +1,21 @@ +import BotDetector from 'device-detector-js/dist/parsers/bot' import { Notifier } from '@airbrake/browser' -window.airbrake = new Notifier({ - projectId: window.env.AIRBRAKE_PROJECT_ID, - projectKey: window.env.AIRBRAKE_PROJECT_KEY, - host: 'https://panel.sutty.nl' -}) +window.bot_detector = new BotDetector +const bot = window.bot_detector.parse(navigator.userAgent) -console.originalError = console.error -console.error = (...e) => { - window.airbrake.notify(e.join(' ')) - return console.originalError(...e) +if (!bot) { + window.airbrake = new Notifier({ + projectId: window.env.AIRBRAKE_PROJECT_ID, + projectKey: window.env.AIRBRAKE_PROJECT_KEY, + host: 'https://panel.sutty.nl' + }) + + console.originalError = console.error + console.error = (...e) => { + window.airbrake.notify(e.join(' ')) + return console.originalError(...e) + } } import 'core-js/stable' diff --git a/package.json b/package.json index 895cf0f..edbf46f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "axe-core": "^4.1.2", "babel-loader": "^8.1.0", "core-js": "^3.6.5", + "device-detector-js": "^2.2.10", "dotenv-webpack": "^6.0.0", "liquidjs": "^9.14.0", "regenerator-runtime": "^0.13.5", diff --git a/yarn.lock b/yarn.lock index d441339..b63a829 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2519,6 +2519,11 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== +device-detector-js@^2.2.10: + version "2.2.10" + resolved "https://registry.yarnpkg.com/device-detector-js/-/device-detector-js-2.2.10.tgz#a8fd47837ce89024d7647a4ddf18154d7a920538" + integrity sha512-zLcDSU10WIqbARXecaVJJxx0ZuGWq+MVhj9f9qehdBCFr9RMa5mQGTt2IZNIgKuCIind/j/DzRDViEdc2FfBGQ== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"