diff --git a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt index 0226c8b00..baeedd16e 100644 --- a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt +++ b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt @@ -70,10 +70,13 @@ open class WebDav(val path: String, val authorization: Authorization) { } private val webDavClient by lazy { val authInterceptor = Interceptor { chain -> - val request = chain.request() - .newBuilder() - .header(authorization.name, authorization.data) - .build() + var request = chain.request() + if (request.url.host == host) { + request = request + .newBuilder() + .header(authorization.name, authorization.data) + .build() + } chain.proceed(request) } okHttpClient.newBuilder().run { diff --git a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt index 2f7b9296b..eb60584c0 100644 --- a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt @@ -151,7 +151,7 @@ class RemoteBookActivity : VMBaseActivity Unit) { + fun loadRemoteBookList(path: String?, loadCallback: (loading: Boolean) -> Unit) { execute { dataCallback?.clear() + val path = path ?: RemoteBookWebDav.rootBookUrl val bookList = RemoteBookWebDav.getRemoteBookList(path) dataCallback?.setItems(bookList) }.onError { diff --git a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt index b02431dbe..0d3183813 100644 --- a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt @@ -286,7 +286,7 @@ class BackupConfigFragment : PreferenceFragment(), } fun restore() { - Coroutine.async(context = Main) { + Coroutine.async { AppWebDav.showRestoreDialog(requireContext()) }.onError { alert {