Skip to content

Commit 93ccec0

Browse files
committed
WIP Added update button
Need to finish GUI to show user that application checks for updates, finds them, downloads them and installs them
1 parent 961d0e6 commit 93ccec0

File tree

5 files changed

+67
-3
lines changed

5 files changed

+67
-3
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lazy-admin",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "GUI for PowerShell scripts to simplify day to day IT tasks.",
55
"productName": "Lazy Admin",
66
"cordovaId": "eu.houby-studio.lazy-admin",
@@ -14,6 +14,8 @@
1414
},
1515
"dependencies": {
1616
"@quasar/extras": "^1.6.4",
17+
"electron-log": "^4.1.1",
18+
"electron-updater": "^4.3.1",
1719
"node-powershell": "^4.0.0",
1820
"quasar": "^1.9.16",
1921
"vue-clipboard2": "^0.3.1",

quasar.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function (ctx) {
66
// app boot file (/src/boot)
77
// --> boot files are part of "main.js"
88
// https://quasar.dev/quasar-cli/cli-documentation/boot-files
9-
boot: ['i18n', 'powershell', 'titlebar-color', 'clipboard2'],
9+
boot: ['electron-log', 'i18n', 'powershell', 'titlebar-color', 'clipboard2'],
1010

1111
// https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css
1212
css: ['app.sass'],

src/boot/electron-log.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import log from 'electron-log'
2+
3+
// Override default console.log with electron-log function
4+
console.log = log.log

src/pages/AboutPage.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
type="submit"
3636
ref="update"
3737
:label="$t('update')"
38+
@click="checkUpdate"
3839
/>
3940
</q-card-actions>
4041
</q-card>
@@ -51,6 +52,25 @@ export default {
5152
return require('electron').remote.app.getVersion()
5253
}
5354
}
55+
},
56+
methods: {
57+
checkUpdate () {
58+
const { autoUpdater } = this.$q.electron.remote.require('electron-updater')
59+
autoUpdater.checkForUpdates()
60+
}
61+
},
62+
created () {
63+
const { autoUpdater } = this.$q.electron.remote.require('electron-updater')
64+
// Register event listener when update is found
65+
autoUpdater.on('update-available', () => {
66+
console.log('New update was found, downloading.')
67+
autoUpdater.downloadUpdate()
68+
})
69+
// Register event listener when update is found
70+
autoUpdater.on('update-downloaded', () => {
71+
console.log('New update was succesfully downloaded.')
72+
})
73+
// TODO: Add other events to handle GUI events https://www.electronjs.org/docs/api/auto-updater#events
5474
}
5575
}
5676
</script>

yarn.lock

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,13 @@
12301230
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c"
12311231
integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==
12321232

1233+
"@types/semver@^7.1.0":
1234+
version "7.1.0"
1235+
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.1.0.tgz#c8c630d4c18cd326beff77404887596f96408408"
1236+
integrity sha512-pOKLaubrAEMUItGNpgwl0HMFPrSAFic8oSVIvfu1UwcgGNmNyK9gyhBHKmBnUTwwVvpZfkzUC0GaMgnL6P86uA==
1237+
dependencies:
1238+
"@types/node" "*"
1239+
12331240
"@types/serve-static@*":
12341241
version "1.13.3"
12351242
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.3.tgz#eb7e1c41c4468272557e897e9171ded5e2ded9d1"
@@ -2413,6 +2420,14 @@ [email protected]:
24132420
debug "^4.1.1"
24142421
sax "^1.2.4"
24152422

2423+
2424+
version "8.7.0"
2425+
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.7.0.tgz#e48ad004835c8284662e8eaf47a53468c66e8e8d"
2426+
integrity sha512-G1AqqVM2vYTrSFR982c1NNzwXKrGLQjVjaZaWQdn4O6Z3YKjdMDofw88aD9jpyK9ZXkrCxR0tI3Qe9wNbyTlXg==
2427+
dependencies:
2428+
debug "^4.1.1"
2429+
sax "^1.2.4"
2430+
24162431
[email protected], builder-util@~22.4.1:
24172432
version "22.4.1"
24182433
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-22.4.1.tgz#49cce9f06a62cdccda66d5efa82077040fa1f462"
@@ -3869,6 +3884,11 @@ electron-localshortcut@^3.1.0:
38693884
keyboardevent-from-electron-accelerator "^2.0.0"
38703885
keyboardevents-areequal "^0.2.1"
38713886

3887+
electron-log@^4.1.1:
3888+
version "4.1.1"
3889+
resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-4.1.1.tgz#c57e3d833f723742eb430dc2cdaa6f97d8dbcaff"
3890+
integrity sha512-vkK3rNBOciRiinxrsdgg8hyUia+ct8ZMjBblvKjgNk4uHEDjjSyn313NOwv75xOMVIKlfmYzxaN8kR/oGC33aQ==
3891+
38723892
electron-notarize@^0.1.1:
38733893
version "0.1.1"
38743894
resolved "https://registry.yarnpkg.com/electron-notarize/-/electron-notarize-0.1.1.tgz#c3563d70c5e7b3315f44e8495b30050a8c408b91"
@@ -3944,6 +3964,19 @@ electron-to-chromium@^1.3.413:
39443964
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.421.tgz#4abfe7e49070b5b437ec2ce442543add8eb66800"
39453965
integrity sha512-ogxgmvHGfDuLA+GtgfK0jkFWlBb4MCZK2U1MM+l98sf4U3Ixtrfw1iC9w4mQqNvo+lHgM4pR62TqoT4QrvKJCw==
39463966

3967+
electron-updater@^4.3.1:
3968+
version "4.3.1"
3969+
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.1.tgz#9d485b6262bc56fcf7ee62b1dc1b3b105a3e96a7"
3970+
integrity sha512-UDC5AHCgeiHJYDYWZG/rsl1vdAFKqI/Lm7whN57LKAk8EfhTewhcEHzheRcncLgikMcQL8gFo1KeX51tf5a5Wg==
3971+
dependencies:
3972+
"@types/semver" "^7.1.0"
3973+
builder-util-runtime "8.7.0"
3974+
fs-extra "^9.0.0"
3975+
js-yaml "^3.13.1"
3976+
lazy-val "^1.0.4"
3977+
lodash.isequal "^4.5.0"
3978+
semver "^7.1.3"
3979+
39473980
electron@^7.0.0:
39483981
version "7.1.10"
39493982
resolved "https://registry.yarnpkg.com/electron/-/electron-7.1.10.tgz#35d5aa41ee3f233613e37ef4245b83c23001628b"
@@ -4771,7 +4804,7 @@ fs-constants@^1.0.0:
47714804
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
47724805
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
47734806

4774-
4807+
[email protected], fs-extra@^9.0.0:
47754808
version "9.0.0"
47764809
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3"
47774810
integrity sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==
@@ -6443,6 +6476,11 @@ lodash.get@^4.0.0:
64436476
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
64446477
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
64456478

6479+
lodash.isequal@^4.5.0:
6480+
version "4.5.0"
6481+
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
6482+
integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=
6483+
64466484
lodash.isplainobject@^4.0.6:
64476485
version "4.0.6"
64486486
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"

0 commit comments

Comments
 (0)