Skip to content

Commit ed8701e

Browse files
authored
Merge pull request git-for-windows#61 from rbqvq/drop-32-bit-and-add-arm64
Drop 32-bit and add ARM64 architecture check
2 parents 3a716f8 + 607efe1 commit ed8701e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

layouts/_default/baseof.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@
3838
{{ if eq "home" .Kind -}}
3939
/* Replace the download link if a Windows browser was detected */
4040
try {
41-
var agent = window.navigator.userAgent;
4241
var href = $('.version > a')[0].href.match(/^(.*\/)tag(\/.*)$/);
4342
var version = $('.version > a')[0].title.match(/^Version ([0-9.]*)(\(([0-9]*)?\))?/);
44-
if (!agent.match(/Windows/) || !href || !version)
43+
if (!href || !version || !navigator.userAgentData)
4544
throw 0;
46-
var bitness = agent.match(/(WOW|Win)64/) ? '64' : '32';
47-
if (version[2])
48-
version[1] += '.' + version[3];
49-
var url = href[1] + 'download' + href[2] + '/Git-' + version[1] + '-' + bitness + '-bit.exe';
50-
$('a.button:contains("Download")')[0].href = url;
45+
46+
navigator.userAgentData.getHighEntropyValues(["architecture", "platform", "bitness"])
47+
.then(function(browser) {
48+
if (browser.platform != "Windows" || browser.bitness != "64") return;
49+
50+
var architecture = browser.architecture == "arm" ? "arm64" : "64-bit";
51+
var url = href[1] + 'download' + href[2] + '/Git-' + version[1] + '-' + architecture + '.exe';
52+
$('a.button:contains("Download")')[0].href = url;
53+
})
5154
} catch(e) {}
5255
{{ end -}}
5356
});

0 commit comments

Comments
 (0)