File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -106,17 +106,20 @@ const DOWNLOAD_LINKS = await getDownloadLinks();
106106</download-gephi-desktop>
107107<script >
108108 import { UAParser } from 'ua-parser-js';
109+ import { isAppleSilicon } from 'ua-parser-js/device-detection';
109110 class DownloadGephiDesktop extends HTMLElement {
110- connectedCallback() {
111+ async connectedCallback() {
111112 // Read the message from the data attribute.
112113 const BROWSERS = JSON.parse(this.dataset.browsers||'{}');
113114 const DOWNLOAD_LINKS = JSON.parse(this.dataset.links||'{}');
114- const { os, cpu } = UAParser(navigator.userAgent);
115+ const detection = await UAParser(navigator.userAgent).withClientHints( );
115116
116117 let currentBrowser = "windows64";
117- switch(os.name){
118- case "Windows": currentBrowser = cpu.architecture?.includes("32") ? "windows32": "windows64" ; break;
119- case "macOS": currentBrowser = cpu.architecture?.includes("arm") ? "macSilicon" : "macIntel"; break;
118+ switch(detection.os.name){
119+ case "Windows": currentBrowser = detection.cpu.architecture?.includes("32") ? "windows32": "windows64" ; break;
120+ case "macOS":
121+ currentBrowser = detection.cpu.architecture?.includes("arm") ||
122+ isAppleSilicon(detection) ? "macSilicon" : "macIntel"; break;
120123 // default to linux for all variety of linux OS + all variety of mobile...
121124 // TODO: for mobile/tablet/console (detected in the device) we could advertize gephi-lite
122125 default: currentBrowser = "linux";
You can’t perform that action at this time.
0 commit comments