Browse Source

Added new updater and custom NSIS installer

Also added a script to migrate from Squirrel to NSIS to keep the user apps and configuration and prevent remove it.
pull/1922/head
Ramiro Saenz 7 years ago
parent
commit
ea6d542223
  1. 1
      .gitignore
  2. 2
      electron/main.js
  3. 7
      electron/updater.js
  4. 9
      package-lock.json
  5. 4
      package.json
  6. BIN
      resources/installer/background.png
  7. 10
      resources/installer/installer.nsh
  8. BIN
      resources/installer/installerHeader.bmp
  9. BIN
      resources/installer/installerSidebar.bmp

1
.gitignore vendored

@ -37,3 +37,4 @@ npm-debug.log
env.js
rambox_cfg.json
languages.js
electron/dev-app-update.yml

2
electron/main.js

@ -193,7 +193,7 @@ function createWindow () {
tray.create(mainWindow, config);
if ( fs.existsSync(path.resolve(path.dirname(process.execPath), '..', 'Update.exe')) && process.argv.indexOf('--without-update') === -1 ) updater.initialize(mainWindow);
if ( process.argv.indexOf('--without-update') === -1 ) updater.initialize(mainWindow);
// Open links in default browser
mainWindow.webContents.on('new-window', function(e, url, frameName, disposition, options) {

7
electron/updater.js

@ -2,10 +2,15 @@ const {app, ipcMain} = require('electron');
const { autoUpdater } = require("electron-updater");
const path = require('path');
// autoUpdater.logger = require("electron-log");
// autoUpdater.logger.transports.file.level = "debug";
// autoUpdater.currentVersion = '0.6.0';
// autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml');
const initialize = (window) => {
const webContents = window.webContents;
const send = webContents.send.bind(window.webContents);
autoUpdater.on('checking-for-update', (event) => send('autoUpdater:checking-for-update:'));
autoUpdater.on('checking-for-update', (event) => send('autoUpdater:checking-for-update'));
autoUpdater.on('update-downloaded', (event, ...args) => send('autoUpdater:update-downloaded', ...args));
ipcMain.on('autoUpdater:quit-and-install', (event) => autoUpdater.quitAndInstall());
ipcMain.on('autoUpdater:check-for-updates', (event) => autoUpdater.checkForUpdates());

9
package-lock.json generated

@ -1,6 +1,8 @@
{
"requires": true,
"name": "Rambox",
"version": "0.6.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"7zip-bin": {
"version": "4.0.2",
@ -1990,6 +1992,11 @@
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-0.3.0.tgz",
"integrity": "sha1-FOb9pcaOnk7L7/nM8DfL18BcWv4="
},
"electron-log": {
"version": "2.2.17",
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-2.2.17.tgz",
"integrity": "sha512-v+Af5W5z99ehhaLOfE9eTSXUwjzh2wFlQjz51dvkZ6ZIrET6OB/zAZPvsuwT6tm3t5x+M1r+Ed3U3xtPZYAyuQ=="
},
"electron-osx-sign": {
"version": "0.4.10",
"resolved": "https://registry.npmjs.org/electron-osx-sign/-/electron-osx-sign-0.4.10.tgz",

4
package.json

@ -122,8 +122,7 @@
},
"directories": {
"buildResources": "resources/installer/",
"output": "dist/",
"app": "build/production/Rambox/"
"output": "dist/"
},
"publish": [
{
@ -154,6 +153,7 @@
"crypto": "^1.0.1",
"electron-context-menu": "0.9.1",
"electron-is-dev": "^0.3.0",
"electron-log": "^2.2.17",
"electron-store": "^2.0.0",
"electron-updater": "^3.1.2",
"mime": "^2.3.1",

BIN
resources/installer/background.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 KiB

After

Width:  |  Height:  |  Size: 432 KiB

10
resources/installer/installer.nsh

@ -0,0 +1,10 @@
!macro customInit
CreateDirectory $APPDATA\RamboxBK
CopyFiles $APPDATA\Rambox\*.* $APPDATA\RamboxBK
nsExec::Exec '"$LOCALAPPDATA\Rambox\Update.exe" --uninstall -s'
!macroend
!macro customInstall
CopyFiles $APPDATA\RamboxBK\*.* $APPDATA\Rambox
RMDir /r $APPDATA\RamboxBK
!macroend

BIN
resources/installer/installerHeader.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
resources/installer/installerSidebar.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Loading…
Cancel
Save