Skip to content

Commit

Permalink
fix: windows x86 vs x64 cannot be detected
Browse files Browse the repository at this point in the history
Signed-off-by: Steven <steven@ceriously.com>
  • Loading branch information
styfle authored Jan 19, 2023
1 parent f046da5 commit 65b2317
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@
var userAgent = navigator.userAgent;
var osMatch = userAgent.match(/(Win|Mac|Linux)/);
var os = (osMatch && osMatch[1]) || '';
var arch =
userAgent.match(/x86_64|Win64|WOW64/) || navigator.cpuClass === 'x64'
? 'x64'
: 'x86';
var buttons = document.querySelectorAll('.home-downloadbutton');
var downloadHead = document.querySelector('#home-downloadhead');
var dlLocal;
Expand All @@ -141,21 +137,13 @@
downloadHead.textContent = dlLocal + ' macOS';
break;
case 'Win':
versionIntoHref(buttons, 'node-%version%-' + arch + '.msi');
downloadHead.textContent = dlLocal + ' Windows (' + arch + ')';
versionIntoHref(buttons, 'node-%version%-x64.msi');
downloadHead.textContent = dlLocal + ' Windows (x64)';
break;
case 'Linux':
versionIntoHref(buttons, 'node-%version%-linux-x64.tar.xz');
downloadHead.textContent = dlLocal + ' Linux (x64)';
break;
}
}

// Windows button on download page
var winButton = document.querySelector('#windows-downloadbutton');
if (winButton && os === 'Win') {
var winText = winButton.querySelector('p');
winButton.href = winButton.href.replace(/x(86|64)/, arch);
winText.textContent = winText.textContent.replace(/x(86|64)/, arch);
}
})();

0 comments on commit 65b2317

Please sign in to comment.