QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 WebResourceConfigManager.java 源代码,内容仅作参考
package com.tencent.mtt.external.resourcesniffer.data;
import android.text.TextUtils;
import com.tencent.common.http.NetUtils;
import com.tencent.common.manifest.annotation.CreateMethod;
import com.tencent.common.manifest.annotation.ExtensionImpl;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.utils.QBUrlUtils;
import com.tencent.mtt.base.wup.DomainListDataManager;
import com.tencent.mtt.base.wup.facade.IPreferenceReceiver;
import com.tencent.mtt.browser.webbussiness.facade.IWebRecognizeService;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.PublicSettingManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
@ExtensionImpl(createMethod = CreateMethod.GET, extension = IPreferenceReceiver.class, filters = {"ANDROID_WEB_RESOURCE_SNIFF_JS_URL"})
public class WebResourceConfigManager implements IPreferenceReceiver {
private static volatile WebResourceConfigManager h;
ArrayList<String> f59257a;
public int f59260d = -1;
public boolean g = false;
public LinkedHashMap<String, Boolean> f59258b = new LinkedHashMap<String, Boolean>() {
@Override
protected boolean removeEldestEntry(Map.Entry<String, Boolean> entry) {
return size() > 20;
}
};
public LinkedHashMap<String, Boolean> f59259c = new LinkedHashMap<String, Boolean>() {
@Override
protected boolean removeEldestEntry(Map.Entry<String, Boolean> entry) {
return size() > 20;
}
};
LinkedHashMap<String, Boolean> f = new LinkedHashMap<String, Boolean>() {
@Override
protected boolean removeEldestEntry(Map.Entry<String, Boolean> entry) {
return size() > 100;
}
};
public ArrayList<String> e = new ArrayList<>(Arrays.asList("*.qq.com", "*.qzone.com", "*.baidu.com", "*.sohu.com", "*.sogou.com", "*.sina.com.cn", "*.weibo.com", "*.taobao.com", "*.alipay.com", "*.tmall.com", "*.163.com", "*.10086.cn", "*.alibaba.com", "*.1688.com", "*.jd.com", "*.amazon.cn", "*.douban.com", "*.zhihu.com", "*.36kr.com", "*.taihe.com", "*.app-echo.com", "*.kugou.com", "*.kuwo.cn", "*.1ting.com", "*.9ku.com", "*.9sky.com", "*.yue365.com", "*.xiami.com", "*.so.com", "*.migu.cn", "*.kuke.com", "*.youku.com", "*.tudou.com", "*.iqiyi.com", "*.mgtv.com", "*.cctv.com", "*.cntv.cn", "*.bilibili.com", "*.acfun.cn", "*.56.com", "*.baomihua.com", "*.pearvideo.com", "*.le.com", "*.pps.tv", "*.pptv.com", "*.ifeng.com", "*.ku6.com", "*.gifshow.com", "*.qidian.com", "*.zongheng.com", "*.17k.com", "*.readnovel.com", "*.jjwxc.net", "*.ximalaya.com", "*.qingting.fm", "*.gov.cn", "*.qstheory.cn", "*.81.cn", "*.gmw.cn", "*.people.com.cn", "*.xinhuanet.com"));
private WebResourceConfigManager() {
}
public static WebResourceConfigManager getInstance() {
if (h == null) {
synchronized (WebResourceConfigManager.class) {
if (h == null) {
h = new WebResourceConfigManager();
}
}
}
return h;
}
public String a() {
return PublicSettingManager.a().getString("web_resource_sniff_script_url", "https://res.imtt.qq.com/res_mtt/webresource/release_100_2019_12_10.js");
}
public void a(boolean z) {
this.f59260d = !z ? 1 : 0;
PublicSettingManager.a().setBoolean("web_resource_sniff_hover_btn_enable", z);
}
public boolean a(String str) {
if (!UrlUtils.isWebUrl(str)) {
return false;
}
System.currentTimeMillis();
boolean b2 = b(str);
if (b2 && TextUtils.isEmpty(a())) {
return false;
}
return b2;
}
public boolean a(String str, String str2) {
ArrayList<String> arrayList = this.f59257a;
if (arrayList == null || arrayList.size() <= 0) {
this.f59257a = DomainListDataManager.a().a(339);
}
ArrayList<String> arrayList2 = this.f59257a;
if (arrayList2 == null || arrayList2.size() <= 0) {
arrayList2 = this.e;
}
for (int i = 0; i < arrayList2.size(); i++) {
String str3 = arrayList2.get(i);
if (!TextUtils.isEmpty(str3)) {
if (str3.startsWith("*.")) {
String substring = str3.substring(1);
if (str2 != null && substring != null && str2.endsWith(substring.toLowerCase())) {
return false;
}
} else if (str2 != null && (str2.equalsIgnoreCase(str3) || str.equalsIgnoreCase(str3))) {
return false;
}
}
}
return true;
}
public boolean b() {
if (this.f59260d == -1) {
this.f59260d = !PublicSettingManager.a().getBoolean("web_resource_sniff_hover_btn_enable", true) ? 1 : 0;
}
if (!this.g) {
StatManager.b().b("CGQWN24", this.f59260d, false, StatManager.SamplingRate.PERCENT_5);
this.g = true;
}
return this.f59260d == 0;
}
public boolean b(String str) {
String host = UrlUtils.getHost(str);
if (TextUtils.isEmpty(host) || QBUrlUtils.w(str)) {
return false;
}
synchronized (this.f59258b) {
Boolean bool = this.f59258b.get(host);
if (bool != null) {
return bool.booleanValue();
}
boolean a2 = a(str, host);
synchronized (this.f59258b) {
this.f59258b.put(host, Boolean.valueOf(a2));
}
return a2;
}
}
public boolean b(String str, String str2) {
return ((IWebRecognizeService) QBContext.getInstance().getService(IWebRecognizeService.class)).checkWebRecConfigSync(395, str2, false, IWebRecognizeService.CALL_FROM_OTHER);
}
public int c() {
return 1;
}
public boolean c(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
Boolean bool = this.f.get(str);
return bool != null ? bool.booleanValue() : d(str);
}
public boolean d(String str) {
String host = UrlUtils.getHost(str);
if (TextUtils.isEmpty(host)) {
return false;
}
Boolean bool = this.f59259c.get(host);
if (bool != null) {
return bool.booleanValue();
}
boolean b2 = b(str, host);
this.f59259c.put(host, Boolean.valueOf(b2));
return b2;
}
public void e(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
this.f.put(str, true);
}
@Override
public void onPreference(String str, String str2) {
if (StringUtils.a(str, "ANDROID_WEB_RESOURCE_SNIFF_JS_URL")) {
if (TextUtils.isEmpty(str2)) {
if (str2 == null) {
PublicSettingManager.a().remove("web_resource_sniff_script_url");
}
} else {
if (UrlUtils.isHttpUrl(str2)) {
str2 = str2.replace(NetUtils.SCHEME_HTTP, NetUtils.SCHEME_HTTPS);
} else if (!UrlUtils.isHttpsUrl(str2)) {
str2 = "";
}
PublicSettingManager.a().setString("web_resource_sniff_script_url", str2);
}
}
}
}