Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS Autoupdate not working #336

Open
vineet1984 opened this issue Apr 24, 2023 · 0 comments
Open

MacOS Autoupdate not working #336

vineet1984 opened this issue Apr 24, 2023 · 0 comments

Comments

@vineet1984
Copy link

vineet1984 commented Apr 24, 2023

I have setup my electron release server and it works for Windows. However, on Mac, I am seeing the below error with autoUpdater.checkForUpdates() in main.js.

"electron": "^21.2.0"
System configuration: Mac M1 Pro and macOS Ventura 13.1
Node version: 18.13.0

Error:

[2023-04-24 09:49:41.837] [info]  Checking for update: https://<serverurl>/update/darwin_arm64/1.0.0/stable
[2023-04-24 09:49:41.839] [info]  Error:  Error: The command is disabled and cannot be executed
    at Timeout._onTimeout (/Applications/xyz.app/Contents/Resources/app/main.js:163:17)
    at listOnTimeout (node:internal/timers:559:17)
    at process.processTimers (node:internal/timers:502:7)

Here's my main.js code:-

const { app, BrowserWindow, ipcMain, dialog, screen, Tray ,session, autoUpdater } = require('electron')
const os = require('node:os');
const log = require('electron-log');

log.info('Log from the main process');

autoUpdater.logger = log
autoUpdater.logger.transports.file.level = 'debug'

if (require('electron-squirrel-startup')) app.quit()

const macUrl = `${server}/update/${os_platform)_${os.arch()}/${app.getVersion()}/stable`

autoUpdater.setFeedURL({
  provider: 'squirrel',
  url: macUrl,
});

app.whenReady().then(() => {
  createWindow()
  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) createWindow()
  })
  setInterval(() => {
    log.info('Checking for update: ' + macUrl);
    autoUpdater.checkForUpdates()
  }, 30000)
})

autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
  log.info('Update downloaded');
  const dialogOpts = {
    type: 'info',
    buttons: ['Restart', 'Later'],
    title: 'Application Update',
    detail:
      'A new version has been downloaded. Restart the application to apply the updates.',
  }

  dialog.showMessageBox(dialogOpts).then((returnValue) => {
    if (returnValue.response === 0) { 
        setTimeout(() => {
          autoUpdater.quitAndInstall();
        }, 500);
    }
  })
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant