mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 09:03:58 +00:00
removed obsolete code
This commit is contained in:
@@ -18,7 +18,6 @@ const url = require('url');
|
|||||||
const mainMenuDefinition = require('./mainMenuDefinition');
|
const mainMenuDefinition = require('./mainMenuDefinition');
|
||||||
const { isProApp } = require('./proTools');
|
const { isProApp } = require('./proTools');
|
||||||
const updaterChannel = require('./updaterChannel');
|
const updaterChannel = require('./updaterChannel');
|
||||||
let disableAutoUpgrade = false;
|
|
||||||
|
|
||||||
// require('@electron/remote/main').initialize();
|
// require('@electron/remote/main').initialize();
|
||||||
|
|
||||||
@@ -52,21 +51,11 @@ 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;
|
||||||
@@ -323,7 +312,6 @@ function createWindow() {
|
|||||||
const datadir = path.join(os.homedir(), '.dbgate');
|
const datadir = path.join(os.homedir(), '.dbgate');
|
||||||
|
|
||||||
let settingsJson = {};
|
let settingsJson = {};
|
||||||
let licenseKey = null;
|
|
||||||
try {
|
try {
|
||||||
settingsJson = fillMissingSettings(
|
settingsJson = fillMissingSettings(
|
||||||
JSON.parse(fs.readFileSync(path.join(datadir, 'settings.json'), { encoding: 'utf-8' }))
|
JSON.parse(fs.readFileSync(path.join(datadir, 'settings.json'), { encoding: 'utf-8' }))
|
||||||
@@ -332,14 +320,6 @@ function createWindow() {
|
|||||||
console.log('Error loading settings.json:', err.message);
|
console.log('Error loading settings.json:', err.message);
|
||||||
settingsJson = fillMissingSettings({});
|
settingsJson = fillMissingSettings({});
|
||||||
}
|
}
|
||||||
if (isProApp()) {
|
|
||||||
try {
|
|
||||||
licenseKey = fs.readFileSync(path.join(datadir, 'license.key'), { encoding: 'utf-8' });
|
|
||||||
} catch (err) {
|
|
||||||
console.log('Error loading license.key:', err.message);
|
|
||||||
licenseKey = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let bounds = initialConfig['winBounds'];
|
let bounds = initialConfig['winBounds'];
|
||||||
if (bounds) {
|
if (bounds) {
|
||||||
@@ -389,7 +369,6 @@ function createWindow() {
|
|||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
winBounds: mainWindow.getBounds(),
|
winBounds: mainWindow.getBounds(),
|
||||||
winIsMaximized: mainWindow.isMaximized(),
|
winIsMaximized: mainWindow.isMaximized(),
|
||||||
disableAutoUpgrade,
|
|
||||||
}),
|
}),
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
@@ -460,11 +439,9 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onAppReady() {
|
function onAppReady() {
|
||||||
if (disableAutoUpgrade) {
|
if (!process.env.DEVMODE) {
|
||||||
console.log('Auto-upgrade is disabled, run dbgate --enable-auto-upgrade to enable');
|
autoUpdater.autoDownload = false;
|
||||||
}
|
autoUpdater.checkForUpdates();
|
||||||
if (!process.env.DEVMODE && !disableAutoUpgrade) {
|
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
|
||||||
}
|
}
|
||||||
createWindow();
|
createWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user