Disabling auto-update until code signing is in place.

This commit is contained in:
luke-hagar-sp
2024-01-23 21:26:11 -06:00
parent 16907283f6
commit 50d49db20c

View File

@@ -1,8 +1,8 @@
const windowStateManager = require('electron-window-state'); const windowStateManager = require("electron-window-state");
const { app, BrowserWindow } = require('electron'); const { app, BrowserWindow } = require("electron");
const path = require("path"); const path = require("path");
const { is } = require("@electron-toolkit/utils"); const { is } = require("@electron-toolkit/utils");
const { updateElectronApp } = require("update-electron-app"); // const { updateElectronApp } = require("update-electron-app");
const handlerPkg = import( const handlerPkg = import(
is.dev is.dev
? "../../Sveltekit-Build/src/handler.js" ? "../../Sveltekit-Build/src/handler.js"
@@ -18,13 +18,13 @@ const log = require("electron-log/main");
log.info( log.info(
"==================================Log Start==================================" "==================================Log Start=================================="
); );
try { // try {
log.info("Trying to update..."); // log.info("Trying to update...");
updateElectronApp(); // updateElectronApp();
} catch (e) { // } catch (e) {
log.info("Error updating"); // log.info("Error updating");
log.info(e); // log.info(e);
} // }
const port = 3000; const port = 3000;
const origin = `http://localhost:${port}`; const origin = `http://localhost:${port}`;
log.info(`Starting server on ${origin}...`); log.info(`Starting server on ${origin}...`);
@@ -64,44 +64,44 @@ const createWindow = () => {
// Create the browser window. // Create the browser window.
try { try {
let windowState = windowStateManager({ let windowState = windowStateManager({
defaultWidth: 800, defaultWidth: 800,
defaultHeight: 800, defaultHeight: 800,
}); });
const mainWindow = new BrowserWindow({ const mainWindow = new BrowserWindow({
backgroundColor: 'whitesmoke', backgroundColor: "whitesmoke",
titleBarStyle: 'default', titleBarStyle: "default",
autoHideMenuBar: false, autoHideMenuBar: false,
trafficLightPosition: { trafficLightPosition: {
x: 17, x: 17,
y: 32, y: 32,
}, },
minHeight: 800, minHeight: 800,
minWidth: 800, minWidth: 800,
webPreferences: { webPreferences: {
contextIsolation: true, contextIsolation: true,
nodeIntegration: true, nodeIntegration: true,
spellcheck: false, spellcheck: false,
devTools: true, devTools: true,
preload: path.join(__dirname, 'preload.cjs'), preload: path.join(__dirname, "preload.cjs"),
}, },
x: windowState.x, x: windowState.x,
y: windowState.y, y: windowState.y,
width: windowState.width, width: windowState.width,
height: windowState.height, height: windowState.height,
}); });
log.info("Opening server in window..."); log.info("Opening server in window...");
// and load the index.html of the app. // and load the index.html of the app.
mainWindow.loadURL(origin); mainWindow.loadURL(origin);
mainWindow.once('ready-to-show', () => { mainWindow.once("ready-to-show", () => {
mainWindow.show(); mainWindow.show();
mainWindow.focus(); mainWindow.focus();
}); });
mainWindow.on('close', () => { mainWindow.on("close", () => {
windowState.saveState(mainWindow); windowState.saveState(mainWindow);
}); });
// Open the DevTools. // Open the DevTools.