Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fix non-standard user agent not recognized. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mxdabc
Copy link

@mxdabc mxdabc commented Jan 10, 2025

Fix the issue #5
Fix non-standard user agent not recognized.

Fix the issue ennnnny#5
Fix non-standard user agent not recognized.
@mxdabc
Copy link
Author

mxdabc commented Jan 10, 2025

What can be achieved so far:
If the user-agent does not match neither the browser name nor the operating system name, an unknown icon + question mark will be displayed to avoid repeating the display twice.
For example, this:Lavf/57.71.100
If the browser name matches the user-agent but does not match the operating system name, the browser name is displayed, and the operating system displays an unknown icon + question mark.
For example, this:Mozilla/5.0
Match the operating system, not match the browser, the same logic as above.
For example, this:Test/1234; (compatible; Windows NT 6.0)

In PHP 8.0 and above, some user-agents with long parentheses, plus signs, or special symbols will report a warning, and you can choose to disable PHP error messages.

Maybe 99% of the cases were considered!😀


到目前为止可以实现的逻辑操作:
如果 user-agent 与浏览器名称和操作系统名称都不匹配,则会显示未知图标 + 问号,以避免重复显示。
例如,this:Lavf/57.71.100
如果user-agent 匹配浏览器名称,但与操作系统名称不匹配,则显示浏览器名称,并且操作系统显示未知图标 + 问号。
例如,this:Mozilla/5.0
匹配操作系统,不匹配浏览器,逻辑同上。
例如,this:Test/1234 (compatible; Windows NT 6.0)

在 PHP 8.0 及更高版本中,一些带有长括号、加号或特殊符号的用户代理将报告警告,您可以选择禁用 PHP 错误消息。

也算是考虑了99%的情况了吧! 😀

@mxdabc
Copy link
Author

mxdabc commented Jan 11, 2025

Preview

With theme Puresuck
https://github.com/MoXiaoXi233/PureSuck-theme

image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant