From 8a728f93c18f768a87a8ffd2b48c2548fd43f377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Fri, 7 Feb 2025 20:47:04 +0800 Subject: [PATCH] =?UTF-8?q?Update:=20=E6=9B=B4=E6=96=B0web=20device?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/main.js | 4 ++-- common/modules/mixly-modules/web/serial.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/main.js b/common/main.js index af756615..a747c87f 100644 --- a/common/main.js +++ b/common/main.js @@ -77,7 +77,7 @@ LazyLoad.js([ goog.platform = () => { const userAgent = navigator.userAgent; - if (userAgent.indexOf('Mobile') !== -1) return 'mobile'; + if (!navigator.serial) return 'mobile'; if (userAgent.indexOf('Windows NT') !== -1) return 'win32'; if (userAgent.indexOf('Mac') !== -1) return 'darwin'; if (userAgent.indexOf('X11') !== -1) return 'linux'; @@ -96,7 +96,7 @@ LazyLoad.js([ else if (userAgent.indexOf('Windows NT 6.1') != -1) os = 'win7'; else if (userAgent.indexOf('Windows NT 6.0') != -1) os = 'winvista'; else if (userAgent.indexOf('Windows NT 5.1') != -1) os = 'winxp'; - } else if (navigator.serial==undefined) { + } else if (!navigator.serial) { os = 'android'; } else if (platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) { os = 'ios'; diff --git a/common/modules/mixly-modules/web/serial.js b/common/modules/mixly-modules/web/serial.js index 06944322..72faac16 100644 --- a/common/modules/mixly-modules/web/serial.js +++ b/common/modules/mixly-modules/web/serial.js @@ -35,7 +35,7 @@ if (platform === 'win32' && fullPlatform !== 'win10') { Device = USBMini; } } -} else if (['android', 'ios'].includes(fullPlatform)) { +} else if (platform === 'mobile') { if (['BBC micro:bit', 'Mithon CC'].includes(BOARD.boardType)) { Device = USB; } else {