mobile增加识别鸿蒙系统 (#2571)

由于鸿蒙系统的User-Agent如下
Mozilla/5.0 (Phone; OpenHarmony5.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 ArkWeb/4.1.6.1 Mobile
导致目前登录显示desktop
This commit is contained in:
xiaobingtech 2024-11-18 22:40:14 +08:00 committed by GitHub
parent fff572869e
commit 02c6ad8004
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -145,12 +145,14 @@ export function getPlatform(userAgent: string): 'mobile' | 'desktop' {
system = 'android'; // android系统
} else if (testUa(/ios|iphone|ipad|ipod|iwatch/g)) {
system = 'ios'; // ios系统
} else if (testUa(/openharmony/g)) {
system = 'openharmony'; // openharmony系统
}
let platform = 'desktop';
if (system === 'windows' || system === 'macos' || system === 'linux') {
platform = 'desktop';
} else if (system === 'android' || system === 'ios' || testUa(/mobile/g)) {
} else if (system === 'android' || system === 'ios' || system === 'openharmony' || testUa(/mobile/g)) {
platform = 'mobile';
}