autoupdate
This commit is contained in:
@@ -80,10 +80,6 @@
|
||||
{
|
||||
"target": "nsis",
|
||||
"arch": ["x64"]
|
||||
},
|
||||
{
|
||||
"target": "squirrel",
|
||||
"arch": ["x64"]
|
||||
}
|
||||
],
|
||||
"icon": "icons/icon.ico",
|
||||
|
||||
@@ -11,68 +11,11 @@ const http = require('http');
|
||||
const AdmZip = require('adm-zip');
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
|
||||
// Handle Squirrel events for Windows installer
|
||||
if (require('electron-squirrel-startup')) {
|
||||
app.quit();
|
||||
}
|
||||
|
||||
// Development mode detection - MUST be declared before any code that might use it
|
||||
const isDev = process.env.NODE_ENV === 'development' || !app.isPackaged;
|
||||
const VITE_DEV_SERVER = 'http://localhost:38347';
|
||||
const PORT = 44548;
|
||||
|
||||
// Handle Squirrel.Windows installation/update events
|
||||
if (process.platform === 'win32') {
|
||||
const handleSquirrelEvent = () => {
|
||||
if (process.argv.length === 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const squirrelEvent = process.argv[1];
|
||||
|
||||
switch (squirrelEvent) {
|
||||
case '--squirrel-install':
|
||||
case '--squirrel-updated':
|
||||
// Install desktop and start menu shortcuts
|
||||
const cp = require('child_process');
|
||||
const updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
|
||||
const target = path.basename(process.execPath);
|
||||
const createShortcut = `${updateDotExe} --createShortcut=${target}`;
|
||||
|
||||
cp.exec(createShortcut, () => {
|
||||
app.quit();
|
||||
});
|
||||
return true;
|
||||
|
||||
case '--squirrel-uninstall':
|
||||
// Remove desktop and start menu shortcuts
|
||||
const cpUninstall = require('child_process');
|
||||
const updateDotExeUninstall = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
|
||||
const targetUninstall = path.basename(process.execPath);
|
||||
const removeShortcut = `${updateDotExeUninstall} --removeShortcut=${targetUninstall}`;
|
||||
|
||||
cpUninstall.exec(removeShortcut, () => {
|
||||
app.quit();
|
||||
});
|
||||
return true;
|
||||
|
||||
case '--squirrel-obsolete':
|
||||
// This is called on the outgoing version of your app before
|
||||
// we update to the new version - it's the opposite of
|
||||
// --squirrel-updated
|
||||
app.quit();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
if (handleSquirrelEvent()) {
|
||||
// Squirrel event handled and app will exit in 1000ms, so don't do anything else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
const store = new Store();
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
"adm-zip": "^0.5.16",
|
||||
"body-parser": "2.2.2",
|
||||
"cors": "2.8.6",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"electron-store": "^8.2.0",
|
||||
"electron-updater": "^6.3.9",
|
||||
"express": "5.2.1",
|
||||
|
||||
Reference in New Issue
Block a user