copasi / copasi.github.io

COPASI Website
0 stars 1 forks source link

OS Detection #2

Open shoops opened 2 years ago

shoops commented 2 years ago

In order to enhance user download experience we would like to detect the OS and hardware the user is using. The intranet page link allows us to collect the currently provided information.

shoops commented 2 years ago
Browser: Google Chrome
OS:      Linux (Opensuse Leap 15.3)
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36","browser":{"name":"Chrome","version":"97.0.4692.99","major":"97"},"engine":{"name":"Blink","version":"97.0.4692.99"},"os":{"name":"Linux","version":"x86_64"},"device":{},"cpu":{"architecture":"amd64"}}

userAgentData: Brands: [{"brand":" Not;A Brand","version":"99"},{"brand":"Google Chrome","version":"97"},{"brand":"Chromium","version":"97"}] Mobile: false Platform: Linux

Version: 5.3.18 Architecture: x86 Bitness: 64 Model: Full Version: 97.0.4692.99 Full Version List: undefined

shoops commented 2 years ago
Browser: Mozilla Firefox
OS:      Linux (Opensuse Leap 15.3)
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0","browser":{"name":"Firefox","version":"91.0","major":"91"},"engine":{"name":"Gecko","version":"91.0"},"os":{"name":"Linux","version":"x86_64"},"device":{},"cpu":{"architecture":"amd64"}}

userAgentData: uaData is undefined

fbergmann commented 2 years ago
Browser: Chrome
OS:      MacOS High Sierra
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36","browser":{"name":"Chrome","version":"98.0.4758.80","major":"98"},"engine":{"name":"Blink","version":"98.0.4758.80"},"os":{"name":"Mac OS","version":"10.13.6"},"device":{},"cpu":{}}

userAgentData: Brands: [{"brand":" Not A;Brand","version":"99"},{"brand":"Chromium","version":"98"},{"brand":"Google Chrome","version":"98"}] Mobile: false Platform: macOS

Version: 10.13.6 Architecture: x86 Bitness: 64 Model: Full Version: 98.0.4758.80 Full Version List: [object Object],[object Object],[object Object]

fbergmann commented 2 years ago
Browser: Firefox
OS:      MacOS High Sierra
CPU:     amd64
bitness: 64 

UAParser:

{"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:97.0) Gecko/20100101 Firefox/97.0","browser":{"name":"Firefox","version":"97.0","major":"97"},"engine":{"name":"Gecko","version":"97.0"},"os":{"name":"Mac OS","version":"10.13"},"device":{},"cpu":{}}

userAgentData: uaData is undefined

fbergmann commented 2 years ago
Browser: Safari
OS:      MacOS High Sierra
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15","browser":{"name":"Safari","version":"13.1.2","major":"13"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"Mac OS","version":"10.13.6"},"device":{},"cpu":{}}

userAgentData: undefined is not an object (evaluating 'uaData.brands')

fbergmann commented 2 years ago
Browser: Opera
OS:      Windows 10
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36 OPR/84.0.4316.31","browser":{"name":"Opera","version":"84.0.4316.31","major":"84"},"engine":{"name":"Blink","version":"98.0.4758.109"},"os":{"name":"Windows","version":"10"},"device":{},"cpu":{"architecture":"amd64"}}

userAgentData: Brands: [{"brand":" Not A;Brand","version":"99"},{"brand":"Chromium","version":"98"},{"brand":"Opera","version":"84"}] Mobile: false Platform: Windows

Version: 10.0.0 Architecture: x86 Bitness: 64 Model: Full Version: 98.0.4758.109 Full Version List: [object Object],[object Object],[object Object]

fbergmann commented 2 years ago
Browser: Firefox
OS:      Windows 10
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0","browser":{"name":"Firefox","version":"98.0","major":"98"},"engine":{"name":"Gecko","version":"98.0"},"os":{"name":"Windows","version":"10"},"device":{},"cpu":{"architecture":"amd64"}}

userAgentData: uaData is undefined

fbergmann commented 2 years ago
Browser: Chrome
OS:      Windows 10
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36","browser":{"name":"Chrome","version":"99.0.4844.51","major":"99"},"engine":{"name":"Blink","version":"99.0.4844.51"},"os":{"name":"Windows","version":"10"},"device":{},"cpu":{"architecture":"amd64"}}

