阅读默认UA只设置主要版本号 (#2543)

pull/2545/head
Xwite 2 years ago committed by GitHub
parent 8906fc8439
commit fe754feebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/scripts/cronet.sh
  2. 1
      app/build.gradle
  3. 2
      app/src/main/java/io/legado/app/help/config/AppConfig.kt
  4. 3
      gradle.properties

@ -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

@ -47,6 +47,7 @@ android {
multiDexEnabled true
buildConfigField "String", "Cronet_Version", "\"$CronetVersion\""
buildConfigField "String", "Cronet_Main_Version", "\"$CronetMainVersion\""
javaCompileOptions {
annotationProcessorOptions {

@ -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
}

@ -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
CronetMainVersion=107.0.0.0
android.injected.testOnly=false

Loading…
Cancel
Save