Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron-updater Support for private Github repository #1266

Closed
AlienHoboken opened this issue Feb 15, 2017 · 12 comments · May be fixed by qcif/data-curator#563
Closed

electron-updater Support for private Github repository #1266

AlienHoboken opened this issue Feb 15, 2017 · 12 comments · May be fixed by qcif/data-curator#563

Comments

@AlienHoboken
Copy link
Contributor

AlienHoboken commented Feb 15, 2017

electron-builder version: 13.7.0:

electron-updater version: 1.6.4

Target Windows:

Electron updater seems unable to locate my private Github repository even when the GH_TOKEN environment variable is set. I've tried setting the env variable through the system settings, programatically by altering process.env.GH_TOKEN, and even passing the token parameter in app-update.yml (which seems it might be respected after looking into electron-updater's code). I've verified via logging that process.env.GH_TOKEN is properly set to my token which has all permission scopes granted.

Is there something I am missing or is there a known issue with private Github repositories? If I make the repo public then updater finds it and updates perfectly, so the integration is good.

@develar
Copy link
Member

develar commented Feb 15, 2017

#891 (comment)

@develar
Copy link
Member

develar commented Feb 15, 2017

#529 (comment)

@develar
Copy link
Member

develar commented Feb 15, 2017

As your app code is available for everyone, electron updater can use only public resources.

@AlienHoboken
Copy link
Contributor Author

Is there a reason for that limitation? Why can't electron-updater access private resources with a proper authentication token?

@develar
Copy link
Member

develar commented Feb 16, 2017

Where a proper authentication token can be stored? Or do you want to somehow set it programmatically in setFeedURL?

@AlienHoboken
Copy link
Contributor Author

The use case is like this:

We have an application which will be distributed on controlled machines, not distributed to the public. Therefore if we create a Github user with read only privileges to our private repository we are fine with storing an authentication token for that user on the machine (in an environment variable, app-update.yaml, wherever) so they can pull releases to update.

Would this be possible with electron-updater? And if so, could you point me in the correct direction?

@develar develar reopened this Feb 16, 2017
@develar develar added feature and removed question labels Feb 16, 2017
@develar
Copy link
Member

develar commented Feb 16, 2017

You need to write own provider and use rest api instead of public URL to download files and get latest info. Would you like to help and create PR?

@AlienHoboken AlienHoboken changed the title electron-updater unable to find private Github repository electron-updater Support for private Github repository Feb 16, 2017
@AlienHoboken
Copy link
Contributor Author

Yeah if it's doable then I'm fine writing it and submitting a PR. You think the best way to proceed is a new provider? Or should github provider be extended to support private repositories?

@develar
Copy link
Member

develar commented Feb 16, 2017

I prefer new provider because code will be totally rewritten (no common code). But provider name in the conf will be still github, but https://github.com/electron-userland/electron-builder/blob/master/packages/electron-builder-util/src/fs.ts#L166 if token set, PrivateGithubProvider will be created.

@AlienHoboken
Copy link
Contributor Author

Sounds good, will update with PR

AlienHoboken added a commit to AlienHoboken/electron-builder that referenced this issue Mar 8, 2017
Creates a PrivateGitHubProvider for auto updater. Used if the GH_TOKEN
environment variable is set. Also adds the ability to all providers to
pass custom headers to the download for the update file.
@AlienHoboken
Copy link
Contributor Author

Submitted PR #1343

@develar
Copy link
Member

develar commented Mar 13, 2017

Please try electron-updater 1.9.0 (thanks to @AlienHoboken)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants