Skip to content

Commit

Permalink
- Inform users about deleting .aws/credentials: now the system makes …
Browse files Browse the repository at this point in the history
…a backup and inform you

- New Application Menu for MAC Users preventing hard refresh
- Removed undefined from proxy input in profile page
- Added temporary credentials for plain in order to NOT save the plain ones
  • Loading branch information
urz9999 committed Oct 5, 2020
1 parent b65c5ea commit e8cefdb
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 34 deletions.
29 changes: 25 additions & 4 deletions electron/dist/electron/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion electron/dist/electron/main.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 28 additions & 5 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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';
}
Expand Down
Loading

0 comments on commit e8cefdb

Please sign in to comment.