revert: rollback dependencies causing instablilty durign navigation and plugin fetches

This commit is contained in:
tapframe 2026-06-22 18:51:35 +05:30
parent 8498a5301d
commit 6bd055d174
2 changed files with 7 additions and 14 deletions

View file

@ -28,14 +28,12 @@ import org.jetbrains.compose.resources.getString
import kotlin.random.Random
private const val PLUGIN_TIMEOUT_MS = 60_000L
private const val SLOW_PLUGIN_FETCH_MS = 2_000L
private const val MAX_FETCH_BODY_CHARS = 256 * 1024
private const val MAX_FETCH_HEADER_VALUE_CHARS = 8 * 1024
private const val FETCH_TRUNCATION_SUFFIX = "\n...[truncated]"
internal object PluginRuntime {
private val log = Logger.withTag("PluginRuntime")
private val pluginDispatcher = Dispatchers.Default
private val json = Json {
ignoreUnknownKeys = true
}
@ -50,7 +48,7 @@ internal object PluginRuntime {
episode: Int?,
scraperId: String,
scraperSettings: Map<String, Any> = emptyMap(),
): List<PluginRuntimeResult> = withContext(pluginDispatcher) {
): List<PluginRuntimeResult> = withContext(Dispatchers.Default) {
withTimeout(PLUGIN_TIMEOUT_MS) {
executePluginInternal(
code = code,
@ -79,7 +77,7 @@ internal object PluginRuntime {
var resultJson = "[]"
try {
quickJs(pluginDispatcher) {
quickJs(Dispatchers.Default) {
define("console") {
function("log") { args ->
log.d { "Plugin:$scraperId ${args.joinToString(" ") { it?.toString() ?: "null" }}" }
@ -329,8 +327,7 @@ internal object PluginRuntime {
headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
val startedAt = kotlin.time.TimeSource.Monotonic.markNow()
val response = runBlocking(pluginDispatcher) {
val response = runBlocking {
httpRequestRaw(
method = method,
url = url,
@ -339,10 +336,6 @@ internal object PluginRuntime {
followRedirects = followRedirects,
)
}
val elapsed = startedAt.elapsedNow()
if (elapsed.inWholeMilliseconds >= SLOW_PLUGIN_FETCH_MS) {
log.w { "Slow plugin fetch $method $url status=${response.status} elapsed=$elapsed" }
}
val responseHeaders = response.headers.mapValues { (_, value) ->
truncateString(value, MAX_FETCH_HEADER_VALUE_CHARS)

View file

@ -5,15 +5,15 @@ android-compileSdkMinor = "0"
android-minSdk = "24"
android-targetSdk = "36"
androidx-activity = "1.12.2"
androidx-navigation = "2.10.0-alpha02"
androidx-navigation = "2.9.2"
androidx-appcompat = "1.7.1"
androidx-core = "1.17.0"
androidx-core-splashscreen = "1.0.1"
androidx-espresso = "3.7.0"
androidx-lifecycle = "2.11.0-beta02"
androidx-lifecycle = "2.11.0-beta01"
androidx-work = "2.10.3"
androidx-testExt = "1.3.0"
composeMultiplatform = "1.12.0-alpha02"
composeMultiplatform = "1.11.1"
coil = "3.5.0-beta01"
kermit = "2.0.5"
junit = "4.13.2"
@ -21,7 +21,7 @@ kotlin = "2.3.0"
kotlinx-serialization = "1.8.1"
atomicfu = "0.32.1"
ktor = "3.4.1"
material3 = "1.12.0-alpha02"
material3 = "1.11.0-alpha07"
androidx-media3 = "1.8.0"
supabase = "3.4.1"
quickjsKt = "1.0.5"