Skip to content

Commit 38ce4c7

Browse files
committed
Update clientInfoStoreClass.ts
1 parent d0dd223 commit 38ce4c7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tw-html-nodejs-sync/data/clientInfoStoreClass.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import structuredClone from '@ungap/structured-clone';
44
import * as types from '../types';
55
import { getLoopInterval } from './constants';
6-
import UAParser from 'ua-parser-js';
6+
import { UAParser } from 'ua-parser-js';
77

88
export class ClientInfoStore {
99
#clients: Record<string, types.IClientInfo> = {};
@@ -35,10 +35,10 @@ export class ClientInfoStore {
3535
this.#clients[key] = { ...this.#clients[key], ...value };
3636
const ua = this.#clients[key]['User-Agent'];
3737
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;
4242
this.#clients[key].model = model;
4343
this.#clients[key].os = os;
4444
} else {

0 commit comments

Comments
 (0)