Keyoapp: Fix CDN URL (#5711)

* Fix CDN URL

* Fix theme cdn url

* Add Arabic and French translations

* Fix fallback method

* Update WickedScans domain

* Update messages
This commit is contained in:
Chopper 2024-10-28 07:00:21 -03:00 committed by GitHub
parent 12cf12a344
commit 8df6347cea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 32 additions and 30 deletions

View File

@ -0,0 +1,4 @@
pref_show_paid_chapter_title=عرض الفصول المدفوعة
pref_show_paid_chapter_summary_on=سيتم عرض الفصول المدفوعة
pref_show_paid_chapter_summary_off=سيتم عرض الفصول المجانية فقط.
chapter_page_url_not_found=رابط الصفحة غير موجود

View File

@ -1,3 +1,4 @@
pref_show_paid_chapter_title=Display paid chapters
pref_show_paid_chapter_summary_on=Paid chapters will appear.
pref_show_paid_chapter_summary_off=Only free chapters will be displayed.
chapter_page_url_not_found=Page URL not found

View File

@ -0,0 +1,4 @@
pref_show_paid_chapter_title=Afficher les chapitres payants
pref_show_paid_chapter_summary_on=Les chapitres payants apparaitront.
pref_show_paid_chapter_summary_off=Seuls les chapitres gratuits apparaitront.
chapter_page_url_not_found=Page URL non trouvée

View File

@ -2,7 +2,7 @@ plugins {
id("lib-multisrc")
}
baseVersionCode = 8
baseVersionCode = 9
dependencies {
api(project(":lib:i18n"))

View File

@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
@ -55,7 +54,7 @@ abstract class Keyoapp(
protected val intl = Intl(
language = lang,
baseLanguage = "en",
availableLanguages = setOf("en"),
availableLanguages = setOf("ar", "en", "fr"),
classLoader = this::class.java.classLoader!!,
)
@ -259,9 +258,11 @@ abstract class Keyoapp(
// Image list
override fun pageListParse(document: Document): List<Page> {
val cdnUrl = getCdnUrl(document)
document.select("#pages > img")
.map { it.attr("uid") }
.filter { it.isNotEmpty() }
.also { cdnUrl ?: throw Exception(intl["chapter_page_url_not_found"]) }
.mapIndexed { index, img ->
Page(index, document.location(), "$cdnUrl/$img")
}
@ -277,7 +278,16 @@ abstract class Keyoapp(
}
}
protected open val cdnUrl = "https://2xffbs-cn8.is1.buzz/uploads"
protected open fun getCdnUrl(document: Document): String? {
return document.select("script")
.firstOrNull { CDN_HOST_REGEX.containsMatchIn(it.html()) }
?.let {
val cdnHost = CDN_HOST_REGEX.find(it.html())
?.groups?.get("host")?.value
?.replace(CDN_CLEAN_REGEX, "")
"https://$cdnHost/uploads"
}
}
private val oldImgCdnRegex = Regex("""^(https?:)?//cdn\d*\.keyoapp\.com""")
@ -297,12 +307,7 @@ abstract class Keyoapp(
protected open fun Element.getImageUrl(selector: String): String? {
return this.selectFirst(selector)?.let { element ->
element.attr("style")
.substringAfter(":url(", "")
.substringBefore(")", "")
.takeIf { it.isNotEmpty() }
?.toHttpUrlOrNull()?.newBuilder()?.setQueryParameter("w", "480")?.build()
?.toString()
IMG_REGEX.find(element.attr("style"))?.groups?.get("url")?.value
}
}
@ -360,5 +365,8 @@ abstract class Keyoapp(
companion object {
private const val SHOW_PAID_CHAPTERS_PREF = "pref_show_paid_chap"
private const val SHOW_PAID_CHAPTERS_DEFAULT = false
val CDN_HOST_REGEX = """realUrl\s*=\s*`[^`]+//(?<host>[^/]+)""".toRegex()
val CDN_CLEAN_REGEX = """\$\{[^}]*\}""".toRegex()
val IMG_REGEX = """url\(['"]?(?<url>[^(['"\)])]+)""".toRegex()
}
}

View File

@ -9,6 +9,4 @@ class ArvenComics : Keyoapp(
) {
// migrated from Mangathemesia to Keyoapp
override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}

View File

@ -9,6 +9,4 @@ class EZmanga : Keyoapp(
) {
// Migrated from Madara to Keyoapp
override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}

View File

@ -9,6 +9,4 @@ class LuaScans : Keyoapp(
) {
// migrated from MangaThemesia to Keyoapp
override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}

View File

@ -15,12 +15,9 @@ class MagusManga : Keyoapp(
) {
override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
override val client = network.cloudflareClient.newBuilder()
.addInterceptor(::captchaInterceptor)
.rateLimitHost(baseUrl.toHttpUrl(), 1)
.rateLimitHost(cdnUrl.toHttpUrl(), 1)
.build()
private fun captchaInterceptor(chain: Interceptor.Chain): Response {

View File

@ -6,6 +6,4 @@ class NecroScans : Keyoapp(
"Necro Scans",
"https://necroscans.com",
"en",
) {
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}
)

View File

@ -6,6 +6,4 @@ class RezoScans : Keyoapp(
"Rezo Scans",
"https://rezoscans.com",
"en",
) {
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}
)

View File

@ -2,8 +2,8 @@ ext {
extName = 'Wicked Scans'
extClass = '.WickedScans'
themePkg = 'keyoapp'
baseUrl = 'https://rudrascans.com'
overrideVersionCode = 0
baseUrl = 'https://wickedscans.org'
overrideVersionCode = 1
}
apply from: "$rootDir/common.gradle"

View File

@ -2,4 +2,4 @@ package eu.kanade.tachiyomi.extension.en.wickedscans
import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp
class WickedScans : Keyoapp("Wicked Scans", "https://wickedscans.com", "en")
class WickedScans : Keyoapp("Wicked Scans", "https://wickedscans.org", "en")

View File

@ -10,6 +10,4 @@ class ReaperScans : Keyoapp(
// Migrated from Madara to Keyoapp.
override val versionId = 4
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}