Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt
pull/2382/head
kunfei 2 years ago
commit c4d474f3d9
  1. 7
      app/src/main/java/io/legado/app/model/localBook/LocalBook.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt

@ -18,6 +18,7 @@ import io.legado.app.help.AppWebDav
import io.legado.app.help.book.BookHelp
import io.legado.app.help.book.isEpub
import io.legado.app.help.book.isUmd
import io.legado.app.help.book.getRemoteUrl
import io.legado.app.help.config.AppConfig
import io.legado.app.lib.webdav.WebDav
import io.legado.app.model.analyzeRule.AnalyzeUrl
@ -307,10 +308,8 @@ object LocalBook {
//下载book.remoteUrl对应的远程文件并更新bookUrl 返回inputStream
private fun downloadRemoteBook(localBook: Book): InputStream? {
//webDav::${http}
if (!localBook.origin.startsWith(BookType.webDavTag)) return null
val webDavUrl = localBook.origin.substring(8)
if (webDavUrl.isBlank()) return null
val webDavUrl = localBook.getRemoteUrl()
if (webDavUrl.isNullOrBlank()) return null
try {
val uri = AppWebDav.authorization?.let {
val webdav = WebDav(webDavUrl, it)

@ -122,7 +122,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
book.origin = BookType.localTag
} else if (remoteBook.lastModify > book.lastCheckTime) {
val uri = RemoteBookWebDav.downloadRemoteBook(remoteBook)
book.origin = if (uri.isContentScheme()) uri.toString() else uri.path!!
book.bookUrl = if (uri.isContentScheme()) uri.toString() else uri.path!!
book.lastCheckTime = remoteBook.lastModify
}
}

Loading…
Cancel
Save