Merge pull request #1500 from dan1d/alert-scam

Add scam alert message when opening development tools.
This commit is contained in:
Sean Yesmunt 2018-05-31 22:10:13 -04:00 committed by GitHub
commit be98940ec1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 0 deletions

View file

@ -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);
});

View file

@ -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();
});

View file

@ -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
);
}