From 713bfccec567ce4fff4ee0d637d77cb7a4a6a0ba Mon Sep 17 00:00:00 2001 From: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> Date: Thu, 12 Oct 2023 17:19:07 -0300 Subject: [PATCH] Add some missing headers in MangaThemesia (#18515) Add some missing headers in MangaThemesia. --- .../overrides/mangathemesia/diskusscan/src/DiskusScan.kt | 5 +++++ .../tachiyomi/multisrc/mangathemesia/MangaThemesia.kt | 8 +++++++- .../multisrc/mangathemesia/MangaThemesiaGenerator.kt | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt b/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt index bb45ae628..e5798ff4f 100644 --- a/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt +++ b/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.pt.diskusscan import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.network.interceptor.rateLimit +import okhttp3.Headers import okhttp3.OkHttpClient import java.text.SimpleDateFormat import java.util.Locale @@ -20,4 +21,8 @@ class DiskusScan : MangaThemesia( override val client: OkHttpClient = super.client.newBuilder() .rateLimit(1, 2, TimeUnit.SECONDS) .build() + + override fun headersBuilder(): Headers.Builder = super.headersBuilder() + .set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8") + .set("Accept-Language", "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3") } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt index f2ede3dc4..d948d4790 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt @@ -22,6 +22,7 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonPrimitive import okhttp3.FormBody +import okhttp3.Headers import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrlOrNull @@ -68,6 +69,9 @@ abstract class MangaThemesia( .build() } + override fun headersBuilder(): Headers.Builder = Headers.Builder() + .set("Referer", "$baseUrl/") + open val projectPageString = "/project" // Popular (Search with popular order and nothing else) @@ -141,7 +145,7 @@ abstract class MangaThemesia( } } url.addPathSegment("") - return GET(url.toString()) + return GET(url.build(), headers) } override fun searchMangaParse(response: Response): MangasPage { @@ -215,6 +219,7 @@ abstract class MangaThemesia( listOf("ongoing", "publishing").any { this.contains(it, ignoreCase = true) } -> SManga.ONGOING this.contains("hiatus", ignoreCase = true) -> SManga.ON_HIATUS this.contains("completed", ignoreCase = true) -> SManga.COMPLETED + listOf("dropped", "cancelled").any { this.contains(it, ignoreCase = true) } -> SManga.CANCELLED else -> SManga.UNKNOWN } @@ -289,6 +294,7 @@ abstract class MangaThemesia( override fun imageRequest(page: Page): Request { val newHeaders = headersBuilder() + .set("Accept", "image/avif,image/webp,image/png,image/jpeg,*/*") .set("Referer", page.url) .build() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt index 6ddeae842..9b2db6181 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt @@ -11,7 +11,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator { override val themeClass = "MangaThemesia" - override val baseVersionCode: Int = 26 + override val baseVersionCode: Int = 27 override val sources = listOf( MultiLang("Asura Scans", "https://asuratoon.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 30),