diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 4def37e81..9ec9fbaf3 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -15,6 +15,7 @@ import androidx.core.view.size import com.jaredrummler.android.colorpicker.ColorPickerDialogListener import io.legado.app.BuildConfig import io.legado.app.R +import io.legado.app.constant.AppConst import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.constant.Status @@ -726,6 +727,7 @@ class ReadBookActivity : ReadBookBaseActivity(), startActivity { putExtra("sourceUrl", it.bookSourceUrl) putExtra("loginUrl", it.loginUrl) + putExtra("userAgent", it.getHeaderMap()[AppConst.UA_NAME]) } } } diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index b8d5ca594..b51e6f899 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -113,6 +113,7 @@ class BookSourceEditActivity : startActivity { putExtra("sourceUrl", it.bookSourceUrl) putExtra("loginUrl", it.loginUrl) + putExtra("userAgent", it.getHeaderMap()[AppConst.UA_NAME]) } } } diff --git a/app/src/main/java/io/legado/app/ui/login/SourceLogin.kt b/app/src/main/java/io/legado/app/ui/login/SourceLogin.kt index d357e9c53..028b85b98 100644 --- a/app/src/main/java/io/legado/app/ui/login/SourceLogin.kt +++ b/app/src/main/java/io/legado/app/ui/login/SourceLogin.kt @@ -19,6 +19,7 @@ class SourceLogin : BaseActivity() { var sourceUrl: String? = null var loginUrl: String? = null + var userAgent: String? = null var checking = false override fun getViewBinding(): ActivitySourceLoginBinding { @@ -28,6 +29,7 @@ class SourceLogin : BaseActivity() { override fun onActivityCreated(savedInstanceState: Bundle?) { sourceUrl = intent.getStringExtra("sourceUrl") loginUrl = intent.getStringExtra("loginUrl") + userAgent = intent.getStringExtra("userAgent") title = getString(R.string.login_source, sourceUrl) initWebView() } @@ -38,6 +40,9 @@ class SourceLogin : BaseActivity() { settings.setSupportZoom(true) settings.builtInZoomControls = true settings.javaScriptEnabled = true + userAgent?.let { + settings.userAgentString = it + } val cookieManager = CookieManager.getInstance() binding.webView.webViewClient = object : WebViewClient() { override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {