Skip to content

Commit

Permalink
Fix security vulnerabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiguim committed May 26, 2022
1 parent 4fa51ff commit 7e0d3c3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 3,083 deletions.
2 changes: 1 addition & 1 deletion app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ipcMain.on('OPEN_SETTINGS', (event, arg) => {
})

function initApp(){
const language = settings.get('language')!= null ? settings.get('language') : "en";
const language = settings.getSync('language') != null ? settings.getSync('language') : "en";
// Use 90% of screen size
const screenSize = 0.9;
const screen = require('electron').screen
Expand Down
14 changes: 7 additions & 7 deletions app/components/application-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const log = require('electron-log');
const path = require('path');

function buildUrl(win, language, path) {
electronSettings.set('language', language);
electronSettings.setSync('language', language);
let currLocation = win.getURL();
let locArray = currLocation.split("locale=")[0];

Expand All @@ -15,7 +15,7 @@ function buildUrl(win, language, path) {

module.exports = class ApplicationMenu {
constructor() {
this.language = electronSettings.get('language') != null ? electronSettings.get('general.language') : "en";
this.language = electronSettings.getSync('language') != null ? electronSettings.getSync('general.language') : "en";
this.template;
}

Expand Down Expand Up @@ -53,7 +53,7 @@ module.exports = class ApplicationMenu {
{
label: 'Čeština',
type: 'radio',
checked: (electronSettings.get('language') == 'cs'),
checked: (electronSettings.getSync('language') == 'cs'),
click: () => {
this.language = "cs"
win.loadURL(buildUrl(win, this.language, "#" + win.getURL().split("#")[1]));
Expand All @@ -62,7 +62,7 @@ module.exports = class ApplicationMenu {
{
label: 'Deutsch',
type: 'radio',
checked: (electronSettings.get('language') == 'de'),
checked: (electronSettings.getSync('language') == 'de'),
click: () => {
this.language = "de"
win.loadURL(buildUrl(win, this.language, "#" + win.getURL().split("#")[1]));
Expand All @@ -71,7 +71,7 @@ module.exports = class ApplicationMenu {
{
label: 'English',
type: 'radio',
checked: (electronSettings.get('language') == null || electronSettings.get('language') == 'en'),
checked: (electronSettings.getSync('language') == null || electronSettings.getSync('language') == 'en'),
click: () => {
this.language = "en"
win.loadURL(buildUrl(win, this.language, "#" + win.getURL().split("#")[1]));
Expand All @@ -80,7 +80,7 @@ module.exports = class ApplicationMenu {
{
label: 'Eesti',
type: 'radio',
checked: (electronSettings.get('language') == 'et'),
checked: (electronSettings.getSync('language') == 'et'),
click: () => {
this.language = "et"
win.loadURL(buildUrl(win, this.language, "#" + win.getURL().split("#")[1]));
Expand All @@ -89,7 +89,7 @@ module.exports = class ApplicationMenu {
{
label: 'Português Europeu',
type: 'radio',
checked: (electronSettings.get('language') == 'pt_PT'),
checked: (electronSettings.getSync('language') == 'pt_PT'),
click: () => {
this.language = "pt_PT"
win.loadURL(buildUrl(win, this.language, "#" + win.getURL().split("#")[1]));
Expand Down
4 changes: 2 additions & 2 deletions app/components/dbvtk.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ module.exports = class Dbvtk {

let memoryManager = new MemoryManager()
let maxHeapMemory = memoryManager.getMaxHeapMemorySettings();
let tmpDir = electronSettings.get('tmpDir');
let disableTimezone = electronSettings.get('disableTimezone');
let tmpDir = electronSettings.getSync('tmpDir');
let disableTimezone = electronSettings.getSync('disableTimezone');

// Ask for a random unassigned port and to write it down in serverPortFile
let javaVMParameters = [
Expand Down
12 changes: 6 additions & 6 deletions app/components/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ module.exports = class Settings {
this.log.info("Applying new settings")
this.log.info("Memory = " + data.memory)
this.memoryManager.setMaxHeapMemorySettings(data.memory);
electronSettings.set("language", data.language)
electronSettings.set('tmpDir', data.tmpDir)
electronSettings.set('disableTimezone', data.disableTimezone)
electronSettings.setSync("language", data.language)
electronSettings.setSync('tmpDir', data.tmpDir)
electronSettings.setSync('disableTimezone', data.disableTimezone)
app.relaunch();
app.quit();
});
Expand All @@ -86,13 +86,13 @@ module.exports = class Settings {

buildSettings() {
const data = {
"language" : electronSettings.get('language'),
"language" : electronSettings.getSync('language'),
"maxHeapMemorySettings" : this.memoryManager.getMaxHeapMemorySettings(),
"OsMemory" : this.memoryManager.getOsMemoryTotal(),
"freeMemory" : this.memoryManager.getFreeMemory(),
"minMemory" : this.memoryManager.getMinHeapMemory(),
"tmpDir" : electronSettings.get('tmpDir'),
"disableTimezone" : electronSettings.get('disableTimezone', true),
"tmpDir" : electronSettings.getSync('tmpDir'),
"disableTimezone" : electronSettings.getSync('disableTimezone', true),
"fileLocation" : electronSettings.file()
}
this.window.webContents.send("BUILD_SETTINGS_EVENT", data);
Expand Down
10 changes: 5 additions & 5 deletions app/helpers/memoryManagerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = class MemoryManager {
}

getMaxHeapMemorySettings() {
let memorySettings = electronSettings.get('maxHeapMemory');
let memorySettings = electronSettings.getSync('maxHeapMemory');
if( memorySettings <= this.getOsMemoryTotal() && memorySettings >= this.getMinHeapMemory() ) {
log.info("Configured memory: " + this.getHumanizedMemoryValue(memorySettings) + "GB")
return electronSettings.get('maxHeapMemory');
return electronSettings.getSync('maxHeapMemory');
}
if( memorySettings == null ){
log.info("Memory is not set")
Expand All @@ -30,17 +30,17 @@ module.exports = class MemoryManager {
log.warn("Configured memory ("+ this.getHumanizedMemoryValue(memorySettings)+") is less than the minimum required")
}
log.info("Delegating responsibility to the JVM")
electronSettings.delete('maxHeapMemory')
electronSettings.unset('maxHeapMemory')
return null;
}

setMaxHeapMemorySettings(maxHeapMemory) {
if( maxHeapMemory <= this.getOsMemoryTotal() && maxHeapMemory >= this.getMinHeapMemory() ) {
log.info("setting heap memory to: " + this.getHumanizedMemoryValue(maxHeapMemory) + "GB")
electronSettings.set('maxHeapMemory', maxHeapMemory);
electronSettings.setSync('maxHeapMemory', maxHeapMemory);
} else {
log.warn("Delegating responsibility to the JVM")
electronSettings.delete('maxHeapMemory')
electronSettings.unset('maxHeapMemory')
}
}

Expand Down
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,16 @@
},
"license": "LGPL-3.0-or-later",
"devDependencies": {
"electron": "12.0.6",
"electron-builder": "^22.11.1",
"electron-packager": "^13.1.1"
"electron": "19.0.1",
"electron-builder": "^23.0.3",
"electron-packager": "^15.5.1"
},
"dependencies": {
"clean": "^4.0.2",
"electron-log": "^4.2.4",
"electron-settings": "^3.2.0",
"electron-updater": "^4.0.6",
"tmp": "^0.1.0",
"tree-kill": "^1.2.1",
"wait-on": "^3.2.0"
"electron-log": "^4.4.7",
"electron-settings": "^4.0.2",
"electron-updater": "^5.0.1",
"tmp": "^0.2.1",
"tree-kill": "^1.2.2",
"wait-on": "^6.0.1"
}
}
Loading

0 comments on commit 7e0d3c3

Please sign in to comment.