Skip to content

Commit e28f756

Browse files
committed
autoupdate
1 parent 2ac15b4 commit e28f756

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

.github/workflows/pushblish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ permissions:
44
contents: write
55

66
on:
7-
push:
8-
tags:
9-
- 'v*'
7+
# push:
8+
# tags:
9+
# - 'v*'
1010

1111
jobs:
1212
build:

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Leonardo Pollini",
77
"email": "[email protected]"
88
},
9-
"version": "0.0.1",
9+
"version": "0.0.11",
1010
"autoupdate": false,
1111
"electron_package": "package.json",
1212
"app_name": "Webpage Accessor",

extensions/autoupdate/main.js

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@ class Autoupdater extends require('../../lib/BaseModule')
1111
{
1212
MODULE_NAME = "autoupdate";
1313
EXECUTABLE_NAME = "";
14+
DOWNLOAD_PATH = "";
1415

1516
setup_linux()
1617
{
1718
this.EXECUTABLE_NAME = app.app_info.app_executable;
19+
this.DOWNLOAD_PATH = app.getPath("downloads");
1820

1921
// You can control this behavior:
2022
autoUpdater.autoDownload = (this.getAppData().auto_downalod == true); // ask first
2123
autoUpdater.autoInstallOnAppQuit = true; // install after app closes
2224

23-
this.log('Checking for updates...');
24-
autoUpdater.checkForUpdates();
25-
2625
if (!process.env.APPIMAGE)
2726
{
2827
this.warn("process.env.APPIMAGE not assigned: this is not an AppImage!");
2928
return;
3029
}
30+
this.log('Checking for updates...');
31+
autoUpdater.checkForUpdates();
32+
3133
autoUpdater.on('update-available', info => {
32-
this.log(`Update available: ${info.version}`);
33-
dialog.showMessageBox(this.window, {
34+
this.log(`Update available: ${info.version}`);
35+
dialog.showMessageBox(this.window, {
3436
type: 'info',
3537
title: 'Update Available',
3638
message: `Version ${info.version} is available. Download now?`,
@@ -51,19 +53,20 @@ class Autoupdater extends require('../../lib/BaseModule')
5153
});
5254

5355
autoUpdater.on('update-downloaded', info => {
54-
this.log('Update downloaded, will install now.');
55-
dialog.showMessageBox(this.window, {
56-
title: 'Install Update',
57-
message: 'Update downloaded. The app will restart to install.'
58-
}).then(() => {
59-
const exec_bin_location = path.join(HOME_BIN_LINUX, this.EXECUTABLE_NAME);
60-
const newFile = path.join(path.dirname(process.env.APPIMAGE), this.EXECUTABLE_NAME + `-${info.version}.AppImage`);
61-
this.log("Linking new version:", info.version, "to", newFile, "at", exec_bin_location);
62-
fs.existsSync(newFile) &&
63-
exec(`ln -sf "${newFile}" "${exec_bin_location}"`);
64-
this.log("Installing");
65-
// autoUpdater.quitAndInstall();
66-
})
56+
// dialog.showMessageBox(this.window, {
57+
// type: 'info',
58+
// title: 'Install Update',
59+
// message: 'Update downloaded. Quit app to install.',
60+
// buttons: ['Quit app']
61+
// }).then(() => {
62+
this.log("Linking executable...")
63+
const exec_bin_location = path.join(HOME_BIN_LINUX, this.EXECUTABLE_NAME);
64+
const newFile = path.join(this.DOWNLOAD_PATH, this.EXECUTABLE_NAME + `-${info.version}.AppImage`);
65+
this.log("Linking new version:", info.version, "to", newFile, "at", exec_bin_location);
66+
if (fs.existsSync(newFile))
67+
fs.symlinkSync(newFile, exec_bin_location);
68+
this.log("Installing");
69+
autoUpdater.quitAndInstall();
6770
});
6871

6972
autoUpdater.on('update-not-available', () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpage_accessor",
3-
"version": "0.0.10",
3+
"version": "0.0.16",
44
"description": "Electron tests for independant desktop web app",
55
"author": {
66
"name": "Leonardo Pollini",

0 commit comments

Comments
 (0)