electron icon indicating copy to clipboard operation
electron copied to clipboard

How can I update manually?

Open hon opened this issue 10 years ago • 1 comments

  • Electron version: v0.37.8
  • Operating system: win10, arch=x64

I use auto-updater to update my app. When there is a new version, it update automatically. How can I update it manually? Or if I don't want to update the new version?

Here is my autoupdater.js

import os from 'os'
import {
  autoUpdater,
  BrowserWindow
} from 'electron'
import {
  isDev
} from './util'

export default class AppUpdate{
  constructor(window){
    if (isDev()) return
    autoUpdater.addListener("update-available", function(event) {
      console.log('update available')
    })
    autoUpdater.addListener("update-downloaded", function(event, releaseNotes, releaseName, releaseDate, updateURL) {
      notify("A new update is ready to install", `Version ${releaseName} is downloaded and will be automatically installed on Quit`)
    });
    autoUpdater.addListener("error", function(error) {
      console.log(error)
    });
    autoUpdater.addListener("checking-for-update", function(event) {
      console.log('checking-for-update')
    });
    autoUpdater.addListener("update-not-available", function(event) {
      console.log('update-not-available')
    });

    const feedURL = 'http://localhost:8999/updates/releases/win' + (os.arch() === 'x64' ? '64' : '32');
    autoUpdater.setFeedURL(feedURL);

    window.webContents.once("did-frame-finish-load", (event) => {
      autoUpdater.checkForUpdates()
    })
  }
}

function notify(title, message) {
  let windows = BrowserWindow.getAllWindows()
  if (windows.length == 0) {
    return
  }

  window.webContents.send("notify", title, message)
}

hon avatar May 16 '16 03:05 hon

Currently there is no solution for this, I'm merging this to #4587.

zcbenz avatar May 16 '16 23:05 zcbenz