userAgentData: Brands: [{"brand":" Not A;Brand","version":"99"},{"brand":"Chromium","version":"99"},{"brand":"Google Chrome","version":"99"}] Mobile: false Platform: Windows

Version: 10.0.0 Architecture: x86 Bitness: 64 Model: Full Version: 99.0.4844.51 Full Version List: [object Object],[object Object],[object Object]

fbergmann commented 2 years ago
Browser: Edge
OS:      Windows 10
CPU:     amd64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.39","browser":{"name":"Edge","version":"99.0.1150.39","major":"99"},"engine":{"name":"Blink","version":"99.0.4844.51"},"os":{"name":"Windows","version":"10"},"device":{},"cpu":{"architecture":"amd64"}}

userAgentData: Brands: [{"brand":" Not A;Brand","version":"99"},{"brand":"Chromium","version":"99"},{"brand":"Microsoft Edge","version":"99"}] Mobile: false Platform: Windows

Version: 10.0.0 Architecture: x86 Bitness: 64 Model: Full Version: 99.0.1150.39 Full Version List: [object Object],[object Object],[object Object]

fbergmann commented 2 years ago
Browser: Safari
OS:       macOS Monterey
CPU:     arm64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15","browser":{"name":"Safari","version":"15.3","major":"15"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"Mac OS","version":"10.15.7"},"device":{},"cpu":{}}

userAgentData: undefined is not an object (evaluating 'uaData.brands')

fbergmann commented 2 years ago
Browser: Firefox
OS:       macOS Monterey
CPU:     arm64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0","browser":{"name":"Firefox","version":"98.0","major":"98"},"engine":{"name":"Gecko","version":"98.0"},"os":{"name":"Mac OS","version":"10.15"},"device":{},"cpu":{}}

userAgentData: uaData is undefined

fbergmann commented 2 years ago
Browser: Chrome
OS:       macOS Monterey
CPU:     arm64
bitness: 64 

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36","browser":{"name":"Chrome","version":"99.0.4844.74","major":"99"},"engine":{"name":"Blink","version":"99.0.4844.74"},"os":{"name":"Mac OS","version":"10.15.7"},"device":{},"cpu":{}}

userAgentData: Brands: [{"brand":" Not A;Brand","version":"99"},{"brand":"Chromium","version":"99"},{"brand":"Google Chrome","version":"99"}] Mobile: false Platform: macOS

Version: 12.2.1 Architecture: arm Bitness: 64 Model: Full Version: 99.0.4844.74 Full Version List: [object Object],[object Object],[object Object]

fbergmann commented 2 years ago
Browser: Safari
OS:       macOS Monterey
CPU:     arm64
bitness: 64 

userAgentData: undefined

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15","browser":{"name":"Safari","version":"15.3","major":"15"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"Mac OS","version":"10.15.7"},"device":{},"cpu":{}}

OS: {"platform":"Mac OS","platformVersion":"10.15.7"}

fbergmann commented 2 years ago
Browser: Firefox
OS:       macOS Monterey
CPU:     arm64
bitness: 64 

Results userAgentData: undefined

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0","browser":{"name":"Firefox","version":"98.0","major":"98"},"engine":{"name":"Gecko","version":"98.0"},"os":{"name":"Mac OS","version":"10.15"},"device":{},"cpu":{}}

OS: {"platform":"Mac OS","platformVersion":"10.15"}

fbergmann commented 2 years ago
Browser: Chrome
OS:       macOS Monterey
CPU:     arm64
bitness: 64 

Results userAgentData: {"brands":[{"brand":" Not A;Brand","version":"99"},{"brand":"Chromium","version":"99"},{"brand":"Google Chrome","version":"99"}],"mobile":false}

highEntropyValues: {"architecture":"arm","bitness":"64","brands":[{"brand":" Not A;Brand","version":"99"},{"brand":"Chromium","version":"99"},{"brand":"Google Chrome","version":"99"}],"fullVersionList":[{"brand":" Not A;Brand","version":"99.0.0.0"},{"brand":"Chromium","version":"99.0.4844.74"},{"brand":"Google Chrome","version":"99.0.4844.74"}],"mobile":false,"model":"","platform":"macOS","platformVersion":"12.2.1","uaFullVersion":"99.0.4844.74"}

UAParser: {"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36","browser":{"name":"Chrome","version":"99.0.4844.74","major":"99"},"engine":{"name":"Blink","version":"99.0.4844.74"},"os":{"name":"Mac OS","version":"10.15.7"},"device":{},"cpu":{}}

