Skip to content

Commit c06604a

Browse files
committed
update download page to support Windows Arm64
This update recognizes Arm64 installers in "installers.txt" and detects when the client is running on Arm64 using `navigator.userAgentData.getHighEntropyValues` (as supported by Edge and Chrome).
1 parent e6ab68f commit c06604a

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

download/data.rkt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
;; binary platforms
1818
["i386-win32" "Windows (x86, 32-bit)"]
1919
["x86_64-win32" "Windows (x64, 64-bit)"]
20+
["arm64-win32" "Windows (Arm, 64-bit)"]
2021
["(ppc|i386|x86_64|aarch64)-(?:osx-mac|macosx)"
2122
,(λ (_ cpu)
2223
(format "Mac OS (~a)"

download/download-pages.rkt

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -529,16 +529,20 @@ var property = null;
529529
// returns an ordering for the platform names, an array of regexps
530530
// note that the entries are sorted in a good order, so return an order
531531
// that only brings the locally desired entries to the top
532-
function getPlatformOrder() {
532+
function getPlatformOrder(ua) {
533533
var p = navigator.platform;
534534
var p2 = navigator.appVersion;
535535
var p3 = navigator.userAgent;
536536
function l(str) {
537537
return (p.indexOf(str) != -1) || (p2.indexOf(str) != -1) || (p3.indexOf(str) != -1);
538538
}
539+
function is_win_arm64() {
540+
return (ua && ua.platform == 'Windows' && ua.architecture === 'arm' && ua.bitness === '64');
541+
}
539542
var Win = /Windows/,
540-
Win64 = /Windows.*64/,
543+
Win64 = /Windows.*x64/,
541544
Win32 = /Windows.*32/,
545+
WinArm64 = /Windows.*Arm/,
542546
Mac = /Mac/,
543547
MacIntel = /Mac.*Intel/,
544548
MacIntel64 = /Mac.*Intel.*64/,
@@ -551,9 +555,10 @@ var property = null;
551555
Unix = /Unix/,
552556
Solaris = /Solaris/;
553557
if (p == null) return [];
558+
else if (is_win_arm64()) return [WinArm64, Win64, Win];
554559
else if (l("SunOS")) return [Solaris, Unix];
555-
else if (l("Win64")) return [Win64, Win];
556-
else if (l("WOW64")) return [Win64, Win];
560+
else if (l("Win64")) return [Win64, WinArm64, Win];
561+
else if (l("WOW64")) return [Win64, WinArm64, Win];
557562
else if (l("Win")) return [Win32, Win];
558563
else if (l("Mac")) return [
559564
l("Intel") ? MacARM64 : MacPPC,
@@ -566,10 +571,10 @@ var property = null;
566571
else return [];
567572
}
568573

569-
function orderPlatform(platforms) {
574+
function orderPlatform(platforms, ua) {
570575
var len = platforms.length;
571576
// get the order and a make a sorting function
572-
var order = getPlatformOrder();
577+
var order = getPlatformOrder(ua);
573578
function getOrder(str) {
574579
for (var i = 0; i < order.length; i++)
575580
if (str.search(order[i]) >= 0) return i;
@@ -598,9 +603,11 @@ var property = null;
598603
});
599604
}
600605

601-
forEach(allInstallers, function (dist) {
602-
orderPlatform(dist.installers);
603-
});
606+
function orderAllPlatforms(ua) {
607+
forEach(allInstallers, function (dist) {
608+
orderPlatform(dist.installers, ua);
609+
});
610+
}
604611

605612
function getAllPlatforms(allInstallers, currentDist) {
606613
return filter(allInstallers, function (group) {
@@ -718,7 +725,8 @@ var property = null;
718725
return elem('div', {}, children);
719726
}
720727

721-
function init() {
728+
function init(ua) {
729+
orderAllPlatforms(ua)
722730
var currentDist = initialDist;
723731
var allPlatforms = getAllPlatforms(allInstallers, currentDist);
724732
var currentPlatform = allPlatforms[0].platform;
@@ -731,7 +739,11 @@ var property = null;
731739
}, toDraw);
732740
}
733741

734-
init();
742+
if (navigator.userAgentData && navigator.userAgentData.getHighEntropyValues) {
743+
navigator.userAgentData.getHighEntropyValues(["architecture", "bitness"])
744+
.then(ua => { init(ua) })
745+
} else
746+
init(false)
735747

736748
function showWhen(e, b) {
737749
document.getElementById(e).style.display = b ? 'block' : 'none';

0 commit comments

Comments
 (0)