Comments (24)
Actually, no need to change the docs. I looked at the source code and Auto Updater does support private github accounts. The only way I could get it to work is by calling the
autoUpdater.setFeedURL({ provider: 'github', owner: '[repo owner]', repo: '[repo name]', token: '[gh_token]' })
method before calling checkForUpdates()
in main.js.
Of course, doing that is a serious security issue because your private repo token will need to be stored in the source code. Too bad GitHub doesn't offer read-only repo tokens.
from electron-updater-example.
I know this is old, but @marc-parillo thanks for this.
This was the only way I could get electron-updater working in a build with a regular private GH setup, and an org would just add unneeded overhead. Of course hard-coded tokens were far from ideal, so I ended up accessing each value via an environment variable set by dotenv on startup from an ignored .env file.
autoUpdater.setFeedURL({ provider: 'github', owner: process.env.OWNER, repo: process.env.REPO, token: process.env.GH_TOKEN })
Yes, the variables are still in the built source itself, but I'm obfuscating this after webpack, so finding these are not that feasible.
Its great to see it working now. 👍
By the way, what are the future plans of this feature now? I still see the docs state support for "Private GH Repos".
from electron-updater-example.
If @develar is correct -- then the documentation is misleading with regards to the Auto Update feature.
Please change the docs to indicate that private github repos are not supported for Auto Updating. The docs at https://github.com/electron-userland/electron-builder/wiki/Auto-Update#private-github-update-repo say... "You can use a private repository for updates with electron-updater"
from electron-updater-example.
Thank you for the answer, it really helped. Two more things though.
- How should the repo look like? I mean what it should contain? Only an .exe (installer) file and latest.yml? Or the source files (before compiling)? Or the files in win-unpacked folder (the compiled files)?
- Is it possible to make a video in youtube how this work? With all the configs and ect. It would be very helpful.
from electron-updater-example.
Ok, I did what you said. I uploaded the .exe
and latest.yml
in a foo
folder in the repo. Then I navigated to the folder and copy the URL. Then I set the URL at the package.json
in the publish option like this:
"publish": [
{
"provider": "generic",
"url": "https://git.companyname.com/repo_name/src/master/foo/"
}
]
Unfortunately, when I start the app, an error pops up:
Error: Error: Cannot find channel "latest.yml" update info: HttpError: 404 Not Found
"method: undefined url: https://git.companyname.com/repo_name/src/master/foo/latest.yml\n\n Please double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n "
Could you tell me what's wrong? There is nothing in google when I search the error.
And just out of curiosity, in latest.yml
there is sha2: foobarfoobarfoobar...
row. Is there something I must do with it?
from electron-updater-example.
@MutableLoss I'm glad you found it helpful. Fortunately, I was eventually able to host everything in an S3 bucket so I was able to bypass GH altogether.
from electron-updater-example.
I've only ever published on GitHub, but I'm pretty sure you can do it on other providers (including your own). I'm guessing you want to configure publish
as generic
according to these docs: https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#PublishConfiguration
So (and I'm just guessing here) do this:
Step 3.5: Update package.json
to have this in it (see https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#genericserveroptions--publishconfiguration):
{
...
"build": {
"publish": [{
"provider": "generic",
"url": "https://example.com"
}],
}
...
}
Step 4 is GitHub specific.
Step 5: Build the project: node_modules/.bin/build --win --mac
with whatever flags you need (see the docs for this) then manually upload the generated files to the right places.
Step 6 is GitHub specific.
I'm not sure what the correct values for url
are or where you need to place the uploaded files... I'm sorry. But maybe this is enough to get you close?
Please reopen if you have more questions.
from electron-updater-example.
I'm not sure. @develar, how should files be laid out on the fileserver for a generic
provider?
from electron-updater-example.
Url — it is base URL for installer and channel update info files. I.e both exe and latest.yml must uploaded. Layout — nothing specific. E.g https://example.com/foo — dir foo must contains these files.
from electron-updater-example.
So:
"url": "https://www.example.com/foo"
with these files on the webserver:
https://www.example.com/foo/latest.yml
https://www.example.com/foo/myapp Setup.exe
Does that work, @mbtakanov ?
from electron-updater-example.
@mbtakanov If you use your browser to go to the url mentioned in the error do you get a 404 or does it download the file?
@develar is the problem that method
is undefined
?
from electron-updater-example.
@mbtakanov Does this work for you? https://gist.github.com/iffy/0ff845e8e3f59dbe7eaf2bf24443f104
It worked for my updating my macOS app.
from electron-updater-example.
Hi, thank you for going through this with me.
-
If I navigate to
https://git.companyname.com/repo_name/src/master/foo/latest.yml
in my browser, it just shows the content of the file just like any other file opened in a repo (example - https://github.com/electron/electron/blob/master/script/bootstrap.py) -
The instructions in the link you provided - https://gist.github.com/iffy/0ff845e8e3f59dbe7eaf2bf24443f104 helped me to create a working update process (I had to
npm install http-server -g
and use it, no big deal). The question now is, how I can create the same thing, but with a URL of a repo (like the one above) and not with a htpp-server? -
Is it possible, the update process to be like any other normal app update and not uninstall and install?
from electron-updater-example.
- The
generic
provider is for plain old HTTP servers that serve plain old files. For instance, instead of https://github.com/electron/electron/blob/master/script/bootstrap.py electron-updater is expecting the "Raw" version of that file (i.e. https://raw.githubusercontent.com/electron/electron/master/script/bootstrap.py -- notice that this is fromraw.githubusercontent.com
)
What software are you using to host your git repos on the web? GitHub? BitBucket? GitLab? Something else? I imagine most of them have a way to serve raw files. More information would help me help you.
-
(You probably don't need the
-g
to installhttp-server
) -
I'm not sure what you mean. When I update this app, it installs itself and restarts without me having to uninstall then install.
from electron-updater-example.
If you cannot use GitHub or Bintray to serve artifacts — just use Amazon S3. It is very cheap.
from electron-updater-example.
My company repo is based on GitHub, everything is the same as github.com, but it's on a private domain. Imagine I'm at the folder where are the .exe
and latest.yml
. So, how can I extract a link which will work in the generic
provider? Is it even possible? I can get the link with the raw latest.yml
file, but as we know, we need a link which contain both, the .exe
and latest.yml
files. My goal here is to make it work with a "github like" repository and if possible - avoid Amazon S3.
I have "oneClick": false,
so on update, the app uninstall by itself, but I have to manage the installation. I guess your (@iffy) options is different, that's why you don't have to manage the installation process. Anyway, my question was about that is there a way/is it possible that the app doesn't uninstall and install (by itself or not, it doesn't matter), but instead, it just apply the patch" on the current installation?
from electron-updater-example.
@mbtakanov Can you use the github
provider and configure host
(inside package.json
) and token
in setFeedURL
as described here: https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#githuboptions--publishconfiguration
from electron-updater-example.
@mbtakanov if you want silent update for boring installer — file issue to electron-builder.
If you want to use private GitHub repo for update — no way (see docs for more details).
from electron-updater-example.
@iffy I have few questions:
- I created access token from my company private repo. Then I put it in
token
property. Now mypackage.json
look like this:
...
"publish": [
{
"provider": "github",
"repo": "repo_name",
"host": "https://git.companyname.com/repo_name/src/master/foo",
"protocol": "https",
"token": "123foobar123foobar"
}
],
...
Is this ok?
2) In https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#GithubOptions, the token
description is somehow incomprehensible. What Never specify it in the configuration files. Only for setFeedURL.
means? Which files are meant to be configuration
-able?
3) In https://github.com/electron/electron/blob/master/docs/api/auto-updater.md -> autoUpdater.setFeedURL(url[, requestHeaders])
- what to set as
url
? The URL of the company website (https://git.companyname.com) or the URL to the folder where are the.exe
andlatest.yml
(https://git.companyname.com/repo_name/src/master/foo) or something else? - what to set as
requestHeaders
?
- When I run the app with the above config and
autoUpdater.setFeedURL('https://git.companyname.com/repo_name/src/master/foo', [{ }]);
in the electron file, I get the error which I posted earlier:
Error: Error: Cannot find channel "latest.yml" update info: HttpError: 404 Not Found
"method: undefined url: https://git.companyname.com/repo_name/src/master/foo/latest.yml\n\n Please double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n "
Is @develar right saying using private GitHub repo for update is impossible?
from electron-updater-example.
Docs is clear — https://github.com/electron-userland/electron-builder/wiki/Auto-Update#private-github-update-repo So, in short, do not use private GitHub repo for autoupdate.
from electron-updater-example.
@mbtakanov I'm closing this (as it seems your use case isn't supported). But open a new issue or comment on this if you have more questions.
from electron-updater-example.
@nbcnc can you file an issue on that repo? Or better yet a PR. I don't control those docs :)
from electron-updater-example.
will do
from electron-updater-example.
@marc-parillo Yes, as stated in the docs. https://github.com/electron-userland/electron-builder/wiki/Auto-Update#private-github-update-repo
Too bad GitHub doesn't offer read-only repo tokens.
Please read solution in the linked issue — electron-userland/electron-builder#1393 (comment)
from electron-updater-example.
Related Issues (20)
- Publish and auto update for windows with generic provider HOT 2
- Doesn't work on Windows HOT 17
- 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.