diff --git a/frontend/app/package.json b/frontend/app/package.json index 34843d2df5..c0d0cbe883 100644 --- a/frontend/app/package.json +++ b/frontend/app/package.json @@ -61,6 +61,7 @@ "@dfinity/candid": "^2.1.1", "@dfinity/identity": "^2.1.1", "@dfinity/principal": "^2.1.1", + "@fingerprintjs/botd": "^1.9.1", "@fortawesome/free-solid-svg-icons": "^6.4.2", "@memefighter/maker-core": "^0.0.17", "@metamask/sdk": "^0.28.4", diff --git a/frontend/app/src/components/SecureButton.svelte b/frontend/app/src/components/SecureButton.svelte index 4313b5f57e..9ffa5dffce 100644 --- a/frontend/app/src/components/SecureButton.svelte +++ b/frontend/app/src/components/SecureButton.svelte @@ -2,6 +2,7 @@ import { onMount } from "svelte"; import type { ButtonProps } from "./Button.svelte"; import Button from "./Button.svelte"; + import { suspectedAutomationBot } from "../stores/automation"; let { children, onClick, ...rest }: ButtonProps & { onClick: (ev: MouseEvent) => void } = $props(); @@ -24,7 +25,12 @@ function probablyBot(ev: MouseEvent): boolean { const pause = Date.now() - lastMoved; - return pause < PAUSE_TRESHOLD || document.activeElement !== ev.target || !ev.isTrusted; + return ( + pause < PAUSE_TRESHOLD || + document.activeElement !== ev.target || + !ev.isTrusted || + $suspectedAutomationBot + ); } function internalOnclick(ev: MouseEvent) { diff --git a/frontend/app/src/components/landingpages/Launch.svelte b/frontend/app/src/components/landingpages/Launch.svelte index fe65fc4c97..0c46a2b1e5 100644 --- a/frontend/app/src/components/landingpages/Launch.svelte +++ b/frontend/app/src/components/landingpages/Launch.svelte @@ -4,6 +4,7 @@ import { getContext } from "svelte"; import { _ } from "svelte-i18n"; import { routeForScope } from "../../routes"; + import SecureButton from "../SecureButton.svelte"; const client = getContext("client"); @@ -13,8 +14,14 @@ $: url = $identityState.kind === "logged_in" ? rootPath : "/communities"; $: busy = $identityState.kind === "logging_in" || $identityState.kind === "loading_user"; + + function onClick(_: MouseEvent) { + console.log("You are a real user!"); + } +Testing testing 123 + {#if login}
(false); + +botCheck() + .then((botd) => botd.detect()) + .then((result) => suspectedAutomationBot.set(result.bot)) + .catch((err) => console.error(`Error during bot detection: `, err)); diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d256f85e0e..c013db2049 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -66,6 +66,7 @@ "@dfinity/candid": "^2.1.1", "@dfinity/identity": "^2.1.1", "@dfinity/principal": "^2.1.1", + "@fingerprintjs/botd": "^1.9.1", "@fortawesome/free-solid-svg-icons": "^6.4.2", "@memefighter/maker-core": "^0.0.17", "@metamask/sdk": "^0.28.4", @@ -683,19 +684,6 @@ "node": ">=6" } }, - "app/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -6253,6 +6241,15 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/@fingerprintjs/botd": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@fingerprintjs/botd/-/botd-1.9.1.tgz", + "integrity": "sha512-7kv3Yolsx9E56i+L1hCEcupH5yqcI5cmVktxy6B0K7rimaH5qDXwsiA5FL+fkxeUny7XQKn7p13HvK7ofDZB3g==", + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@fivebinaries/coin-selection": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@fivebinaries/coin-selection/-/coin-selection-2.2.1.tgz", @@ -14013,20 +14010,6 @@ "ws": "^7.5.1" } }, - "node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -23265,20 +23248,6 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, - "node_modules/jayson/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/jayson/node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -26449,21 +26418,6 @@ "integrity": "sha512-5MP0uUeVCec89ZbNOT/i97Mc+q3SxXmiUGhRFOTmhrGPn//uWVQdCvcLJDy64MSBR5MidFdOR7B9viumoavy6g==", "dev": true }, - "node_modules/livereload/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/livereload/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -27711,20 +27665,6 @@ "node": ">=8" } }, - "node_modules/metro/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/metro/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -30969,20 +30909,6 @@ "ws": "^7" } }, - "node_modules/react-devtools-core/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/react-devtools-core/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -31799,20 +31725,6 @@ "node": ">= 6" } }, - "node_modules/ripple-lib/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/ripple-lib/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -32327,19 +32239,6 @@ "utf-8-validate": "^5.0.2" } }, - "node_modules/rpc-websockets/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/rpc-websockets/node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -35925,12 +35824,11 @@ } }, "node_modules/utf-8-validate": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz", - "integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==", + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", "hasInstallScript": true, - "optional": true, - "peer": true, + "license": "MIT", "dependencies": { "node-gyp-build": "^4.3.0" },