Giter VIP home page Giter VIP logo

Comments (17)

iffy avatar iffy commented on August 26, 2024

@girishbr Have you tried forking the repo and testing before adding your own code? From what I can see, you have all the update listeners calling sendStatusToWindow but don't have that function defined anywhere.

Instead of using this block of code: https://github.com/iffy/electron-updater-example/blob/master/main.js#L46 (which is not required for updates to work)

Choose one of the two options listed here: https://github.com/iffy/electron-updater-example/blob/master/main.js#L103

from electron-updater-example.

girishbr avatar girishbr commented on August 26, 2024

@iffy thank you for the feedback. I forked it here: https://github.com/girishbr/electron-updater-example/. Now, I understand how your code works.

I moved it all to about.html
https://github.com/intelligrate/query-cloud-api/blob/master/about.html#L18

ipcRenderer.on('message', function(event, text) {
        var container = document.getElementById('messages');
        var message = document.createElement('div');
        message.innerHTML = text;
        container.appendChild(message);
    })

So, when about.html finishes loading
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L169, I call autoUpdater.checkForUpdatesAndNotify

And on various events like 'checking-for-update', 'update-available', etc, the message is sent to about.html via
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L174

                        function sendStatusToWindow(text) {
                            log.info(text);
                            aboutWin.webContents.send('message', text);
                        }

This closely mimics what I forked. But, it won't work still.

from electron-updater-example.

girishbr avatar girishbr commented on August 26, 2024

Aah! I've to choose one of the two options. My bad. Will check it again.

from electron-updater-example.

iffy avatar iffy commented on August 26, 2024

@girishbr k, let me know if it works

from electron-updater-example.

girishbr avatar girishbr commented on August 26, 2024

Took the easy route with just autoUpdater.checkForUpdatesAndNotify(); right here.
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L309.

  1. Published version 2. Downloaded it
  2. Changed version 2 to version 3. Published it again and made it public.
  3. Ran version 2 from my PC again and closed it expecting it to update.
  4. Ran version 2 again to see the version in about https://github.com/intelligrate/query-cloud-api/blob/master/about.html#L15 - still version 2.

Your code is solid. But, I believe I'm making a fundamental mistake somewhere.

from electron-updater-example.

iffy avatar iffy commented on August 26, 2024

I only see v0.0.3, v0.0.1, v0.0.2 in your list of releases: https://github.com/intelligrate/query-cloud-api/releases And v0.0.2 was released 3 days ago?

Maybe your v2 that you're running is not a version with the new code?

from electron-updater-example.

girishbr avatar girishbr commented on August 26, 2024

that's weird! This's what I see.
image

from electron-updater-example.

iffy avatar iffy commented on August 26, 2024

Maybe make 0.0.4 and 0.0.5 (both publicly released -- not drafts) to avoid potential name conflicts?

from electron-updater-example.

girishbr avatar girishbr commented on August 26, 2024

Did that. Deleted all the releases.
Just have only one line for checkForUpdatesAndNotify()
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L310

Created version 0.0.1, pushed, published, installed.
Changed package.json to 0.0.2, pushed, published.

Opened app(v0.0.1) expecting an updation to 0.0.2. Didn't happen.

from electron-updater-example.

iffy avatar iffy commented on August 26, 2024

@girishbr I'm not sure how the UI works on Windows, but when using checkForUpdatesAndNotify on my mac, I have to launch the app, then wait for it to download the new version (the update notification doesn't appear immediately), then I get a notification, then I have to quit the application and restart it to see the new version. But I'm assuming you're waiting for a bit after starting the app.

Hmm... I'm not sure what the problem is from looking at your code and GitHub releases.

from electron-updater-example.

girishbr avatar girishbr commented on August 26, 2024

@iffy Thank you for your feedback. I finally got it to work.
Seems like I cannot club autoUpdater call with the main window call. Please look at the comments.

app.on('ready', () => {
    const menu = Menu.buildFromTemplate(template);
    Menu.setApplicationMenu(menu);
    mainWindow = new BrowserWindow({
        width: 1200,
        height: 800,
        minWidth: 1200,
        minHeight: 800,
        icon: appIcon
    });
    mainWindow.loadURL('file://' + __dirname + '/webapp/index.html');

      if (process.env.ACTIVATE_DEBUG) {
            mainWindow.webContents.openDevTools({
                mode: 'detach'
            });
       }

// autoUpdater.checkForUpdatesAndNotify();  
// If auto Updater is called here, updation won't work. 
// It has to be called explicitly in a separate event handler 
// like it's done below.

})

