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

Auto-detect most likely download #10

Closed
TrueBrain opened this issue Jan 4, 2019 · 3 comments
Closed

Auto-detect most likely download #10

TrueBrain opened this issue Jan 4, 2019 · 3 comments
Labels
enhancement
Milestone

Comments

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Jan 4, 2019

In the old setup, we did server-side detection (Based on the User-Agent) what the most likely download is that you would be needing. In the new setup we cannot do this server-side anymore, so we need a client-side detection script for this.

https://www.staging.openttd.org/downloads/openttd-releases/1.8.0.html

Here we would like to see only 'win64' if you use Windows on a 64bit system. This greatly reduces the amount of bug-tickets because people downloaded the wrong binary.

@TrueBrain TrueBrain added the enhancement label Jan 4, 2019
@glx22
Copy link
Contributor

@glx22 glx22 commented Jan 4, 2019

I guess something using navigator.userAgent should work ( https://www.w3schools.com/js/tryit.asp?filename=tryjs_nav_userAgent )

@TrueBrain
Copy link
Member Author

@TrueBrain TrueBrain commented Jan 4, 2019

Possibly another idea is to use something like this:

https://github.com/bestiejs/platform.js/blob/master/platform.js

Then we don't have to figure out all the quirks of Browsers :D

@TrueBrain TrueBrain added this to the 1.0.0 milestone Jan 5, 2019
@TrueBrain
Copy link
Member Author

@TrueBrain TrueBrain commented Jan 19, 2019

Best library I could find:
https://github.com/faisalman/ua-parser-js

Does OS and Arch detection, and pretty well. Seems good maintained.

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

No branches or pull requests

2 participants