mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
configurable auto-update mode
This commit is contained in:
@@ -29,6 +29,7 @@ let mainModule;
|
|||||||
// let getLogger;
|
// let getLogger;
|
||||||
// let loadLogsContent;
|
// let loadLogsContent;
|
||||||
let appUpdateStatus = '';
|
let appUpdateStatus = '';
|
||||||
|
let settingsJson = {};
|
||||||
|
|
||||||
process.on('uncaughtException', function (error) {
|
process.on('uncaughtException', function (error) {
|
||||||
console.error('uncaughtException', error);
|
console.error('uncaughtException', error);
|
||||||
@@ -285,6 +286,7 @@ ipcMain.on('applyUpdate', async (event, url) => {
|
|||||||
autoUpdater.quitAndInstall(false, true);
|
autoUpdater.quitAndInstall(false, true);
|
||||||
});
|
});
|
||||||
ipcMain.on('check-for-updates', async (event, url) => {
|
ipcMain.on('check-for-updates', async (event, url) => {
|
||||||
|
autoUpdater.autoDownload = false;
|
||||||
autoUpdater.checkForUpdates();
|
autoUpdater.checkForUpdates();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -324,7 +326,6 @@ function ensureBoundsVisible(bounds) {
|
|||||||
function createWindow() {
|
function createWindow() {
|
||||||
const datadir = path.join(os.homedir(), '.dbgate');
|
const datadir = path.join(os.homedir(), '.dbgate');
|
||||||
|
|
||||||
let settingsJson = {};
|
|
||||||
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' }))
|
||||||
@@ -485,8 +486,10 @@ autoUpdater.on('error', error => {
|
|||||||
|
|
||||||
function onAppReady() {
|
function onAppReady() {
|
||||||
if (!process.env.DEVMODE) {
|
if (!process.env.DEVMODE) {
|
||||||
autoUpdater.autoDownload = false;
|
if (settingsJson['app.autoUpdateMode'] != 'skip') {
|
||||||
autoUpdater.checkForUpdates();
|
autoUpdater.autoDownload = settingsJson['app.autoUpdateMode'] == 'download';
|
||||||
|
autoUpdater.checkForUpdates();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
createWindow();
|
createWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,6 +342,18 @@ ORDER BY
|
|||||||
<div class="heading">Other</div>
|
<div class="heading">Other</div>
|
||||||
|
|
||||||
<FormTextField name="other.gistCreateToken" label="API token for creating error gists" defaultValue="" />
|
<FormTextField name="other.gistCreateToken" label="API token for creating error gists" defaultValue="" />
|
||||||
|
|
||||||
|
<FormSelectField
|
||||||
|
label="Auto update application"
|
||||||
|
name="app.autoUpdateMode"
|
||||||
|
isNative
|
||||||
|
defaultValue=""
|
||||||
|
options={[
|
||||||
|
{ value: 'skip', label: 'Do not check for new versions' },
|
||||||
|
{ value: '', label: 'Check for new versions' },
|
||||||
|
{ value: 'download', label: 'Check and download new versions' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
|
||||||
<svelte:fragment slot="7">
|
<svelte:fragment slot="7">
|
||||||
|
|||||||
Reference in New Issue
Block a user