This commit is contained in:
Horis
2025-04-19 10:33:50 +08:00
parent c7435cf475
commit 5e209cccf6
3 changed files with 10 additions and 5 deletions
@@ -22,7 +22,6 @@ import okhttp3.internal.notifyAll
import okhttp3.internal.wait import okhttp3.internal.wait
import okio.Buffer import okio.Buffer
import okio.BufferedSink import okio.BufferedSink
import okio.ByteString.Companion.encode
import okio.Pipe import okio.Pipe
import okio.Timeout import okio.Timeout
import okio.buffer import okio.buffer
@@ -211,9 +210,8 @@ class ObsoleteUrlFactory(private var client: OkHttpClient) : URLStreamHandlerFac
override fun getHeaderField(position: Int): String? { override fun getHeaderField(position: Int): String? {
return try { return try {
val headers = headers val headers = headers
if (position < 0 || position >= headers.size) null else headers.value( if (position < 0 || position >= headers.size) null
position else headers.value(position)
).encode().string(Charsets.ISO_8859_1)
} catch (e: IOException) { } catch (e: IOException) {
null null
} }
@@ -1120,7 +1118,9 @@ class ObsoleteUrlFactory(private var client: OkHttpClient) : URLStreamHandlerFac
var j = i + Character.charCount(c) var j = i + Character.charCount(c)
while (j < length) { while (j < length) {
c = s.codePointAt(j) c = s.codePointAt(j)
buffer.writeUtf8CodePoint((if (c > '\u001f'.code && c < '\u007f'.code) c else '?') as Int) buffer.writeUtf8CodePoint(
(if (c > '\u001f'.code && c < '\u007f'.code) c else '?') as Int
)
j += Character.charCount(c) j += Character.charCount(c)
} }
return buffer.readUtf8() return buffer.readUtf8()
@@ -13,6 +13,7 @@ import io.legado.app.utils.isAbsUrl
import io.legado.app.utils.isJsonObject import io.legado.app.utils.isJsonObject
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.mozilla.javascript.Scriptable import org.mozilla.javascript.Scriptable
import org.mozilla.javascript.ScriptableObject
import splitties.init.appCtx import splitties.init.appCtx
import java.io.File import java.io.File
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
@@ -66,6 +67,9 @@ object SharedJsScope {
} else { } else {
RhinoScriptEngine.eval(jsLib, scope, coroutineContext) RhinoScriptEngine.eval(jsLib, scope, coroutineContext)
} }
if (scope is ScriptableObject) {
scope.sealObject()
}
scopeMap[key] = WeakReference(scope) scopeMap[key] = WeakReference(scope)
} }
return scope return scope
@@ -115,6 +115,7 @@ open class MangaVH<VB : ViewBinding>(val binding: VB, private val context: Conte
itemView.updateLayoutParams<ViewGroup.LayoutParams> { itemView.updateLayoutParams<ViewGroup.LayoutParams> {
height = ViewGroup.LayoutParams.MATCH_PARENT height = ViewGroup.LayoutParams.MATCH_PARENT
} }
itemView.minimumHeight = 0
mImage.updateLayoutParams<FrameLayout.LayoutParams> { mImage.updateLayoutParams<FrameLayout.LayoutParams> {
height = ViewGroup.LayoutParams.MATCH_PARENT height = ViewGroup.LayoutParams.MATCH_PARENT
gravity = Gravity.CENTER gravity = Gravity.CENTER