mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
feat: Auto Update
- Ability to disable auto update from System tab in Settings
This commit is contained in:
parent
de19af85c4
commit
a3506bf015
@ -95,6 +95,13 @@ module.exports = {
|
||||
label: 'Fiscal Year End Date',
|
||||
fieldtype: 'Date',
|
||||
required: 1
|
||||
},
|
||||
|
||||
{
|
||||
fieldname: 'autoUpdate',
|
||||
label: 'Auto Update',
|
||||
fieldtype: 'Check',
|
||||
default: 1
|
||||
}
|
||||
],
|
||||
quickEditFields: [
|
||||
|
@ -39,6 +39,7 @@
|
||||
"babel-eslint": "^10.0.3",
|
||||
"electron": "^6.0.0",
|
||||
"electron-notarize": "^0.2.1",
|
||||
"electron-updater": "^4.2.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-prettier": "^3.1.1",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
|
@ -88,6 +88,7 @@ export default {
|
||||
this.showSettings = true;
|
||||
} else {
|
||||
this.showDesk = true;
|
||||
this.checkForUpdates();
|
||||
}
|
||||
this.showSetupWizard = false;
|
||||
this.showDatabaseSelector = false;
|
||||
@ -101,6 +102,9 @@ export default {
|
||||
if (this.showSettings) {
|
||||
frappe.events.trigger('reload-main-window');
|
||||
}
|
||||
},
|
||||
checkForUpdates() {
|
||||
frappe.events.trigger('check-for-updates');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,11 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
import { app, protocol, BrowserWindow, ipcMain } from 'electron';
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
import {
|
||||
createProtocol,
|
||||
installVueDevtools
|
||||
} from 'vue-cli-plugin-electron-builder/lib';
|
||||
import theme from '@/theme';
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||
const isMac = process.platform === 'darwin';
|
||||
|
||||
@ -13,6 +15,7 @@ const isMac = process.platform === 'darwin';
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow;
|
||||
let winURL;
|
||||
let checkedForUpdate = false;
|
||||
|
||||
// Scheme must be registered before the app is ready
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
@ -69,6 +72,13 @@ function createSettingsWindow(tab = 'General') {
|
||||
settingsWindow.loadURL(`${winURL}#/settings/${tab}`);
|
||||
}
|
||||
|
||||
ipcMain.on('check-for-updates', () => {
|
||||
if (!isDevelopment && !checkedForUpdate) {
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
checkedForUpdate = true;
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('open-settings-window', (event, tab) => {
|
||||
createSettingsWindow(tab);
|
||||
});
|
||||
|
@ -61,6 +61,13 @@ import router from './router';
|
||||
ipcRenderer.send('reload-main-window');
|
||||
});
|
||||
|
||||
frappe.events.on('check-for-updates', () => {
|
||||
let { autoUpdate } = frappe.AccountingSettings;
|
||||
if (autoUpdate == null || autoUpdate === 1) {
|
||||
ipcRenderer.send('check-for-updates');
|
||||
}
|
||||
});
|
||||
|
||||
frappe.events.on('SetupWizard:setup-complete', async setupWizardValues => {
|
||||
const countryList = require('../fixtures/countryInfo.json');
|
||||
const {
|
||||
|
@ -31,12 +31,24 @@
|
||||
:fields="fields"
|
||||
:autosave="true"
|
||||
/>
|
||||
<div class="mt-6">
|
||||
<FormControl
|
||||
:df="AccountingSettings.meta.getField('autoUpdate')"
|
||||
@change="value => AccountingSettings.update('autoUpdate', value)"
|
||||
:value="AccountingSettings.autoUpdate"
|
||||
/>
|
||||
<p class="pl-6 mt-1 text-sm text-gray-600">
|
||||
<!-- prettier-ignore -->
|
||||
{{ _('Automatically check for updates and download them if available. The update will be applied after you restart the app.') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import frappe from 'frappejs';
|
||||
import TwoColumnForm from '@/components/TwoColumnForm';
|
||||
import FormControl from '@/components/Controls/FormControl';
|
||||
import Button from '@/components/Button';
|
||||
import { createNewDatabase, loadExistingDatabase } from '@/utils';
|
||||
import { remote } from 'electron';
|
||||
@ -45,6 +57,7 @@ export default {
|
||||
name: 'TabSystem',
|
||||
components: {
|
||||
TwoColumnForm,
|
||||
FormControl,
|
||||
Button
|
||||
},
|
||||
data() {
|
||||
@ -78,6 +91,9 @@ export default {
|
||||
},
|
||||
dbPath() {
|
||||
return localStorage.dbPath;
|
||||
},
|
||||
AccountingSettings() {
|
||||
return frappe.AccountingSettings;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
34
yarn.lock
34
yarn.lock
@ -880,6 +880,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8"
|
||||
integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==
|
||||
|
||||
"@types/semver@^6.0.2":
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.2.0.tgz#d688d574400d96c5b0114968705366f431831e1a"
|
||||
integrity sha512-1OzrNb4RuAzIT7wHSsgZRlMBlNsJl+do6UblR7JMW4oB7bbR+uBEYtUh7gEc/jM84GGilh68lSOokyM/zNUlBA==
|
||||
|
||||
"@vue/babel-helper-vue-jsx-merge-props@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0.tgz#048fe579958da408fb7a8b2a3ec050b50a661040"
|
||||
@ -2213,6 +2218,14 @@ builder-util-runtime@8.3.0:
|
||||
debug "^4.1.1"
|
||||
sax "^1.2.4"
|
||||
|
||||
builder-util-runtime@8.4.0:
|
||||
version "8.4.0"
|
||||
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.4.0.tgz#3163fffc078e6b8f3dd5b6eb12a8345573590682"
|
||||
integrity sha512-CJB/eKfPf2vHrkmirF5eicVnbDCkMBbwd5tRYlTlgud16zFeqD7QmrVUAOEXdnsrcNkiLg9dbuUsQKtl/AwsYQ==
|
||||
dependencies:
|
||||
debug "^4.1.1"
|
||||
sax "^1.2.4"
|
||||
|
||||
builder-util@21.2.0, builder-util@~21.2.0:
|
||||
version "21.2.0"
|
||||
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-21.2.0.tgz#aba721190e4e841009d9fb4b88f1130ed616522f"
|
||||
@ -3903,6 +3916,20 @@ electron-to-chromium@^1.3.322:
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8"
|
||||
integrity sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA==
|
||||
|
||||
electron-updater@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.2.0.tgz#f9ecfc657f65ead737d42b9efecf628d3756b550"
|
||||
integrity sha512-GuS3g7HDh17x/SaFjxjswlWUaKHczksYkV2Xc5CKj/bZH0YCvTSHtOmnBAdAmCk99u/71p3zP8f0jIqDfGcjww==
|
||||
dependencies:
|
||||
"@types/semver" "^6.0.2"
|
||||
builder-util-runtime "8.4.0"
|
||||
fs-extra "^8.1.0"
|
||||
js-yaml "^3.13.1"
|
||||
lazy-val "^1.0.4"
|
||||
lodash.isequal "^4.5.0"
|
||||
pako "^1.0.10"
|
||||
semver "^6.3.0"
|
||||
|
||||
electron@5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.0.tgz#d8352e2c9625b3be0112ce0c1bf5c9b6f692557e"
|
||||
@ -6645,6 +6672,11 @@ lodash.defaultsdeep@^4.6.1:
|
||||
resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6"
|
||||
integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==
|
||||
|
||||
lodash.isequal@^4.5.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
|
||||
integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=
|
||||
|
||||
lodash.kebabcase@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"
|
||||
@ -7858,7 +7890,7 @@ package-json@^6.3.0:
|
||||
registry-url "^5.0.0"
|
||||
semver "^6.2.0"
|
||||
|
||||
pako@~1.0.2, pako@~1.0.5:
|
||||
pako@^1.0.10, pako@~1.0.2, pako@~1.0.5:
|
||||
version "1.0.10"
|
||||
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732"
|
||||
integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==
|
||||
|
Loading…
x
Reference in New Issue
Block a user