Ensure we use a working mirror for downloading Tails images
#15755 (closed) is about letting the client test the mirror before downloading. That's a nice idea, but is not possible from JS, because of same-origin-policy. CORS could make it possible to have this, but probably our mirror operators won't do that.
So what we could do is just pick a new mirror every time the user clicks on the Download button. This way, if the download doesn't start, and the user just clicks again, they could be luckier in this second try!
Another implementation idea, from #15755 (comment 176496):
actually, there might be a way of doing that. From JS, you can add a
new Image()
whosesrc
is, for examplehttps://mirrors.wikimedia.org/tails/project/test.png
. If that image can be loaded, then the mirror is working. Testing whether the image has loaded can apparently be done. Though hackish, I think this is better than #18561 from a UX perspective.
Let's give it a try, spending ~2h on this, and if it turns out it's more complicated, switch to #18263 instead.
We've set up a test image on the mirrors for this: tails/project/mirror-test.png
.
Code base: https://gitlab.tails.boum.org/tails/mirror-pool-dispatcher (getRandomMirrorUrlPrefix
function).
Design doc: https://tails.boum.org/contribute/design/mirrors/
Context: https://gitlab.tails.boum.org/tails/blueprints/-/wikis/HTTP_mirror_pool