Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
189f671e
Commit
189f671e
authored
Jul 05, 2023
by
Zheng Jie
Browse files
移除 yauaa 获取UA信息,采用hutoolUA工具类-UserAgentUtil 获取浏览器信息:
https://github.com/elunez/eladmin-mp/issues/5
parent
39d48093
Changes
2
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java
View file @
189f671e
...
...
@@ -15,11 +15,11 @@
*/
package
me.zhengjie.utils
;
import
cn.hutool.http.useragent.UserAgent
;
import
cn.hutool.http.useragent.UserAgentUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
net.dreamlu.mica.ip2region.core.Ip2regionSearcher
;
import
net.dreamlu.mica.ip2region.core.IpInfo
;
import
nl.basjes.parse.useragent.UserAgent
;
import
nl.basjes.parse.useragent.UserAgentAnalyzer
;
import
javax.servlet.http.HttpServletRequest
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
...
...
@@ -43,14 +43,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*/
private
final
static
Ip2regionSearcher
IP_SEARCHER
=
SpringContextHolder
.
getBean
(
Ip2regionSearcher
.
class
);
private
static
final
UserAgentAnalyzer
USER_AGENT_ANALYZER
=
UserAgentAnalyzer
.
newBuilder
()
.
hideMatcherLoadStats
()
.
withCache
(
10000
)
.
withField
(
UserAgent
.
AGENT_NAME_VERSION
)
.
build
();
/**
* 驼峰命名法工具
*
...
...
@@ -178,8 +170,8 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
}
public
static
String
getBrowser
(
HttpServletRequest
request
)
{
UserAgent
.
ImmutableUserAgent
userAgent
=
USER_AGENT_ANALYZER
.
parse
(
request
.
getHeader
(
"User-Agent"
));
return
u
serAgent
.
get
(
UserAgent
.
AGENT_NAME_VERSION
).
getValue
();
UserAgent
ua
=
UserAgentUtil
.
parse
(
request
.
getHeader
(
"User-Agent"
));
return
u
a
.
getBrowser
().
toString
()
+
" "
+
ua
.
getVersion
();
}
/**
...
...
pom.xml
View file @
189f671e
...
...
@@ -188,13 +188,6 @@
<artifactId>
commons-text
</artifactId>
<version>
1.10.0
</version>
</dependency>
<!-- 解析客户端操作系统、浏览器信息 -->
<dependency>
<groupId>
nl.basjes.parse.useragent
</groupId>
<artifactId>
yauaa
</artifactId>
<version>
6.11
</version>
</dependency>
</dependencies>
<build>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment