Skip to content

Commit

Permalink
feat: 该用browser.js解析访客UA
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokinx authored Dec 11, 2024
1 parent 7693c65 commit 561f42d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ https://github.com/Tokinx/Wing/wiki
| ViewImage | MIT | 图片灯箱插件,用于点击图片放大查看 |
| caomei icon | PRO | 草莓图标库,已购买PRO版授权,仅限设计笔记系列主题使用 |
| prettify | MIT | 用于主题代码高亮 |
| UAParser.js | MIT | 用于访客UA解析 |
| browser.js | MIT | 用于访客UA解析 |

## Star History

Expand Down
10 changes: 5 additions & 5 deletions static/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,14 @@ const $modules = new function () {
const { ip_city, agent } = this.comment;
if ( ip_city ) metas.push({ name: `${$lang.translate("From")}${ip_city}` });
if ( this.info.browser || this.info.os ) {
const { browser, os } = new UAParser(agent).getResult();
const _data = browser.parse(agent);
if ( this.info.os ) metas.push({
name: os.name,
tooltip: [os.name, os.version].join(' '),
name: _data.system,
tooltip: [_data.system, _data.systemVersion].join(' '),
});
if ( this.info.browser ) metas.push({
name: browser.name,
tooltip: [browser.name, browser.version].join(' '),
name: _data.browser,
tooltip: [_data.browser, _data.browserVersion].join(' '),
});
}
return metas;
Expand Down
Loading

0 comments on commit 561f42d

Please sign in to comment.