electron-release-server icon indicating copy to clipboard operation
electron-release-server copied to clipboard

Auto-Update with Windows not working

Open Bartiff opened this issue 3 years ago • 3 comments

Hi,

We have an Electron App that we are building for macOS and Windows 10. As part of the auto-update we have followed this documentation: https://github.com/ArekSredzki/electron-release-server/blob/master/docs/update-windows.md

Version used : the last (master branch)

We have 2 versions on our Election Release Server (0.10.3 and 0.11.0), both with assets:

  • My App Setup 0.11.0.exe (Windows 64 bit)
  • My App Setup 0.11.0.exe.blockmap (Windows 64 bit)
  • my-app-0.11.0-full.nupkg (Windows 64 bit)
  • My App-0.11.0.dmg (OS X 64 bit)
  • My App-0.11.0-mac.zip (OS X 64 bit)

We have no problem with auto-update with macOS. For example :

https://myapp.com/update/darwin/0.10.0 -> 200 (Return a json with the keys url, name, notes and pub_date for version 0.11.0)

But we can't get the same result with Windows by testing the following two strategies:

1 - SQUIRREL : (-full.nupkg)

  • https://myapp.com/update/{win32/win64}/0.10.0 -> 204 No Content

  • https://myapp.com/update/win64/0.10.0/RELEASES -> 200 (Return a link to the .nupkg file of version 0.11.0)

    In this case the endpoint does not return the data in json format and therefore does not work with the setFeedURL() method.

2 - NSIS : (.blockmap)

  • https://myapp.com/update/win32x64/ -> 404 Not Found

  • https://myapp.com/update/win32x64/latest.yml -> 200 (Return a link to the .nupkg file of version 0.11.0)

    In this case the endpoint does not return the data in json format and therefore does not work with the setFeedURL() method.

However, we don't understand why it doesn't work for Windows. What are we doing wrong? What is the correct procedure for auto-updating Windows applications?

Bartiff avatar Jun 25 '21 08:06 Bartiff

just switch to GitHub releases :)

beliaev-maksim avatar Jul 09 '21 16:07 beliaev-maksim

Just use electron-builder, electron-builder-squirrel-windows and electron-updater

import { NsisUpdater } from "electron-updater" const feed = 'your_site/update/windows_64' const autoUpdater = new NsisUpdater({ provider: 'generic', url: feed, useMultipleRangeRequest: false, channel: 'latest' })

And build the app using electron-builder My builder confs: "build": { "appId": "com.your.app", "icon": "src/img/icon.ico", "win": { "target": [ "squirrel" ] }, "squirrelWindows": { "iconUrl": "url_to_ico" }, "publish": { "provider": "github", "owner": "username", "repo": "repo" } },

If you have a problem with missing app-update.yml and dev-app-update.yml then paste the following code into index.js:

import { app, BrowserWindow } from 'electron'; import { NsisUpdater } from "electron-updater" import path from "path" import fs from "fs" const feed = 'your_site/update/windows_64'

let yaml = '';

yaml += "provider: generic\n" yaml += "url: your_site/update/windows_64\n" yaml += "useMultipleRangeRequest: false\n" yaml += "channel: latest\n" yaml += "updaterCacheDirName: " + app.getName()

let update_file = [path.join(process.resourcesPath, 'app-update.yml'), yaml] let dev_update_file = [path.join(process.resourcesPath, 'dev-app-update.yml'), yaml] let chechFiles = [update_file, dev_update_file]

for (let file of chechFiles) { if (!fs.existsSync(file[0])) { fs.writeFileSync(file[0], file[1], () => { }) } }

than create dev-app-update.yml near index.js

provider: generic url: your_site/update/windows_64 useMultipleRangeRequest: false channel: latest updaterCacheDirName: updating

If you have more questions, then write me an email, I will try to help

zhanilyasov avatar Dec 30 '21 19:12 zhanilyasov

I don't know if is the same problem but I remove the RELEASES of the update url of setFeedURL, was not in the the docs btw

https://github.com/ArekSredzki/electron-release-server/blob/master/docs/update-windows.md

emanoelqueiroz avatar Oct 25 '23 11:10 emanoelqueiroz