From 0a1347a7fa2030e091d7290b7455220249cd3d19 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Tue, 22 Oct 2024 15:50:31 +0700 Subject: [PATCH] chore: Show warning banner while using incognito tabs --- packages/app/package.json | 1 + packages/app/src/pages/MainPage.tsx | 63 ++++++++++++++++++++--------- yarn.lock | 8 ++++ 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/packages/app/package.json b/packages/app/package.json index f0bda1a..ee8f145 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -7,6 +7,7 @@ "@rainbow-me/rainbowkit": "^1.3.3", "@react-oauth/google": "^0.12.1", "@zk-email/helpers": "^6.1.3", + "detectincognitojs": "^1.3.5", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/packages/app/src/pages/MainPage.tsx b/packages/app/src/pages/MainPage.tsx index 49902a9..872f767 100644 --- a/packages/app/src/pages/MainPage.tsx +++ b/packages/app/src/pages/MainPage.tsx @@ -30,6 +30,7 @@ import { } from "../hooks/useGmailClient"; import { formatDateTime } from "../helpers/dateTimeFormat"; import EmailInputMethod from "../components/EmailInputMethod"; +import { detectIncognito } from "detectincognitojs"; const CIRCUIT_NAME = "twitter"; @@ -97,6 +98,13 @@ export const MainPage: React.FC<{}> = (props) => { useEffect(() => { const userAgent = navigator.userAgent; const isChrome = userAgent.indexOf("Chrome") > -1; + + detectIncognito().then((result) => { + if (result.isPrivate) { + setShowBrowserWarning(true); + } + }); + if (!isChrome) { setShowBrowserWarning(true); } @@ -251,7 +259,7 @@ export const MainPage: React.FC<{}> = (props) => { {showBrowserWarning && ( )}
@@ -284,7 +292,7 @@ export const MainPage: React.FC<{}> = (props) => {
If you wish to generate a ZK proof of Twitter badge (NFT), you must: -
+
Send yourself a{" "} = (props) => { > password reset email {" "} - from Twitter. (Reminder: Twitter name with emoji might fail to pass DKIM verification) + from Twitter. (Reminder: Twitter name with emoji might fail to pass + DKIM verification) -

Sign in with Gmail, then select the most recent Twitter email.

+

+ Sign in with Gmail, then select the most recent Twitter email. +

- Alternative method (for non-Gmail users or if you prefer not to sign in) + + Alternative method (for non-Gmail users or if you prefer not to + sign in) +
- In your inbox, find the email from Twitter and click the three dot - menu, then "Show original" then "Copy to clipboard". If on Outlook, - download the original email as .eml and copy it instead. + In your inbox, find the email from Twitter and click the three + dot menu, then "Show original" then "Copy to clipboard". If on + Outlook, download the original email as .eml and copy it + instead. - Copy paste or drop that into the box below. Note that we cannot use - this to phish you: we do not know your password, and we never get this - email info because we have no server at all. We are actively searching - for a less sketchy email. + Copy paste or drop that into the box below. Note that we cannot + use this to phish you: we do not know your password, and we + never get this email info because we have no server at all. We + are actively searching for a less sketchy email.
- Paste in your sending Ethereum address. This ensures that no one else - can "steal" your proof for another account (frontrunning protection!). + Paste in your sending Ethereum address. This ensures that no one + else can "steal" your proof for another account (frontrunning + protection!). Click "Prove". Note it is completely client side and{" "} - open source, - and no server ever sees your private information. + + open source + + , and no server ever sees your private information. Click "Verify" and then "Mint Twitter Badge On-Chain", - and approve to mint the NFT badge that proves Twitter ownership! Note - that it is 700K gas right now so only feasible on Sepolia, though we - intend to reduce this soon. + and approve to mint the NFT badge that proves Twitter ownership! + Note that it is 700K gas right now so only feasible on Sepolia, + though we intend to reduce this soon.
@@ -395,7 +417,8 @@ export const MainPage: React.FC<{}> = (props) => { )}
) : null} - {inputMethod === "EML_FILE" || !import.meta.env.VITE_GOOGLE_CLIENT_ID ? ( + {inputMethod === "EML_FILE" || + !import.meta.env.VITE_GOOGLE_CLIENT_ID ? ( <> {" "} diff --git a/yarn.lock b/yarn.lock index 11669d5..e98c643 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4586,6 +4586,7 @@ __metadata: "@vitejs/plugin-react": ^4.2.1 "@zk-email/helpers": ^6.1.3 crypto-browserify: ^3.12.0 + detectincognitojs: ^1.3.5 jest: ^29.7.0 jest-environment-jsdom: ^29.7.0 jest-fetch-mock: ^3.0.3 @@ -6513,6 +6514,13 @@ __metadata: languageName: node linkType: hard +"detectincognitojs@npm:^1.3.5": + version: 1.3.5 + resolution: "detectincognitojs@npm:1.3.5" + checksum: c812618a526cca98e47ac8a3871feaf6052c0e499eaf77b2eb65ad282172353cbb687a06bfc908bb05a9bdbc09bf6ed204ca06845dd1637b611fff9edf7b1d48 + languageName: node + linkType: hard + "detective-amd@npm:^3.1.0": version: 3.1.2 resolution: "detective-amd@npm:3.1.2"