From fe754feebf7b1357720f25710a3b29c2e0ae0d3d Mon Sep 17 00:00:00 2001 From: Xwite <82232510+Xwite@users.noreply.github.com> Date: Wed, 9 Nov 2022 23:23:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E8=AF=BB=E9=BB=98=E8=AE=A4UA=E5=8F=AA?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BB=E8=A6=81=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=20(#2543)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/cronet.sh | 2 ++ app/build.gradle | 1 + app/src/main/java/io/legado/app/help/config/AppConfig.kt | 2 +- gradle.properties | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/scripts/cronet.sh b/.github/scripts/cronet.sh index 18de9c482..cdf6a3a16 100644 --- a/.github/scripts/cronet.sh +++ b/.github/scripts/cronet.sh @@ -7,6 +7,7 @@ branch="Stable" lastest_cronet_version=`curl -s "https://chromiumdash.appspot.com/fetch_releases?channel=$branch&platform=Android&num=1&offset=0" | jq .[0].version -r` echo "lastest_cronet_version: $lastest_cronet_version" #lastest_cronet_version=100.0.4845.0 +lastest_cronet_main_version=${lastest_cronet_version%%\.*}.0.0.0 function checkVersionExit() { local jar_url="https://storage.googleapis.com/chromium-cronet/android/$lastest_cronet_version/Release/cronet/cronet_api.jar" @@ -26,6 +27,7 @@ if [[ $current_cronet_version == $lastest_cronet_version ]];then else checkVersionExit sed -i s/CronetVersion=.*/CronetVersion=$lastest_cronet_version/ $path + sed -i s/CronetMainVersion=.*/CronetMainVersion=$lastest_cronet_main_version/ $path sed "15a* 更新cronet: $lastest_cronet_version" -i $GITHUB_WORKSPACE/app/src/main/assets/updateLog.md echo "start download latest cronet" chmod +x gradlew diff --git a/app/build.gradle b/app/build.gradle index d4a8d3287..14394d5d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,6 +47,7 @@ android { multiDexEnabled true buildConfigField "String", "Cronet_Version", "\"$CronetVersion\"" + buildConfigField "String", "Cronet_Main_Version", "\"$CronetMainVersion\"" javaCompileOptions { annotationProcessorOptions { diff --git a/app/src/main/java/io/legado/app/help/config/AppConfig.kt b/app/src/main/java/io/legado/app/help/config/AppConfig.kt index d0611bc30..91eac15ef 100644 --- a/app/src/main/java/io/legado/app/help/config/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/config/AppConfig.kt @@ -389,7 +389,7 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { private fun getPrefUserAgent(): String { val ua = appCtx.getPrefString(PreferKey.userAgent) if (ua.isNullOrBlank()) { - return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" + BuildConfig.Cronet_Version + " Safari/537.36" + return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" + BuildConfig.Cronet_Main_Version + " Safari/537.36" } return ua } diff --git a/gradle.properties b/gradle.properties index 3e3eb547c..317175195 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,4 +36,5 @@ android.defaults.buildfeatures.shaders=false android.nonTransitiveRClass=true #https://chromiumdash.appspot.com/releases?platform=Android CronetVersion=107.0.5304.105 -android.injected.testOnly=false \ No newline at end of file +CronetMainVersion=107.0.0.0 +android.injected.testOnly=false