fix:web端epub图片未代理

pull/1778/head
Xwite 3 years ago
parent cc48698454
commit a7a62d752f
  1. 16
      app/src/main/java/io/legado/app/api/controller/BookController.kt

@ -22,6 +22,7 @@ import io.legado.app.model.localBook.LocalBook
import io.legado.app.model.localBook.UmdFile
import io.legado.app.model.webBook.WebBook
import io.legado.app.utils.*
import io.legado.app.ui.book.read.page.provider.ImageProvider
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import splitties.init.appCtx
@ -79,23 +80,16 @@ object BookController {
?: return returnData.setErrorMsg("bookUrl为空")
val src = parameters["path"]?.firstOrNull()
?: return returnData.setErrorMsg("图片链接为空")
val width = parameters["width"]?.firstOrNull()?.toInt() ?: 640
if (this.bookUrl != bookUrl) {
this.book = appDb.bookDao.getBook(bookUrl)
?: return returnData.setErrorMsg("bookUrl不对")
}
val vFile = BookHelp.getImage(book, src)
if (!vFile.exists()) {
if (this.bookUrl != bookUrl) {
this.bookSource = appDb.bookSourceDao.getBookSource(book.origin)
}
runBlocking {
BookHelp.saveImage(bookSource, book, src)
}
}
this.bookUrl = bookUrl
return returnData.setData(
ImageLoader.loadBitmap(appCtx, vFile.absolutePath).submit().get()
)
return ImageProvider.getImage(book, src, bookSource, width, width)?.let {
returnData.setData(it)
}
}
/**

Loading…
Cancel
Save