diff --git a/electron/dist/electron/main.js b/electron/dist/electron/main.js index f6e1831d2..10c01493c 100644 --- a/electron/dist/electron/main.js +++ b/electron/dist/electron/main.js @@ -16,9 +16,8 @@ var environment_1 = require("../src/environments/environment"); var CryptoJS = require("crypto-js"); var initial_configuration_1 = require("../src/app/core/initial-configuration"); var node_machine_id_1 = require("node-machine-id"); -var _a = require('electron'), app = _a.app, BrowserWindow = _a.BrowserWindow; +var _a = require('electron'), app = _a.app, BrowserWindow = _a.BrowserWindow, globalShortcut = _a.globalShortcut, Menu = _a.Menu, dialog = _a.dialog; var url = require('url'); -var copydir = require('copy-dir'); var fs = require('fs'); var os = require('os'); var log = require('electron-log'); @@ -61,9 +60,9 @@ var setupWorkspace = function () { } finally { try { - // If it is the first time, let's backup the file + // If it is the first time and there's a file, let's backup the file if (!fs.existsSync(workspacePath) && fs.existsSync(awsCredentialsPath)) { - fs.renameSync(awsCredentialsPath, awsCredentialsPath + '.bkp'); + fs.renameSync(awsCredentialsPath, awsCredentialsPath + '.leapp.bkp'); } // Write workspace file fs.writeFileSync(workspacePath, CryptoJS.AES.encrypt(JSON.stringify(initial_configuration_1.initialConfiguration, null, 2), node_machine_id_1.machineIdSync()).toString()); @@ -108,6 +107,18 @@ var generateMainWindow = function () { win.destroy(); app.quit(); }); + app.on('browser-window-focus', function () { + globalShortcut.register('CommandOrControl+R', function () { + console.log('CommandOrControl+R is pressed: Shortcut Disabled'); + }); + globalShortcut.register('F5', function () { + console.log('F5 is pressed: Shortcut Disabled'); + }); + }); + app.on('browser-window-blur', function () { + globalShortcut.unregister('CommandOrControl+R'); + globalShortcut.unregister('F5'); + }); }; app.on('activate', function () { if (win === null || win === undefined) { @@ -142,6 +153,16 @@ var generateMainWindow = function () { }; // Prepare and generate the main window if everything is setupped correctly var initWorkspace = function () { + // Remove unused voices from contextual menu + Menu.setApplicationMenu(Menu.buildFromTemplate([ + { + label: 'Leapp', + submenu: [ + { label: 'About', role: 'about' }, + { label: 'Quit', role: 'quit' } + ] + } + ])); if (process.platform === 'linux' && ['Pantheon', 'Unity:Unity7'].indexOf(process.env.XDG_CURRENT_DESKTOP) !== -1) { process.env.XDG_CURRENT_DESKTOP = 'Unity'; } diff --git a/electron/dist/electron/main.js.map b/electron/dist/electron/main.js.map index cfb7f3409..09b49ca19 100644 --- a/electron/dist/electron/main.js.map +++ b/electron/dist/electron/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["../../main.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2BAA6B;AAC7B,+DAA4D;AAC5D,oCAAsC;AACtC,+EAA2E;AAC3E,mDAA8C;AAGxC,IAAA,wBAA0C,EAAzC,YAAG,EAAE,gCAAoC,CAAC;AACjD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3B,IAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AACpC,IAAM,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC;AAC3C,IAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;AAExC,6BAA6B;AAC7B,GAAG,CAAC,yBAAyB,GAAG,IAAI,CAAC;AACrC,GAAG,CAAC,2BAA2B,EAAE,CAAC;AAElC,kFAAkF;AAClF,8EAA8E;AAC9E,gDAAgD;AAChD,IAAM,mBAAmB,GAAG;IAC1B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC;IACxD,aAAa,EAAE;QACb,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EA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qC;AACrC,aAAa,EAAE,CAAC"} \ No newline at end of file diff --git a/electron/main.ts b/electron/main.ts index 812a33348..b3daf46b6 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -5,9 +5,8 @@ import {initialConfiguration} from '../src/app/core/initial-configuration'; import {machineIdSync} from 'node-machine-id'; import {Workspace} from '../src/app/models/workspace'; -const {app, BrowserWindow} = require('electron'); +const {app, BrowserWindow, globalShortcut, Menu, dialog} = require('electron'); const url = require('url'); -const copydir = require('copy-dir'); const fs = require('fs'); const os = require('os'); const log = require('electron-log'); @@ -55,9 +54,9 @@ const setupWorkspace = () => { } finally { try { - // If it is the first time, let's backup the file + // If it is the first time and there's a file, let's backup the file if (!fs.existsSync(workspacePath) && fs.existsSync(awsCredentialsPath)) { - fs.renameSync(awsCredentialsPath, awsCredentialsPath + '.bkp'); + fs.renameSync(awsCredentialsPath, awsCredentialsPath + '.leapp.bkp'); } // Write workspace file @@ -82,7 +81,6 @@ const generateMainWindow = () => { let forceQuit = false; const createWindow = () => { - // Generate the App Window win = new BrowserWindow({...windowDefaultConfig.browserWindow}); win.setMenuBarVisibility(false); // Hide Window Menu to make it compliant with MacOSX @@ -110,6 +108,20 @@ const generateMainWindow = () => { win.destroy(); app.quit(); }); + + app.on('browser-window-focus', () => { + globalShortcut.register('CommandOrControl+R', () => { + console.log('CommandOrControl+R is pressed: Shortcut Disabled'); + }); + globalShortcut.register('F5', () => { + console.log('F5 is pressed: Shortcut Disabled'); + }); + }); + + app.on('browser-window-blur', () => { + globalShortcut.unregister('CommandOrControl+R'); + globalShortcut.unregister('F5'); + }); }; app.on('activate', () => { @@ -148,6 +160,17 @@ const generateMainWindow = () => { // Prepare and generate the main window if everything is setupped correctly const initWorkspace = () => { + // Remove unused voices from contextual menu + Menu.setApplicationMenu(Menu.buildFromTemplate([ + { + label: 'Leapp', + submenu: [ + { label: 'About', role: 'about' }, + { label: 'Quit', role: 'quit' } + ] + } + ])); + if (process.platform === 'linux' && ['Pantheon', 'Unity:Unity7'].indexOf(process.env.XDG_CURRENT_DESKTOP) !== -1) { process.env.XDG_CURRENT_DESKTOP = 'Unity'; } diff --git a/package-lock.json b/package-lock.json index e82fca892..60a9ada05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3892,8 +3892,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.1.tgz", "integrity": "sha512-HRZPIjPcbwAVQvOTxR4YE3o8Xs98NqbbL1iEZDCz7CL8ql0Lt5iOyJFxfnAB0oFs8Oh02F/lLlg30Mexv46LjA==", - "dev": true, - "optional": true + "dev": true }, "bootstrap": { "version": "4.5.2", @@ -6346,6 +6345,11 @@ } } }, + "electron-default-menu": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/electron-default-menu/-/electron-default-menu-1.0.2.tgz", + "integrity": "sha512-YAL/UNR3kPG58wOOlmDpTG3i6+bzwhHx6NllIOaLuVrU7uYifeYGGdk5IH2Hap4wVEx2YTA8cqQ2PGSplYwDWQ==" + }, "electron-installer-dmg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/electron-installer-dmg/-/electron-installer-dmg-3.0.0.tgz", @@ -8865,8 +8869,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/imul/-/imul-1.0.1.tgz", "integrity": "sha1-nVhnFh6LPelsLDjV3HyxAvNeKsk=", - "dev": true, - "optional": true + "dev": true }, "imurmurhash": { "version": "0.1.4", @@ -9339,8 +9342,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true, - "optional": true + "dev": true }, "is-regex": { "version": "1.1.1", @@ -16068,7 +16070,6 @@ "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "dev": true, - "optional": true, "requires": { "arr-flatten": "^1.1.0", "array-unique": "^0.3.2", @@ -16087,7 +16088,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -16120,7 +16120,6 @@ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true, - "optional": true, "requires": { "extend-shallow": "^2.0.1", "is-number": "^3.0.0", @@ -16133,7 +16132,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -16189,7 +16187,6 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2" }, @@ -16199,7 +16196,6 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, - "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -16211,7 +16207,6 @@ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, - "optional": true, "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", @@ -16245,7 +16240,6 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", "dev": true, - "optional": true, "requires": { "is-number": "^3.0.0", "repeat-string": "^1.6.1" diff --git a/package.json b/package.json index 2f3e13489..5f74a0d35 100644 --- a/package.json +++ b/package.json @@ -158,6 +158,7 @@ "chdir": "0.0.0", "copy-dir": "^1.3.0", "crypto-js": "^3.3.0", + "electron-default-menu": "^1.0.2", "electron-log": "^3.0.6", "electron-notarize": "^0.1.1", "electron-osx-sign": "^0.4.17", diff --git a/src/app/services-system/app.service.ts b/src/app/services-system/app.service.ts index a2efb7338..69edd2c99 100644 --- a/src/app/services-system/app.service.ts +++ b/src/app/services-system/app.service.ts @@ -6,10 +6,7 @@ import {ConfirmationDialogComponent} from '../shared/confirmation-dialog/confirm import {BsModalService} from 'ngx-bootstrap'; import {FormControl, FormGroup} from '@angular/forms'; import {environment} from '../../environments/environment'; -import {SessionService} from '../services/session.service'; -import {CredentialsService} from '../services/credentials.service'; -import {Workspace} from '../models/workspace'; -import {Session} from '../models/session'; +import {ConfigurationService} from './configuration.service'; @Injectable({ providedIn: 'root' @@ -24,7 +21,7 @@ export class AppService extends NativeService { constructor( private fileService: FileService, private toastr: ToastrService, - private modalService: BsModalService, + private modalService: BsModalService ) { super(); } @@ -36,6 +33,27 @@ export class AppService extends NativeService { return this.app; } + /** + * Return the dialog native object + */ + getDialog() { + return this.dialog; + } + + /** + * Return the native os object + */ + getOS() { + return this.os; + } + + /** + * Return the fs native object + */ + getFs() { + return this.fs; + } + /** * Return the app process */ diff --git a/src/app/services/menu.service.ts b/src/app/services/menu.service.ts index 0c9430216..8e3932247 100644 --- a/src/app/services/menu.service.ts +++ b/src/app/services/menu.service.ts @@ -36,11 +36,6 @@ export class MenuService extends NativeService { } generateMenu() { - // if (this.currentTray) { - // this.currentTray.destroy(); - // this.currentTray = null; - // } - const version = this.appService.getApp().getVersion(); let voices = []; diff --git a/src/app/start/start-screen/start-screen.component.ts b/src/app/start/start-screen/start-screen.component.ts index 1e6583f1b..6d67f97f7 100644 --- a/src/app/start/start-screen/start-screen.component.ts +++ b/src/app/start/start-screen/start-screen.component.ts @@ -5,6 +5,7 @@ import {Router} from '@angular/router'; import {ConfigurationService} from '../../services-system/configuration.service'; import {AntiMemLeak} from '../../core/anti-mem-leak'; import {MenuService} from '../../services/menu.service'; +import {environment} from '../../../environments/environment'; @Component({ selector: 'app-wizard-page', @@ -42,6 +43,9 @@ export class StartScreenComponent extends AntiMemLeak implements OnInit, AfterVi // for the current version of Leapp otherwise alert the user const result = this.verifyWorkspaceIsWellformed(); + // Show a message informing the user if we needed to make a backup of the credential file + this.showCredentialBackupMessageIfNeeded(); + if (result) { // Generate the contextual menu this.menuService.generateMenu(); @@ -110,4 +114,16 @@ export class StartScreenComponent extends AntiMemLeak implements OnInit, AfterVi this.appService.openExternalUrl('https://github.com/Noovolari/leapp/blob/master/README.md'); } + showCredentialBackupMessageIfNeeded() { + const workspace = this.configurationService.getDefaultWorkspaceSync(); + const awsCredentialsPath = this.appService.getOS().homedir() + '/' + environment.credentialsDestination + '.leapp.bkp'; + + if (JSON.stringify(workspace) === '{}' && this.appService.getFs().existsSync(awsCredentialsPath)) { + this.appService.getDialog().showMessageBox({ + type: 'info', + icon: __dirname + '/assets/images/Leapp.png', + message: 'You had a previous credential file. We made a backup of the old one in the same directory before starting.' + }); + } + } }