//has to be here only - although both events are "ready"
app.on('ready', function()  {
  autoUpdater.checkForUpdatesAndNotify();
});

something to do with ES6 syntax?

from electron-updater-example.

iffy avatar iffy commented on August 26, 2024

I doubt it's some ES6 syntax thing. That seems really odd that it would work in its own handler but not in one with other stuff in it. How long do you have to wait for the notification to appear in the working version?

from electron-updater-example.

girishbr avatar girishbr commented on August 26, 2024

It doesn't happen automatically. It happens only when I exit. And that too only with an explicit exit (ctrl + q) not a window close.
I am planning on bundling it up into a menu option "Update and Restart".

from electron-updater-example.

iffy avatar iffy commented on August 26, 2024

@girishbr is this resolved? Can I close this issue?

from electron-updater-example.

JLueke avatar JLueke commented on August 26, 2024

I just forked the repo and tried it. I only changed owner. No codesigning for windows (neither for mac).
The windows app detects that their is an update available "Update available", but soon after it just says "Update downloaded". Their is no progress bar in between.
Restarting the app doesn't change anything.

from electron-updater-example.

JLueke avatar JLueke commented on August 26, 2024

The auto-updater currently doesn't work.
There's is a temporary solution until the PR is accepted.
Worked for me.

from electron-updater-example.

kittaakos avatar kittaakos commented on August 26, 2024

Update: it works as expected.

Update 2: Use the Auto updates - Option 2 - More control from

// app.on('ready', function() {
// autoUpdater.checkForUpdates();
// });
// autoUpdater.on('checking-for-update', () => {
// })
// autoUpdater.on('update-available', (info) => {
// })
// autoUpdater.on('update-not-available', (info) => {
// })
// autoUpdater.on('error', (err) => {
// })
// autoUpdater.on('download-progress', (progressObj) => {
// })
// autoUpdater.on('update-downloaded', (info) => {
// autoUpdater.quitAndInstall();
// })

