File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/tw-html-nodejs-sync/data Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 3
3
import structuredClone from '@ungap/structured-clone' ;
4
4
import * as types from '../types' ;
5
5
import { getLoopInterval } from './constants' ;
6
- import UAParser from 'ua-parser-js' ;
6
+ import { UAParser } from 'ua-parser-js' ;
7
7
8
8
export class ClientInfoStore {
9
9
#clients: Record < string , types . IClientInfo > = { } ;
@@ -35,10 +35,10 @@ export class ClientInfoStore {
35
35
this . #clients[ key ] = { ...this . #clients[ key ] , ...value } ;
36
36
const ua = this . #clients[ key ] [ 'User-Agent' ] ;
37
37
if ( ua ) {
38
- const userAgentInfo = new UAParser ( ua ) ;
39
- const model = userAgentInfo . getDevice ( ) . model ;
40
- const os = userAgentInfo . getOS ( ) . name ; // 获取系统
41
- this . #clients[ key ] . name = model ?? userAgentInfo . getBrowser ( ) . name ?? this . #clients[ key ] . Origin ;
38
+ const userAgentInfo = UAParser ( ua ) ;
39
+ const model = userAgentInfo . device . model ;
40
+ const os = userAgentInfo . os . name ;
41
+ this . #clients[ key ] . name = model ?? userAgentInfo . browser . name ?? this . #clients[ key ] . Origin ;
42
42
this . #clients[ key ] . model = model ;
43
43
this . #clients[ key ] . os = os ;
44
44
} else {
You can’t perform that action at this time.
0 commit comments