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

How to remove query parameters from feed URL is unclear #278

Open
FranzJoseph17 opened this issue May 26, 2021 · 4 comments
Open

How to remove query parameters from feed URL is unclear #278

FranzJoseph17 opened this issue May 26, 2021 · 4 comments

Comments

@FranzJoseph17
Copy link

Hello, i started to program not so much time ago and i'm having trouble with this project:
In the docs it's clearly stated that:

You'll just need to configure your Update.exe or Squirrel.Windows to use http://download.myapp.com/update/win32/:version/:channel as a feed URL without query parameters.

The problem is: how is this configuration done?

The link to the Squirrel docs leads to the main summary page, not the specific section about how to do this.
I searched the internet but i couldn't find anything useful.

To give more context here is my code

const url = 'http://my-site/update/win64/' + app.getVersion() + '/stable';
autoUpdater.setFeedURL({ url });
autoUpdater.checkForUpdates();

The link Squirrel tries to download RELEASES file is
http://my-site/update/win64/1.9.9/stable/RELEASES?id=my-app-name&localVersion=1.9.9&arch=amd64

It fails and the error is
Filename can either be an absolute HTTP[s] URL, *or* a file name

I feel like i'm missing something obvious as similar old issues had been closed without providing a solution, can someone point me in the right direction? I would really appreciate that :)

@ArekSredzki
Copy link
Owner

Hi @FranzJoseph17, Sorry that I don't have much time these days for a complete answer.
I would suggest checking out the relevant client code in https://github.com/ArekSredzki/electron-app-base

Otherwise, perhaps @DustinBrett would know.

@FranzJoseph17
Copy link
Author

FranzJoseph17 commented May 28, 2021

Thank you for your answer @ArekSredzki

The autoUpdate code of the App is 6 years old and i believe that, in the meanwhile, Squirrel has changed to automatically attach query parameters as stated by one of the committers.

I've commented on a similar still open Squirrel issue providing the details that were missing, if a solution is suggested and it works i'll post it here too.

Have a nice day

@raiyans2016
Copy link

raiyans2016 commented Jul 16, 2021

@FranzJoseph17

The problem might not be the query parameters auto generated by Squirrel. If you request the RELEASES file with or without the query parameter you will still have the server provide it for you. To test this, just copy and paste the url you provided, in your browser and see if the RELEASES file is downloaded.
am talking about this link http://my-site/update/win64/1.9.9/stable/RELEASES?id=my-app-name&localVersion=1.9.9&arch=amd64

if your RELEASES file is downloaded successfully try to look into its contents, there you will see the download link of your nupkg file. This link should not start with "/download" but with your server ip address or domain name if you have any or localhost or so. If it starts with download, then change this in your server in the api/controllers/VersionController.js file. There you will see an obvious instruction asking you to modify the url used in the RELEASES file to include the full absolute url needed to download the nupkg file from the server..meaning ..just add your ip address and port number before the /download and that's all.
This necessary change should actually have been written somewhere in the documentations, it would have saved me quite a bit of tracing time!

@Burzo
Copy link

Burzo commented Nov 17, 2023

Ok, I went digging through the code and found out what is going on in my case. Hopefully, this helps someone else.

The problem is that you probably have ports involved in your appUrl, which is almost always the case when you're developing (mine was http://localhost:8080). Under the hood, when electron-release-server generates the RELEASES file (link to the code in question), it uses the nodes built-in URL library.

Now the problem: If you only specify the domain + port (eg. localhost:8080 instead of ˙http://localhost:8080˙), this library incorrectly parses the provided URL (explanation) and what you're left is:

localhost:/download/flavor/<my_app>/<version>/<platform>/<my_app>-full.nupkg

which causes Squirrel to report back the the initial error Filename can either be an absolute HTTP[s] URL, *or* a file name.

Solution: If using ports, provide the full url to electron-release-server (http://localhost:8080 instead of localhost:8080).

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

No branches or pull requests

4 participants