1
0
Эх сурвалжийг харах

Whoops, had it in the wrong area. Complaining about code signing

craigsdennis 9 жил өмнө
parent
commit
2d1bd03a32
2 өөрчлөгдсөн 12 нэмэгдсэн , 15 устгасан
  1. 0 13
      front-end/js/app.js
  2. 12 2
      index.js

+ 0 - 13
front-end/js/app.js

@@ -1,11 +1,9 @@
 "use strict";
 
-const autoUpdater = require('auto-updater');
 const os = require('os').platform();
 //Relative to index.html not app.js
 const SerialScanner = require("../back-end/serial_scanner");
 const PortSelect = require("./js/port_select");
-const packageInfo = require('./package.json');
 
 function $(id) { return document.getElementById(id); }
 
@@ -38,10 +36,6 @@ serialScanner.on("deviceRemoved", (port ) => {
 
 serialScanner.on("error", onError);
 
-autoUpdater.on("checking-for-update", () => {
-    new Notification("Checking for updates");
-});
-
 /**
  * Updates UI to say it's ready
  */
@@ -70,19 +64,12 @@ function onError(error){
     appStatus.textContent = error.message;
 }
 
-function initUpdater() {
-    let updateFeed = `http://localhost:3000/updates/${packageInfo.name}/latest`;
-    autoUpdater.setFeedURL(updateFeed + '?v=' + packageInfo.version);
-    autoUpdater.checkForUpdates();
-}
-
 /**
  * Sets up UI
  */
 function init() {
     serialScanner.scan();
     setInterval(serialScanner.checkForChanges.bind(serialScanner), pollTime);
-    initUpdater();
 }
 
 init();

+ 12 - 2
index.js

@@ -3,12 +3,13 @@
 const electron = require('electron');
 const app = electron.app;  // Module to control application life.
 const BrowserWindow = electron.BrowserWindow;  // Module to create native browser window.
+const autoUpdater = require('auto-updater');
+const packageInfo = require('./package.json');
 
 // Keep a global reference of the window object, if you don't, the window will
 // be closed automatically when the JavaScript object is garbage collected.
 var mainWindow = null;
 
-
 // Quit when all windows are closed.
 app.on('window-all-closed', function() {
   // On OS X it is common for applications and their menu bar
@@ -18,6 +19,11 @@ app.on('window-all-closed', function() {
   }
 });
 
+autoUpdater.on("checking-for-update", () => {
+    new Notification("Checking for updates");
+});
+
+
 // This method will be called when Electron has finished
 // initialization and is ready to create browser windows.
 app.on('ready', function() {
@@ -37,7 +43,11 @@ app.on('ready', function() {
   mainWindow.loadURL('file://' + __dirname + '/front-end/index.html');
 
   // Open the DevTools.
-  //mainWindow.webContents.openDevTools();
+  mainWindow.webContents.openDevTools();
+
+  let updateFeed = `http://localhost:3000/updates/${packageInfo.name}/latest`;
+  autoUpdater.setFeedURL(updateFeed + '?v=' + packageInfo.version);
+  autoUpdater.checkForUpdates();
 
   // Emitted when the window is closed.
   mainWindow.on('closed', function() {