OS: {"platform":"macOS","architecture":"arm","bitness":"64","platformVersion":"12.2.1"}

hasanbaig commented 2 years ago

@fbergmann After your fix, I have now get the normal Darvin version on Safari, and correct Intel version from Chrome.

fbergmann commented 1 year ago

@shoops the new download site does not quite work for me on Safari and Firefox (arm, Monterey):

monterey safari / firefox

it is fine on chrome though

monterey

fbergmann commented 1 year ago

the ua parser strings currently are:

safari

userAgentData:
undefined

UAParser:
{"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15","browser":{"name":"Safari","version":"16.6","major":"16"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"Mac OS","version":"10.15.7"},"device":{},"cpu":{}}

OS:
{"platform":"Mac OS","platformVersion":"10.15.7"}

Firefox

here it is even worse, as it is saying it would be an intel processor


userAgentData:
undefined

UAParser:
{"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0","browser":{"name":"Firefox","version":"98.0","major":"98"},"engine":{"name":"Gecko","version":"98.0"},"os":{"name":"Mac OS","version":"10.15"},"device":{},"cpu":{}}

OS:
{"platform":"Mac OS","platformVersion":"10.15"}

NOTE both are still confirming the platform to be macOS, so we should not see the source option for those.

fbergmann commented 1 year ago

Debugging the code, on Firefox I find:

since the source package comes last it replaces (the also wrong old Mac version) and the source packages are offered.

fbergmann commented 1 year ago

On firefox intel + arm versions loose points because of the platformVersion not matching. The source version does not loose points because the platform version for it is set to undefined. I think by default the old Mac version should get a lower version to begin with. then it would be fine to have it offered alongside arm / intel version. Source should only be offered as default in case something else went wrong.

fbergmann commented 1 year ago

I've tried on another Mac (m2, arm), with a newer version of Chrome, and there detection of the OS also fails:

Google Chrom

userAgentData:
undefined

UAParser:
{"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36","browser":{"name":"Chrome","version":"118.0.0.0","major":"118"},"engine":{"name":"Blink","version":"118.0.0.0"},"os":{"name":"Mac OS","version":"10.15.7"},"device":{},"cpu":{}}

OS:
{"platform":"Mac OS","platformVersion":"10.15.7"}
shoops commented 1 year ago

I have fixed the scoring of source code. It will never outscore any installer.

fbergmann commented 1 year ago

@shoops that did fix the issue for chrome, however on Safari I'm still offered the Darwin version (which won't work on the arm / intel processors)

safari

shoops commented 1 year ago

I just pushed a fix for version detection.

fbergmann commented 1 year ago

@shoops now I get on arm only twice the intel one offered

intel twice

on chrome I now get the Darwin one.

shoops commented 1 year ago

I allowed _ in place of . in the version string.

shoops commented 1 year ago

I fixed the reference vs copy problem you are seeing above.

fbergmann commented 1 year ago

It is still not working on Chrome on the arm one (where it just suggests to download the ancient Darwin version). The issue is that when it reports arm, it does so as 'arm' not 'arm64', and it reports a platformVersion of 14.0.0. Here the detection result for the latest version:

userAgentData:
{"brands":[{"brand":"Chromium","version":"118"},{"brand":"Google Chrome","version":"118"},{"brand":"Not=A?Brand","version":"99"}],"mobile":false,"platform":"macOS"}

highEntropyValues:
{"architecture":"arm","bitness":"64","brands":[{"brand":"Chromium","version":"118"},{"brand":"Google Chrome","version":"118"},{"brand":"Not=A?Brand","version":"99"}],"fullVersionList":[{"brand":"Chromium","version":"118.0.5993.117"},{"brand":"Google Chrome","version":"118.0.5993.117"},{"brand":"Not=A?Brand","version":"99.0.0.0"}],"mobile":false,"model":"","platform":"macOS","platformVersion":"14.0.0","uaFullVersion":"118.0.5993.117","wow64":false}

UAParser:
{"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36","browser":{"name":"Chrome","version":"118.0.0.0","major":"118"},"engine":{"name":"Blink","version":"118.0.0.0"},"os":{"name":"Mac OS","version":"10.15.7"},"device":{},"cpu":{}}

OS:
{"platform":"macOS","architecture":"arm","bitness":"64","platformVersion":"14.0.0"}