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