Sorry for the noise :(


I have forked the repo, adjusted the owner, and added nsis as a win target. Published a new release, then another release. The updates are picked up and downloaded on Windows, but there is no automatic restart. Is this the expected behavior? A manual restart resolves the problem:

Screen Shot 2019-07-09 at 13 34 50
Screen Shot 2019-07-09 at 13 43 04

Thank you!

Update:
Here is the log from c:\Users\kittaakos\AppData\Roaming\electron-updater-example\log.log:

[2019-07-09 13:06:07:0559] [info] App starting...
[2019-07-09 13:06:08:0115] [info] Checking for update
[2019-07-09 13:06:08:0247] [info] Checking for update...
[2019-07-09 13:06:08:0531] [info] Generated new staging user ID: 294d42f1-7072-53d5-8730-4ebd99f8ce76
[2019-07-09 13:06:12:0092] [info] Update for version 0.7.3 is not available (latest version: 0.7.3, downgrade is disallowed).
[2019-07-09 13:06:12:0092] [info] Update not available.
[2019-07-09 13:15:45:0301] [info] App starting...
[2019-07-09 13:15:45:0407] [info] Checking for update
[2019-07-09 13:15:45:0550] [info] Checking for update...
[2019-07-09 13:15:48:0699] [info] Found version 0.7.4 (url: electron-updater-example-setup-0.7.4.exe)
[2019-07-09 13:15:48:0700] [info] Update available.
[2019-07-09 13:15:48:0700] [info] Downloading update from electron-updater-example-setup-0.7.4.exe
[2019-07-09 13:15:48:0741] [info] No cached update info available
[2019-07-09 13:15:48:0747] [info] Download block maps (old: "https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.3/electron-updater-example-setup-0.7.3.exe.blockmap", new: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.4/electron-updater-example-setup-0.7.4.exe.blockmap)
[2019-07-09 13:15:49:0514] [info] File has 34 changed blocks
[2019-07-09 13:15:49:0520] [info] Full: 37,397.72 KB, To download: 775.44 KB (2%)
[2019-07-09 13:15:49:0549] [info] Differential download: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.4/electron-updater-example-setup-0.7.4.exe
[2019-07-09 13:15:49:0794] [info] Redirect to https://github-production-release-asset-2e65be.s3.amazonaws.com/195969671/80946800-a24a-11e9-9cba-a648ddcc499e
[2019-07-09 13:15:52:0776] [info] New version 0.7.4 has been downloaded to C:\Users\kittaakos\AppData\Local\electron-updater-example-updater\pending\electron-updater-example-setup-0.7.4.exe
[2019-07-09 13:15:52:0784] [info] Update downloaded
[2019-07-09 13:16:17:0500] [info] Auto install update on quit
[2019-07-09 13:16:17:0500] [info] Install: isSilent: true, isForceRunAfter: false
[2019-07-09 13:18:28:0700] [info] App starting...
[2019-07-09 13:18:28:0861] [info] Checking for update
[2019-07-09 13:18:28:0944] [info] Checking for update...
[2019-07-09 13:18:32:0002] [info] Update for version 0.7.4 is not available (latest version: 0.7.4, downgrade is disallowed).
[2019-07-09 13:18:32:0002] [info] Update not available.
[2019-07-09 13:33:48:0245] [info] App starting...
[2019-07-09 13:33:48:0352] [info] Checking for update
[2019-07-09 13:33:48:0474] [info] Checking for update...
[2019-07-09 13:33:52:0367] [info] Found version 0.7.5 (url: electron-updater-example-setup-0.7.5.exe)
[2019-07-09 13:33:52:0367] [info] Update available.
[2019-07-09 13:33:52:0367] [info] Downloading update from electron-updater-example-setup-0.7.5.exe
[2019-07-09 13:33:52:0403] [info] Cached update sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached: H76g/JD4ZO0drEe1TE4MxCdi45Bmu018GUNGvD7nXz6Veo+0xZ0pL5zvzgZvBFR4llDTAdBJweFDVO9q+HFWcQ==, expected: Udc/GzlinP1QRCS/4rJf3/5pTvz1IeEs63wIZdLZRYBTddzb/wTHHiSHh3E4uO3uiyj9FfCYrNxlfrW9FlTPWw==. Directory for cached update will be cleaned
[2019-07-09 13:33:52:0430] [info] Download block maps (old: "https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.4/electron-updater-example-setup-0.7.4.exe.blockmap", new: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.5/electron-updater-example-setup-0.7.5.exe.blockmap)
[2019-07-09 13:33:54:0004] [info] File has 38 changed blocks
[2019-07-09 13:33:54:0009] [info] Full: 37,397.75 KB, To download: 816.74 KB (2%)
[2019-07-09 13:33:54:0019] [info] Differential download: https://github.com/kittaakos/electron-updater-example/releases/download/v0.7.5/electron-updater-example-setup-0.7.5.exe
[2019-07-09 13:33:54:0324] [info] Redirect to https://github-production-release-asset-2e65be.s3.amazonaws.com/195969671/30b6a080-a24c-11e9-9861-71e0827baf5c
[2019-07-09 13:34:00:0161] [info] New version 0.7.5 has been downloaded to C:\Users\kittaakos\AppData\Local\electron-updater-example-updater\pending\electron-updater-example-setup-0.7.5.exe
[2019-07-09 13:34:00:0167] [info] Update downloaded
[2019-07-09 13:42:00:0096] [info] Auto install update on quit
[2019-07-09 13:42:00:0102] [info] Install: isSilent: true, isForceRunAfter: false
[2019-07-09 13:42:10:0154] [info] App starting...
[2019-07-09 13:42:10:0327] [info] Checking for update
[2019-07-09 13:42:10:0486] [info] Checking for update...
[2019-07-09 13:42:17:0102] [info] Update for version 0.7.5 is not available (latest version: 0.7.5, downgrade is disallowed).
[2019-07-09 13:42:17:0102] [info] Update not available.
[2019-07-09 13:42:33:0264] [info] App starting...
[2019-07-09 13:42:33:0432] [info] Checking for update
[2019-07-09 13:42:33:0571] [info] Checking for update...
[2019-07-09 13:42:37:0266] [info] Update for version 0.7.5 is not available (latest version: 0.7.5, downgrade is disallowed).
[2019-07-09 13:42:37:0267] [info] Update not available.

from electron-updater-example.

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.