From 9c1c22ada71e413a32f57a488586e04a8a394061 Mon Sep 17 00:00:00 2001 From: Ochieng Paul Date: Fri, 17 Nov 2023 15:55:36 +0300 Subject: [PATCH 1/4] disabled dev tools for production env --- netmanager/src/App.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/netmanager/src/App.js b/netmanager/src/App.js index a9a4365a87..e6484bcfc7 100644 --- a/netmanager/src/App.js +++ b/netmanager/src/App.js @@ -1,5 +1,5 @@ /* eslint-disable */ -import React from 'react'; +import React, { useEffect } from 'react'; import './App.css'; import jwt_decode from 'jwt-decode'; @@ -47,6 +47,24 @@ if (localStorage.jwtToken) { } const App = () => { + useEffect(() => { + if (process.env.REACT_APP_ALLOW_DEV_TOOLS === 'staging2') { + return; + } else { + // Disable context menu (right click) + document.addEventListener('contextmenu', (e) => { + e.preventDefault(); + }); + + // Disable F12 key (open developer tools) + document.addEventListener('keydown', (e) => { + if (e.keyCode === 123) { + e.preventDefault(); + } + }); + } + }, []); + return ( From 9f73b38ef14ed5294278184ca93e446f66e03555 Mon Sep 17 00:00:00 2001 From: Ochieng Paul Date: Fri, 17 Nov 2023 15:56:25 +0300 Subject: [PATCH 2/4] Update App.js --- netmanager/src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netmanager/src/App.js b/netmanager/src/App.js index e6484bcfc7..ed803086d9 100644 --- a/netmanager/src/App.js +++ b/netmanager/src/App.js @@ -48,7 +48,7 @@ if (localStorage.jwtToken) { const App = () => { useEffect(() => { - if (process.env.REACT_APP_ALLOW_DEV_TOOLS === 'staging2') { + if (process.env.REACT_APP_ALLOW_DEV_TOOLS === 'staging') { return; } else { // Disable context menu (right click) From bbc6e15656a6ed48125e1771e015b4219828f602 Mon Sep 17 00:00:00 2001 From: Ochieng Paul Date: Fri, 17 Nov 2023 16:01:59 +0300 Subject: [PATCH 3/4] Update .env.sample --- netmanager/.env.sample | 1 + 1 file changed, 1 insertion(+) diff --git a/netmanager/.env.sample b/netmanager/.env.sample index ed6fdafdcb..6442645105 100644 --- a/netmanager/.env.sample +++ b/netmanager/.env.sample @@ -1,3 +1,4 @@ +REACT_APP_ALLOW_DEV_TOOLS=12345689 REACT_APP_BASE_URL=https://staging-platform.airqo.net/api/v1/ REACT_APP_BASE_URL_V2=https://staging-platform.airqo.net/api/v2/ REACT_APP_BASE_ANALYTICS_URL= From 83dbe0e59076ab18ec5e8fbe60cbd8d4c1726744 Mon Sep 17 00:00:00 2001 From: Ochieng Paul Date: Fri, 17 Nov 2023 16:11:55 +0300 Subject: [PATCH 4/4] Update App.js --- netmanager/src/App.js | 1 + 1 file changed, 1 insertion(+) diff --git a/netmanager/src/App.js b/netmanager/src/App.js index ed803086d9..7eec5ebbd8 100644 --- a/netmanager/src/App.js +++ b/netmanager/src/App.js @@ -47,6 +47,7 @@ if (localStorage.jwtToken) { } const App = () => { + // disabling feature useEffect(() => { if (process.env.REACT_APP_ALLOW_DEV_TOOLS === 'staging') { return;