fix:web端epub图片未代理
This commit is contained in:
@@ -22,6 +22,7 @@ import io.legado.app.model.localBook.LocalBook
|
|||||||
import io.legado.app.model.localBook.UmdFile
|
import io.legado.app.model.localBook.UmdFile
|
||||||
import io.legado.app.model.webBook.WebBook
|
import io.legado.app.model.webBook.WebBook
|
||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
|
import io.legado.app.ui.book.read.page.provider.ImageProvider
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
@@ -79,23 +80,16 @@ object BookController {
|
|||||||
?: return returnData.setErrorMsg("bookUrl为空")
|
?: return returnData.setErrorMsg("bookUrl为空")
|
||||||
val src = parameters["path"]?.firstOrNull()
|
val src = parameters["path"]?.firstOrNull()
|
||||||
?: return returnData.setErrorMsg("图片链接为空")
|
?: return returnData.setErrorMsg("图片链接为空")
|
||||||
|
val width = parameters["width"]?.firstOrNull()?.toInt() ?: 640
|
||||||
if (this.bookUrl != bookUrl) {
|
if (this.bookUrl != bookUrl) {
|
||||||
this.book = appDb.bookDao.getBook(bookUrl)
|
this.book = appDb.bookDao.getBook(bookUrl)
|
||||||
?: return returnData.setErrorMsg("bookUrl不对")
|
?: return returnData.setErrorMsg("bookUrl不对")
|
||||||
}
|
this.bookSource = appDb.bookSourceDao.getBookSource(book.origin)
|
||||||
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
|
this.bookUrl = bookUrl
|
||||||
return returnData.setData(
|
return ImageProvider.getImage(book, src, bookSource, width, width)?.let {
|
||||||
ImageLoader.loadBitmap(appCtx, vFile.absolutePath).submit().get()
|
returnData.setData(it)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user