UI: Implement JavaScript getOS function Windows platform architecture detection #104136

Merged
Márton Lente merged 15 commits from get-os-win-arm into main 2024-11-08 12:03:41 +01:00

This pull request implements x86 and Arm architectures detection for the Windows platform, following Microsoft's recommendations.

As the navigator.userAgentData.getHighEntropyValues built-in browser method is supported by Chromium browsers but not by Gecko browsers (e.g. Firefox), its effect is limited and doesn't resolve architecture detection in all browsers. In browsers that don't support it, Windows is detected and all available downloads are displayed for the platform.

The navigator.userAgentData.getHighEntropyValues is an asynchronous browser method by design and needs to be handled accordingly. The getOS function has been rewritten to handle its promise chain asynchronously. Additionally, the calling method of the getOS function has been updated to an async IIFE, awaiting its response.

The PR has been manually tested on a physical Windows Arm machine running Chromium-based browser. The OS variable returns windows-arm.

As of Blender 4.2.3 LTS, Windows Arm display the blender.org Download page like this, after the PR:

image

This pull request implements x86 and Arm architectures detection for the Windows platform, following [Microsoft's recommendations](https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11#sample-code-for-detecting-arm-or-x86). As the `navigator.userAgentData.getHighEntropyValues` built-in browser method is supported by Chromium browsers but not by Gecko browsers (e.g. Firefox), its effect is limited and doesn't resolve architecture detection in all browsers. In browsers that don't support it, Windows is detected and all available downloads are displayed for the platform. The `navigator.userAgentData.getHighEntropyValues` is an asynchronous browser method by design and needs to be handled accordingly. The `getOS` function has been rewritten to handle its promise chain asynchronously. Additionally, the calling method of the `getOS` function has been updated to an async IIFE, awaiting its response. The PR has been manually tested on a physical Windows Arm machine running Chromium-based browser. The `OS` variable returns `windows-arm`. ✅ As of Blender 4.2.3 LTS, Windows Arm display the blender.org Download page like this, after the PR: ![image](https://projects.blender.org/attachments/18560d0c-3b1e-4b08-ab3a-21db97f8f61e)
Márton Lente added 11 commits 2024-11-06 18:08:18 +01:00
Márton Lente added 1 commit 2024-11-07 11:02:11 +01:00
Márton Lente added 1 commit 2024-11-07 11:48:18 +01:00
Márton Lente requested review from Pablo Vazquez 2024-11-07 11:49:21 +01:00
Márton Lente changed title from WIP: Implement JavaScript getOS function Windows platform architecture detection to UI: Implement JavaScript getOS function Windows platform architecture detection 2024-11-07 15:14:59 +01:00
Márton Lente added 1 commit 2024-11-08 11:19:19 +01:00
Márton Lente added 1 commit 2024-11-08 11:20:53 +01:00
Author
Owner

@pablovazquez the Download button's conditional display logic has also been added. This is how it should look like if the Windows Arm platform is present within platforms, on a Windows Arm machine:

blender-org-get-os-arm-1.png

It has been tested on a physical Windows Arm laptop in Chromium browsers using the private /download-arm test page.

Important:
The Arm download markup was manually added to the temporary page-download-arm.php template. Both the WP test page, and the temporary page-download-arm.php file should be removed after the PR has been merged. (The latter will happen automatically on the next 'live' deployment.) For now, I made the test page private – if you want to test, it should just work.

@pablovazquez the Download button's conditional display logic has also been added. This is how it should look like if the Windows Arm platform is present within platforms, on a Windows Arm machine: ![blender-org-get-os-arm-1.png](/attachments/f68349e1-85bf-42b9-93ba-cff99332fdd5) It has been tested on a physical Windows Arm laptop in Chromium browsers using the private `/download-arm` test page. **Important:** The Arm download markup was manually added to the temporary `page-download-arm.php` template. Both the WP test page, and the temporary `page-download-arm.php` file should be removed after the PR has been merged. (The latter will happen automatically on the next 'live' deployment.) For now, I made the test page private – if you want to test, it should just work.
Pablo Vazquez approved these changes 2024-11-08 11:50:19 +01:00
Pablo Vazquez left a comment
Owner

Alright! Let's get this in production. This is as good as it gets in terms of testing for now until 4.3 comes out, but I think it will just work™ . It's similar to when Apple Silicon was added some time ago. And we will have to go through it again once Linux Arm builds are available.

Thanks!

Alright! Let's get this in production. This is as good as it gets in terms of testing for now until 4.3 comes out, but I _think_ it will just work™ . It's similar to when Apple Silicon was added some time ago. And we will have to go through it again once Linux Arm builds are available. Thanks!
Márton Lente merged commit edb740f42d into main 2024-11-08 12:03:41 +01:00
Author
Owner

Thank you for your approval and feedback. The pull request was merged to main. The temporary test page was cleaned up and removed. The changes will get deployed soon.

Adding other architecture-based conditions later should be straightforward now that the navigator.userAgentData.getHighEntropyValues method's handling is present.

Thank you for your approval and feedback. The pull request was merged to `main`. The temporary test page was cleaned up and removed. The changes will get deployed soon. Adding other architecture-based conditions later should be straightforward now that the `navigator.userAgentData.getHighEntropyValues` method's handling is present.
Sign in to join this conversation.
No description provided.