SirenKomik: Fix loading pages (#8893)
All checks were successful
CI / Prepare job (push) Successful in 5s
CI / Build individual modules (push) Successful in 5m40s
CI / Publish repo (push) Successful in 47s

Fix loading pages
This commit is contained in:
Chopper 2025-05-18 02:36:50 -03:00 committed by Draff
parent 87f31ed04b
commit c66abf25b9
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 21 additions and 9 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.SirenKomik'
themePkg = 'mangathemesia'
baseUrl = 'https://sirenkomik.my.id'
overrideVersionCode = 6
overrideVersionCode = 7
}
apply from: "$rootDir/common.gradle"

View File

@ -1,11 +1,11 @@
package eu.kanade.tachiyomi.extension.id.mangkomik
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import kotlinx.serialization.json.decodeFromStream
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.FormBody
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.io.IOException
@ -42,11 +42,19 @@ class SirenKomik : MangaThemesia(
?.let { postIdRegex.find(it)?.groups?.get(1)?.value }
?: throw IOException("Post ID not found")
val pageUrl = "$baseUrl/wp-json/extras/v1/get-img-json".toHttpUrl().newBuilder()
.addQueryParameter("post_id", postId)
val payload = FormBody.Builder()
.add("action", "get_image_json")
.add("post_id", postId)
.build()
val dto = client.newCall(GET(pageUrl, headers)).execute().use {
val response = client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, payload))
.execute()
if (response.isSuccessful.not()) {
throw IOException("Pages not found")
}
val dto = response.use {
json.decodeFromStream<SirenKomikDto>(it.body.byteStream())
}

View File

@ -4,15 +4,19 @@ import kotlinx.serialization.Serializable
@Serializable
data class SirenKomikDto(
val `data`: Data,
val `data`: DataWrapper,
) {
val pages get() = data.sources.firstOrNull()?.images ?: emptyList()
val pages get() = data.data.sources.firstOrNull()?.images ?: emptyList()
}
@Serializable
class Source(
val images: List<String>,
val source: String,
)
@Serializable
class DataWrapper(
val `data`: Data,
)
@Serializable