diff --git a/dev-app-update.yml b/dev-app-update.yml new file mode 100644 index 000000000..95ca79f94 --- /dev/null +++ b/dev-app-update.yml @@ -0,0 +1,3 @@ +provider: github +owner: multica-ai +repo: multica diff --git a/src/main/index.ts b/src/main/index.ts index 3782915e4..928f27039 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -7,12 +7,13 @@ import { Conductor } from './conductor/Conductor' import { IPC_CHANNELS } from '../shared/ipc-channels' import type { PermissionResponse } from '../shared/electron-api' import { PermissionManager } from './permission' -import { updater } from './updater' +import { createUpdater, AutoUpdater } from './updater' // Global instances let conductor: Conductor let mainWindow: BrowserWindow | null = null let permissionManager: PermissionManager +let updater: AutoUpdater function createWindow(): BrowserWindow { const window = new BrowserWindow({ @@ -122,10 +123,14 @@ app.whenReady().then(async () => { mainWindow = createWindow() - // Initialize auto-updater (only in production) - if (!is.dev) { - updater.setMainWindow(() => mainWindow) - // Check for updates after window is ready + // Initialize auto-updater + // Set FORCE_DEV_UPDATE=true to test updates in dev mode + const forceDevUpdate = process.env.FORCE_DEV_UPDATE === 'true' + updater = createUpdater(forceDevUpdate) + updater.setMainWindow(() => mainWindow) + + // Auto-check for updates (in production or when forced) + if (!is.dev || forceDevUpdate) { mainWindow.once('ready-to-show', () => { updater.checkForUpdates() }) diff --git a/src/main/updater/index.ts b/src/main/updater/index.ts index 0ffc3897c..7e4b5c01a 100644 --- a/src/main/updater/index.ts +++ b/src/main/updater/index.ts @@ -16,11 +16,25 @@ export interface UpdateStatus { export class AutoUpdater { private mainWindow: (() => BrowserWindow | null) | null = null - constructor() { + constructor(forceDevUpdateConfig = false) { // Configure auto-updater autoUpdater.autoDownload = false autoUpdater.autoInstallOnAppQuit = true + // Enable update checking in dev mode for testing + if (forceDevUpdateConfig) { + autoUpdater.forceDevUpdateConfig = true + console.log('[AutoUpdater] Force dev update config enabled') + } + + // Enable logging + autoUpdater.logger = { + info: (msg) => console.log('[AutoUpdater]', msg), + warn: (msg) => console.warn('[AutoUpdater]', msg), + error: (msg) => console.error('[AutoUpdater]', msg), + debug: (msg) => console.log('[AutoUpdater:debug]', msg) + } + // Set up event handlers autoUpdater.on('checking-for-update', () => { this.sendStatus({ status: 'checking' }) @@ -102,5 +116,7 @@ export class AutoUpdater { } } -// Singleton instance -export const updater = new AutoUpdater() +// Factory function to create updater with options +export function createUpdater(forceDevUpdateConfig = false): AutoUpdater { + return new AutoUpdater(forceDevUpdateConfig) +}