Comments (17)
@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.
@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.
Aah! I've to choose one of the two options. My bad. Will check it again.
from electron-updater-example.
@girishbr k, let me know if it works
from electron-updater-example.
Took the easy route with just autoUpdater.checkForUpdatesAndNotify();
right here.
https://github.com/intelligrate/query-cloud-api/blob/master/main.js#L309.
- Published version 2. Downloaded it
- Changed version 2 to version 3. Published it again and made it public.
- Ran version 2 from my PC again and closed it expecting it to update.
- 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.
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.
that's weird! This's what I see.
from electron-updater-example.
Maybe make 0.0.4 and 0.0.5 (both publicly released -- not drafts) to avoid potential name conflicts?
from electron-updater-example.
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.
@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.
@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.
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.
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.
@girishbr is this resolved? Can I close this issue?
from electron-updater-example.
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.
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.
Update: it works as expected.
Update 2: Use the Auto updates - Option 2 - More control
from
electron-updater-example/main.js
Lines 127 to 142 in fb1b690
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:
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)
- Publish and auto update for windows with generic provider HOT 2
- Example for S3 provider instead of github HOT 2
- I'd love some help HOT 8
- I could not find releases.atom in github HOT 2
- Application is not updating automatically via private GitHub repo HOT 9
- Can this example support test in dev mode ?
- .zip windows target from electron-builder gets auto-updates HOT 1
- 'update-downloaded' never gets triggered, even after 'download-progress' is complete HOT 4
- TypeError: Cannot read property 'name' of undefined
- EEXIST: file already exists
- Example doesn't work with current versions of Electron HOT 4
- Error during update download HOT 12
- I use electronic updater to package the generated zip package on the Mac. After decompression, it shows that you don't have permission to open the application.
- SHA512 Mismatch Error in auto-updater HOT 1
- I know this is old, but @marc-parillo thanks for this.
- Change token in a private repo HOT 3
- ERROR using electron-updater with Provider Generic HOT 6
- GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN" HOT 1
- (Question) Update from localfolder?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-updater-example.