Giter Club home page Giter Club logo

Comments (10)

megahertz avatar megahertz commented on July 20, 2024 1

Sorry that I misled you. I forgot some details about Squirrel.Win. 'squirrel-win-installer' is fired when the app has been updated.

I'm feeling bad now, so I can't give you a good solution. I'll try to return to this problem on the next week.

from electron-simple-updater.

megahertz avatar megahertz commented on July 20, 2024

Unfortunately, Squirrel downloads updates by itself, so I can't control it.

from electron-simple-updater.

debelop13 avatar debelop13 commented on July 20, 2024

Hi, I want to download automatically but update only if user wants, in mac I can cancel, but in windows I can't.

I am using squirrel events to stop..

updater.on('squirrel-win-installer', onSquirrelInstalling);
function onSquirrelInstalling(event) {
console.log(event)
}

But never is called.

My squirrel log

2017-07-26 11:01:41> CheckForUpdateImpl: Downloading RELEASES file from http://www.example.com/example/standalone/releases/win32/0.0.8
2017-07-26 11:01:41> FileDownloader: Downloading url: http://www.example.com/example/standalone/releases/win32/0.0.8/RELEASES?id=example&localVersion=0.0.7&arch=amd64
2017-07-26 11:01:42> FileDownloader: Downloading file: http://www.example.com/example/standalone/releases/win32/0.0.8/example-0.0.8-full.nupkg
2017-07-26 11:02:56> ApplyReleasesImpl: Writing files to app directory: C:\Users\example\AppData\Local\example\app-0.0.8
2017-07-26 11:03:02> LogHost: Rigging execution stub for example_ExecutionStub.exe to C:\Users\example\AppData\Local\example\example.exe
2017-07-26 11:03:08> ApplyReleasesImpl: Squirrel Enabled Apps: [C:\Users\example\AppData\Local\example\app-0.0.8\example.exe]
2017-07-26 11:03:09> ApplyReleasesImpl: Starting fixPinnedExecutables
2017-07-26 11:03:09> ApplyReleasesImpl: Examining Pin: Command Prompt.lnk
2017-07-26 11:03:09> ApplyReleasesImpl: Examining Pin: File Explorer.lnk
2017-07-26 11:03:09> ApplyReleasesImpl: Examining Pin: Google Chrome.lnk
2017-07-26 11:03:09> ApplyReleasesImpl: Examining Pin: SourceTree.lnk
2017-07-26 11:03:09> ApplyReleasesImpl: Examining Pin: Task Manager.lnk
2017-07-26 11:03:09> ApplyReleasesImpl: Examining Pin: Visual Studio Code.lnk
2017-07-26 11:03:09> ApplyReleasesImpl: Fixing up tray icons
2017-07-26 11:03:09> ApplyReleasesImpl: Couldn't rewrite shim RegKey, most likely no apps are shimmed: System.NullReferenceException: Object reference not set to an instance of an object.
at Squirrel.UpdateManager.ApplyReleasesImpl.b__13_0(RegistryView view)
2017-07-26 11:03:09> ApplyReleasesImpl: Couldn't rewrite shim RegKey, most likely no apps are shimmed: System.NullReferenceException: Object reference not set to an instance of an object.
at Squirrel.UpdateManager.ApplyReleasesImpl.b__13_0(RegistryView view)
2017-07-26 11:03:09> ApplyReleasesImpl: cleanDeadVersions: for version 0.0.8
2017-07-26 11:03:09> ApplyReleasesImpl: cleanDeadVersions: exclude folder app-0.0.7
2017-07-26 11:03:09> ApplyReleasesImpl: cleanDeadVersions: exclude folder app-0.0.8

Thanks

from electron-simple-updater.

megahertz avatar megahertz commented on July 20, 2024

Hi. Sometimes squirrel updates the app even if quitAndInstall isn't called. I don't remember what's the exact squirrel behavior on different platforms.

As for squirrel-win-installer, you should subscribe to the event before updater.init is called.

from electron-simple-updater.

debelop13 avatar debelop13 commented on July 20, 2024

