diff --git a/app/src/main/java/com/kunfei/bookshelf/constant/AppConstant.java b/app/src/main/java/com/kunfei/bookshelf/constant/AppConstant.java index 5894c0adfd..fd880746e9 100644 --- a/app/src/main/java/com/kunfei/bookshelf/constant/AppConstant.java +++ b/app/src/main/java/com/kunfei/bookshelf/constant/AppConstant.java @@ -29,6 +29,8 @@ public class AppConstant { public static final String DEFAULT_WEB_DAV_URL = "https://dav.jianguoyun.com/dav/"; + public static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; WOW64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36"; + public static final Pattern JS_PATTERN = Pattern.compile("([\\w\\W]*?|@js:[\\w\\W]*$)", Pattern.CASE_INSENSITIVE); public static final Pattern EXP_PATTERN = Pattern.compile("\\{\\{([\\w\\W]*?)\\}\\}"); diff --git a/app/src/main/java/com/kunfei/bookshelf/model/analyzeRule/AnalyzeHeaders.java b/app/src/main/java/com/kunfei/bookshelf/model/analyzeRule/AnalyzeHeaders.java index 3e961e7ca4..6cd4fada7b 100644 --- a/app/src/main/java/com/kunfei/bookshelf/model/analyzeRule/AnalyzeHeaders.java +++ b/app/src/main/java/com/kunfei/bookshelf/model/analyzeRule/AnalyzeHeaders.java @@ -12,6 +12,7 @@ import java.util.Map; import static android.text.TextUtils.isEmpty; +import static com.kunfei.bookshelf.constant.AppConstant.DEFAULT_USER_AGENT; /** * Created by GKF on 2018/3/2. @@ -38,7 +39,6 @@ public static Map getMap(BookSourceBean bookSourceBean) { } private static String getDefaultUserAgent() { - return preferences.getString(MApplication.getInstance().getString(R.string.pk_user_agent), - MApplication.getInstance().getString(R.string.pv_user_agent)); + return preferences.getString(MApplication.getInstance().getString(R.string.pk_user_agent), DEFAULT_USER_AGENT); } } diff --git a/app/src/main/res/values/pref_key_value.xml b/app/src/main/res/values/pref_key_value.xml index dd706603af..56b831905c 100644 --- a/app/src/main/res/values/pref_key_value.xml +++ b/app/src/main/res/values/pref_key_value.xml @@ -16,8 +16,6 @@ ic_launcher_round book_launcher_round - Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.2357.134 Safari/537.36 - https://gedoor.github.io/MyBookshelf/sourcerule.html https://github.com/gedoor/MyBookshelf https://gedoor.github.io/MyBookshelf/disclaimer.html