diff --git a/.gitignore b/.gitignore index e959f16f..efae8261 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ npm-debug.log env.js rambox_cfg.json languages.js +electron/dev-app-update.yml diff --git a/electron/main.js b/electron/main.js index e7e394d3..2aa98d2e 100644 --- a/electron/main.js +++ b/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) { diff --git a/electron/updater.js b/electron/updater.js index f9adb8ff..8f6cd023 100644 --- a/electron/updater.js +++ b/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()); diff --git a/package-lock.json b/package-lock.json index 4b10598d..755fc4a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 3109f255..52ab1072 100644 --- a/package.json +++ b/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", diff --git a/resources/installer/background.png b/resources/installer/background.png index 0b3b62f6..e9e99143 100644 Binary files a/resources/installer/background.png and b/resources/installer/background.png differ diff --git a/resources/installer/installer.nsh b/resources/installer/installer.nsh new file mode 100644 index 00000000..11d5ec4e --- /dev/null +++ b/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 diff --git a/resources/installer/installerHeader.bmp b/resources/installer/installerHeader.bmp new file mode 100644 index 00000000..2bea0b60 Binary files /dev/null and b/resources/installer/installerHeader.bmp differ diff --git a/resources/installer/installerSidebar.bmp b/resources/installer/installerSidebar.bmp new file mode 100644 index 00000000..aaa551e1 Binary files /dev/null and b/resources/installer/installerSidebar.bmp differ