Horis пре 1 година
родитељ
комит
1fadda9a23

+ 4 - 2
app/src/main/java/io/legado/app/help/glide/OkHttpStreamFetcher.kt

@@ -46,7 +46,7 @@ class OkHttpStreamFetcher(
     private var call: Call? = null
 
     companion object {
-        val failUrl = hashSetOf<String>()
+        private val failUrl = hashSetOf<String>()
     }
 
     override fun loadData(priority: Priority, callback: DataFetcher.DataCallback<in InputStream>) {
@@ -114,7 +114,9 @@ class OkHttpStreamFetcher(
         responseBody = response.body
         if (response.isSuccessful) {
             val decodeResult = runScriptWithContext(coroutineContext) {
-                if (manga) {
+                if (ImageUtils.skipDecode(source, !manga)) {
+                    responseBody!!.byteStream()
+                } else if (manga) {
                     ImageUtils.decode(
                         oldUrl.toString(),
                         responseBody!!.bytes(),

+ 8 - 3
app/src/main/java/io/legado/app/utils/ImageUtils.kt

@@ -1,12 +1,12 @@
 package io.legado.app.utils
 
 import io.legado.app.constant.AppLog
-import io.legado.app.data.entities.Book
 import io.legado.app.data.entities.BaseSource
+import io.legado.app.data.entities.Book
 import io.legado.app.data.entities.BookSource
 import io.legado.app.data.entities.RssSource
-import java.io.InputStream
 import java.io.ByteArrayInputStream
+import java.io.InputStream
 
 /**
  * 加密图片解密工具
@@ -54,13 +54,18 @@ object ImageUtils {
         }.getOrNull()
     }
 
+    fun skipDecode(source: BaseSource?, isCover: Boolean): Boolean {
+        return getRuleJs(source, isCover).isNullOrBlank()
+    }
 
     private fun getRuleJs(
         source: BaseSource?, isCover: Boolean
     ): String? {
         return when (source) {
             is BookSource ->
-                if (isCover) source.coverDecodeJs else source.getContentRule().imageDecode
+                if (isCover) source.coverDecodeJs
+                else source.getContentRule().imageDecode
+
             is RssSource -> source.coverDecodeJs
             else -> null
         }