mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-04 21:08:30 +08:00
全局http 请求 header user-agent 配置为jpom
This commit is contained in:
parent
adc6462a8f
commit
96520b6367
@ -10,6 +10,8 @@ import cn.hutool.core.lang.JarClassLoader;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ClassUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.GlobalHeaders;
|
||||
import cn.hutool.http.Header;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.jiangzeyin.common.DefaultSystemLog;
|
||||
import cn.jiangzeyin.common.JsonMessage;
|
||||
@ -66,10 +68,10 @@ public class JpomManifest {
|
||||
*/
|
||||
private String dataPath;
|
||||
|
||||
private static synchronized void init() {
|
||||
if (JPOM_MANIFEST != null) {
|
||||
return;
|
||||
}
|
||||
private static void init() {
|
||||
if (JPOM_MANIFEST == null) {
|
||||
synchronized (JpomManifest.class) {
|
||||
if (JPOM_MANIFEST == null) {
|
||||
JPOM_MANIFEST = new JpomManifest();
|
||||
File jarFile = getRunPath();
|
||||
if (jarFile.isFile()) {
|
||||
@ -87,6 +89,10 @@ public class JpomManifest {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
GlobalHeaders.INSTANCE.header(Header.USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 Jpom " + JPOM_MANIFEST.getType(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private JpomManifest() {
|
||||
|
Loading…
Reference in New Issue
Block a user