From 4f51f5a317ddac81e6bf604ed53657712b42b5a5 Mon Sep 17 00:00:00 2001
From: Alexis Lopez Zubieta <contact@azubieta.net>
Date: Fri, 30 Aug 2019 08:51:25 -0500
Subject: [PATCH] use electron updater

---
 app/main.js  | 14 ++++++--------
 package.json |  1 +
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/app/main.js b/app/main.js
index 1566147..e981a35 100644
--- a/app/main.js
+++ b/app/main.js
@@ -5,6 +5,11 @@ const {app, BrowserWindow, ipcMain} = require('electron');
 const ElectronStore = require('electron-store');
 const request = require('request');
 
+const {autoUpdater} = require("electron-updater")
+
+autoUpdater.logger = require("electron-log")
+autoUpdater.logger.transports.file.level = "info"
+
 // Set configs dir
 app.setPath("userData", app.getPath("appData") + "/OCS-Store")
 
@@ -93,15 +98,7 @@ function createWindow() {
     mainWindow.loadURL(indexFileUrl);
     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', () => {
         const appConfigStore = new ElectronStore({name: appConfigStoreStorage});
         appConfigStore.set('windowBounds', mainWindow.getBounds());
@@ -170,6 +167,7 @@ function removePreviewpic(itemKey) {
 app.on('ready', async () => {
     if (await startOcsManager()) {
         createWindow();
+        autoUpdater.checkForUpdatesAndNotify()
     } else {
         app.quit();
     }
diff --git a/package.json b/package.json
index c21f5f3..b0571f5 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
   "dependencies": {
     "electron-store": "2.*.*",
     "electron-updater": "^4.1.2",
+    "electron-log": "^3.0.7",
     "esm": "3.*.*",
     "lit-html": "1.*.*",
     "request": "2.*.*",
-- 
GitLab