mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 14:23:58 +00:00
#782 disable auto upgrade workaround
This commit is contained in:
@@ -17,6 +17,7 @@ const path = require('path');
|
|||||||
const url = require('url');
|
const url = require('url');
|
||||||
const mainMenuDefinition = require('./mainMenuDefinition');
|
const mainMenuDefinition = require('./mainMenuDefinition');
|
||||||
const { settings } = require('cluster');
|
const { settings } = require('cluster');
|
||||||
|
let disableAutoUpgrade = false;
|
||||||
|
|
||||||
// require('@electron/remote/main').initialize();
|
// require('@electron/remote/main').initialize();
|
||||||
|
|
||||||
@@ -49,11 +50,21 @@ const isMac = () => os.platform() == 'darwin';
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
initialConfig = JSON.parse(fs.readFileSync(configRootPath, { encoding: 'utf-8' }));
|
initialConfig = JSON.parse(fs.readFileSync(configRootPath, { encoding: 'utf-8' }));
|
||||||
|
disableAutoUpgrade = initialConfig['disableAutoUpgrade'] || false;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error loading config-root:', err.message);
|
console.log('Error loading config-root:', err.message);
|
||||||
initialConfig = {};
|
initialConfig = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.argv.includes('--disable-auto-upgrade')) {
|
||||||
|
console.log('Disabling auto-upgrade');
|
||||||
|
disableAutoUpgrade = true;
|
||||||
|
}
|
||||||
|
if (process.argv.includes('--enable-auto-upgrade')) {
|
||||||
|
console.log('Enabling auto-upgrade');
|
||||||
|
disableAutoUpgrade = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
@@ -321,6 +332,7 @@ function createWindow() {
|
|||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
winBounds: mainWindow.getBounds(),
|
winBounds: mainWindow.getBounds(),
|
||||||
winIsMaximized: mainWindow.isMaximized(),
|
winIsMaximized: mainWindow.isMaximized(),
|
||||||
|
disableAutoUpgrade,
|
||||||
}),
|
}),
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
@@ -383,7 +395,10 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onAppReady() {
|
function onAppReady() {
|
||||||
if (!process.env.DEVMODE) {
|
if (disableAutoUpgrade) {
|
||||||
|
console.log('Auto-upgrade is disabled, run dbgate --enable-auto-upgrade to enable');
|
||||||
|
}
|
||||||
|
if (!process.env.DEVMODE && !disableAutoUpgrade) {
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
}
|
}
|
||||||
createWindow();
|
createWindow();
|
||||||
|
|||||||
Reference in New Issue
Block a user