mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 08:31:19 +00:00
# CHANGES
- Added latest.yml files to release artifacts for auto-updater 🚀 - Enhanced pre-download update check for better reliability ✨ - Improved error handling with detailed logging messages 🛡️ - Fixed update flow by checking versions before downloading 🔧 - Added development mode stub handlers for testing 🧪 - Prevented confusing errors in development environment 💡 - Included platform-specific update manifest files 📦 - Strengthened auto-updater with validation checks ✅ - Better error messages for failed update attempts 📝 - Smoother update experience with proper state management 🎯
This commit is contained in:
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -170,6 +170,7 @@ jobs:
|
||||
release/*.zip
|
||||
release/*-mac.zip
|
||||
release/*-mac-*.zip
|
||||
release/latest-mac.yml
|
||||
if-no-files-found: error
|
||||
retention-days: 5
|
||||
|
||||
@@ -180,6 +181,7 @@ jobs:
|
||||
name: maestro-windows
|
||||
path: |
|
||||
release/*.exe
|
||||
release/latest.yml
|
||||
if-no-files-found: error
|
||||
retention-days: 5
|
||||
|
||||
@@ -193,6 +195,7 @@ jobs:
|
||||
release/*.deb
|
||||
release/*.rpm
|
||||
release/*.snap
|
||||
release/latest-linux.yml
|
||||
if-no-files-found: warn
|
||||
retention-days: 5
|
||||
|
||||
|
||||
@@ -96,12 +96,26 @@ function setupIpcHandlers(): void {
|
||||
// Download update
|
||||
ipcMain.handle('updates:download', async () => {
|
||||
try {
|
||||
// First, check for updates with electron-updater to tell it which version to download
|
||||
// This is required because the UI uses the GitHub API check, not electron-updater's check
|
||||
logger.info('Checking for updates before download...', 'AutoUpdater');
|
||||
const checkResult = await autoUpdater.checkForUpdates();
|
||||
|
||||
if (!checkResult || !checkResult.updateInfo) {
|
||||
logger.error('No update found during pre-download check', 'AutoUpdater');
|
||||
currentStatus = { status: 'error', error: 'No update available to download' };
|
||||
sendStatusToRenderer();
|
||||
return { success: false, error: 'No update available to download' };
|
||||
}
|
||||
|
||||
logger.info(`Found update ${checkResult.updateInfo.version}, starting download...`, 'AutoUpdater');
|
||||
currentStatus = { status: 'downloading', progress: { percent: 0, bytesPerSecond: 0, total: 0, transferred: 0, delta: 0 } };
|
||||
sendStatusToRenderer();
|
||||
await autoUpdater.downloadUpdate();
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
||||
logger.error(`Download failed: ${errorMessage}`, 'AutoUpdater');
|
||||
currentStatus = { status: 'error', error: errorMessage };
|
||||
sendStatusToRenderer();
|
||||
return { success: false, error: errorMessage };
|
||||
|
||||
@@ -556,6 +556,21 @@ function createWindow() {
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
initAutoUpdater(mainWindow);
|
||||
logger.info('Auto-updater initialized', 'Window');
|
||||
} else {
|
||||
// Register stub handlers in development mode so users get a helpful error
|
||||
ipcMain.handle('updates:download', async () => {
|
||||
return { success: false, error: 'Auto-update is disabled in development mode. Please check update first.' };
|
||||
});
|
||||
ipcMain.handle('updates:install', async () => {
|
||||
logger.warn('Auto-update install called in development mode', 'AutoUpdater');
|
||||
});
|
||||
ipcMain.handle('updates:getStatus', async () => {
|
||||
return { status: 'idle' as const };
|
||||
});
|
||||
ipcMain.handle('updates:checkAutoUpdater', async () => {
|
||||
return { success: false, error: 'Auto-update is disabled in development mode' };
|
||||
});
|
||||
logger.info('Auto-updater disabled in development mode (stub handlers registered)', 'Window');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user