Is updating anyway, calling quitAndInstall or not.

I am in renderer.js, like your example,


function attachUpdaterHandlers() {
  updater.on('update-available', onUpdateAvailable);
  updater.on('update-downloading', onUpdateDownloading);
  updater.on('update-downloaded', onUpdateDownloaded);
  updater.on('squirrel-win-installer', onSquirrelInstalling);
  updater.setOptions('logger', {
    info(text) {
      console.log("Information in Auto-update: " + String(text));
    },
    warn(text) {
      console.log("Warning in auto-update: " + String(text));
    }
  });

  function onUpdateAvailable(meta) {
    //If you want, ask for update
    /*if (window.confirm('Update ' + meta.version + ' is available. The current version is ' + updater.version + '. Do you like to download in background it now?', 'Update')) {
      updater.downloadUpdate();
    }*/
  }

  function onUpdateDownloading(meta) {
    console.log("The update is downloading...");
  }

  function onUpdateDownloaded(meta) {
    var index = dialog.showMessageBox(mainWindow, {
      type: 'info',
      buttons: ['Restart to update', 'Remind me later'],
      defaultId: 0,
      title: "Example",
      message: 'New version has been downloaded. Please restart the application to apply the updates.',
      detail: meta.readme,
      cancelId: 1
    });
    if (index === 1) {
      console.log("Aborting the update...")
      return;
    } else {
      // Restart app, then update will be applied
      updater.quitAndInstall();
    }
  }

  function onSquirrelInstalling(event) {
      event.preventDefault = true;
      console.log(event)
      console.log(event.squirrelAction)
  }

But is never calling..

Also try in main.js, before updater.init called..

updater.on('squirrel-win-installer', onSquirrelInstalling);
updater.init({
  checkUpdateOnStart: false,
  autoDownload: false
});

  function onSquirrelInstalling(event) {
      event.preventDefault = true;
      console.log(event)
      console.log(event.squirrelAction)
  }

And is only calling event in installation.. (event squirrel-install) not more..

I need to stop the update!

from electron-simple-updater.

debelop13 avatar debelop13 commented on July 20, 2024

Okey, no problem! I will be waiting

from electron-simple-updater.

megahertz avatar megahertz commented on July 20, 2024

I looked up at squirrel logic again. Normally, it updates the app as soon as updates are downloaded, so it doesn't matter whether the app restarted or not. How do you cancel update on mac?

If an app is updated but it still can find a new version after restart - in most situation it has wrong version configuration. Check whether the version property inside C:\Users\example\AppData\Local\example\app-0.0.8\resources\app.asar\package.json is correct.

from electron-simple-updater.

debelop13 avatar debelop13 commented on July 20, 2024

In mac, if I don't call 'updater.quitAndInstall()'.. is not updating

function onUpdateDownloaded(meta) {
    var index = dialog.showMessageBox(mainWindow, {
      type: 'info',
      buttons: ['Restart to update', 'Remind me later'],
      defaultId: 0,
      title: "Example",
      message: 'New version has been downloaded. Please restart the application to apply the updates.',
      detail: meta.readme,
      cancelId: 1
    });
    if (index === 1) {
      console.log("Aborting the update...")
      return;
    } else {
      // Restart app, then update will be applied
      updater.quitAndInstall();
    }
  }

In windows I see that before to onUpdateDownloaded callback, is created new app-0.0.8 (and saves app-0.0.7) and also application.exe has new version (0.0.8).. and after restar is updating anyway.. I thought that we could stop update.. or we could go back when users choose to not update

from electron-simple-updater.

megahertz avatar megahertz commented on July 20, 2024

It seems that Squirrel.Mac behavior is changed in the latest version. In older version it applied update immediately.

And yes, it seems that on windows you can only revert to a previous version in your code if a user rejects update. Maybe Update.exe has some helpful features for it, I don't know.

from electron-simple-updater.

megahertz avatar megahertz commented on July 20, 2024

Feel free to reopen this issue if your problem is not solved.

from electron-simple-updater.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.