balena-dash
balena-dash copied to clipboard
Loss of URL parameters from WPE_URL
This issue was originally raised in https://www.balena.io/blog/using-google-slides-with-balenadash/#comment-4549162493
The symptom is that google slides shows are not looping. I think I have isolated it to the extra "loop" parameter being lost from the URL being shown. If I browse to the web host (port 8080 on the host device), then I can see that the url parameters are being dropped:
https://docs.google.com/presentation/d/e/<identifier>/pub?start=true
when that needs to be:
https://docs.google.com/presentation/d/e/<identifier>/pub?start=true&loop=true&delayms=1000
Pasting that latter URL into the web app at port 8080 has the proper looping behavior, so I think it's not a problem with wpe itself. I think I have isolated this to wpe-init, where wget posts the URL to the web host:
https://github.com/balena-io-projects/balena-dash/blob/master/wpe/wpe-init#L41
What I'm pretty sure is happening is that the ampersands in the URL are being interpreted as separators between variables to post. So, instead of:
url=https://docs.google.com/presentation/d/e/<identifier>/pub?start=true&loop=true&delayms=1000
we are getting:
https://docs.google.com/presentation/d/e/<identifier>/pub?start=true
loop=true
delayms=1000
as separate variables. These seem to be getting passed along to the slideshow somehow (the delayms certainly seems to change), but the loop argument doesn't seem to stick.
I thought putting data into a file and then passing the file instead of a string might be a nice fix: https://superuser.com/a/1328046/184799
but unfortunately, the wget in the container doesn't support the --post-file
parameter. I can't seem to track down where the true base image is - I followed it to a few users' personal repos, but got lost.
Is there a good way that you know of to prevent these URL parameters from getting stripped out and lost? Is it worthwhile to try to install a more complete wget implementation to try the --post-file
approach?
I can confirm this issue, ran into it with grafana, anything after the first & gets cut off
Great catch, I will try figuring this out during the next few days! Let us know if you come with a solution as well! Cheers
The problem is probably that we pass the URL directly into a GET request to the localhost server that sets the URL. (https://github.com/balena-io-projects/balena-dash/blob/master/wpe/wpe-init#L41)
The simplest solution would be to URL encode the URL when doing the local request that sets the URL. If I get some time I may make a fix by the end of the week.
I found a workaround using an URL shortener like bit.ly for example and then set the shortend URL as WPE_URL parameter.