diff --git a/src/main/index.js b/src/main/index.js index 36e8f6996..c678f6579 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -75,6 +75,9 @@ app.on('ready', async () => { await installExtensions(); } rendererWindow = createWindow(appState); + rendererWindow.webContents.on('devtools-opened', () => { + rendererWindow.webContents.send('devtools-is-opened'); + }); tray = createTray(rendererWindow); }); diff --git a/src/renderer/index.js b/src/renderer/index.js index ceb8804f0..811a48b47 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -16,6 +16,7 @@ import 'scss/all.scss'; import store from 'store'; import app from './app'; import analytics from './analytics'; +import doLogWarningConsoleMessage from './logWarningConsoleMessage'; import { initContextMenu } from './util/contextMenu'; const { autoUpdater } = remote.require('electron-updater'); @@ -73,6 +74,11 @@ ipcRenderer.on('window-is-focused', () => { dock.setBadge(''); }); +ipcRenderer.on('devtools-is-opened', () => { + const logOnDevelopment = false; + doLogWarningConsoleMessage(logOnDevelopment); +}); + document.addEventListener('dragover', event => { event.preventDefault(); }); diff --git a/src/renderer/logWarningConsoleMessage.js b/src/renderer/logWarningConsoleMessage.js new file mode 100644 index 000000000..12f0d1a0e --- /dev/null +++ b/src/renderer/logWarningConsoleMessage.js @@ -0,0 +1,34 @@ +import isDev from 'electron-is-dev'; + +export default function doLogWarningConsoleMessage(activeOnDev = false) { + if (isDev && !activeOnDev) return; + const style = { + redTitle: + 'color: red; font-size: 50px; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;, font-weight: bold;', + normalText: 'font-size: 24px;', + redText: + 'color: red; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; font-size: 24px;', + }; + console.clear(); + console.log('%cScam alert!', style.redTitle); + + console.log( + '%cIf someone told you to copy / paste something here you have a chance of being scammed.', + style.normalText + ); + + console.log( + '%cPasting anything in here could give attackers access to your LBC credits or wallet.', + style.normalText + ); + + console.log( + "%cIf you don't understand what you are doing here, please close this window and keep your LBC credits/wallet safe.", + style.redText + ); + + console.log( + '%cIf you do understand exactly what you are doing, you should come work with us https://lbry.io/join-us', + style.normalText + ); +}