Verified Commit 4f51f5a3 authored by azubieta's avatar azubieta
Browse files

use electron updater

parent 05b12019
...@@ -5,6 +5,11 @@ const {app, BrowserWindow, ipcMain} = require('electron'); ...@@ -5,6 +5,11 @@ const {app, BrowserWindow, ipcMain} = require('electron');
const ElectronStore = require('electron-store'); const ElectronStore = require('electron-store');
const request = require('request'); const request = require('request');
const {autoUpdater} = require("electron-updater")
autoUpdater.logger = require("electron-log")
autoUpdater.logger.transports.file.level = "info"
// Set configs dir // Set configs dir
app.setPath("userData", app.getPath("appData") + "/OCS-Store") app.setPath("userData", app.getPath("appData") + "/OCS-Store")
...@@ -93,15 +98,7 @@ function createWindow() { ...@@ -93,15 +98,7 @@ function createWindow() {
mainWindow.loadURL(indexFileUrl); mainWindow.loadURL(indexFileUrl);
mainWindow.maximize(); mainWindow.maximize();
console.log('should check for updates')
require('update-electron-app')({
repo: 'dfn2/pling-store',
host: 'http://www.opencode.net',
updateInterval: '1 hour',
logger: require('electron-log')
})
mainWindow.on('close', () => { mainWindow.on('close', () => {
const appConfigStore = new ElectronStore({name: appConfigStoreStorage}); const appConfigStore = new ElectronStore({name: appConfigStoreStorage});
appConfigStore.set('windowBounds', mainWindow.getBounds()); appConfigStore.set('windowBounds', mainWindow.getBounds());
...@@ -170,6 +167,7 @@ function removePreviewpic(itemKey) { ...@@ -170,6 +167,7 @@ function removePreviewpic(itemKey) {
app.on('ready', async () => { app.on('ready', async () => {
if (await startOcsManager()) { if (await startOcsManager()) {
createWindow(); createWindow();
autoUpdater.checkForUpdatesAndNotify()
} else { } else {
app.quit(); app.quit();
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"dependencies": { "dependencies": {
"electron-store": "2.*.*", "electron-store": "2.*.*",
"electron-updater": "^4.1.2", "electron-updater": "^4.1.2",
"electron-log": "^3.0.7",
"esm": "3.*.*", "esm": "3.*.*",
"lit-html": "1.*.*", "lit-html": "1.*.*",
"request": "2.*.*", "request": "2.*.*",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment