From dc25a04fe060b44d80d75672255318a30a2bd2ce Mon Sep 17 00:00:00 2001 From: Vetle Ledaal Date: Thu, 10 Feb 2022 10:40:20 +0000 Subject: [PATCH] MangaHub: Tweak rate limiting, fix decimal chapters (#10780) * Fix chapters with decimals * Tweak rate limiting to only apply on chapter images This also fixes slow thumbnails * up version --- multisrc/overrides/mangahub/mangafoxfun/src/MangaFoxFun.kt | 4 ++-- multisrc/overrides/mangahub/mangahereonl/src/MangaHereOnl.kt | 4 ++-- multisrc/overrides/mangahub/mangahubio/src/MangaHubIo.kt | 4 ++-- .../overrides/mangahub/mangakakalotfun/src/MangakakalotFun.kt | 4 ++-- multisrc/overrides/mangahub/manganel/src/MangaNel.kt | 4 ++-- .../overrides/mangahub/mangaonlinefun/src/MangaOnlineFun.kt | 4 ++-- .../overrides/mangahub/mangapandaonl/src/MangaPandaOnl.kt | 4 ++-- .../overrides/mangahub/mangareadersite/src/MangaReaderSite.kt | 4 ++-- multisrc/overrides/mangahub/mangatoday/src/MangaToday.kt | 4 ++-- multisrc/overrides/mangahub/mangatownhub/src/MangaTownHub.kt | 4 ++-- multisrc/overrides/mangahub/onemangaco/src/OneMangaCo.kt | 4 ++-- multisrc/overrides/mangahub/onemangainfo/src/OneMangaInfo.kt | 4 ++-- .../java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt | 4 +++- .../kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt | 2 +- 14 files changed, 28 insertions(+), 26 deletions(-) diff --git a/multisrc/overrides/mangahub/mangafoxfun/src/MangaFoxFun.kt b/multisrc/overrides/mangahub/mangafoxfun/src/MangaFoxFun.kt index 40fb1f1eb..50bd8eb7d 100644 --- a/multisrc/overrides/mangahub/mangafoxfun/src/MangaFoxFun.kt +++ b/multisrc/overrides/mangahub/mangafoxfun/src/MangaFoxFun.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangafoxfun -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaFoxFun : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mf01" diff --git a/multisrc/overrides/mangahub/mangahereonl/src/MangaHereOnl.kt b/multisrc/overrides/mangahub/mangahereonl/src/MangaHereOnl.kt index 141050aa0..6e8a68044 100644 --- a/multisrc/overrides/mangahub/mangahereonl/src/MangaHereOnl.kt +++ b/multisrc/overrides/mangahub/mangahereonl/src/MangaHereOnl.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangahereonl -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaHereOnl : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mh01" diff --git a/multisrc/overrides/mangahub/mangahubio/src/MangaHubIo.kt b/multisrc/overrides/mangahub/mangahubio/src/MangaHubIo.kt index 4711c62b9..88a569e38 100644 --- a/multisrc/overrides/mangahub/mangahubio/src/MangaHubIo.kt +++ b/multisrc/overrides/mangahub/mangahubio/src/MangaHubIo.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangahubio -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaHubIo : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "m01" diff --git a/multisrc/overrides/mangahub/mangakakalotfun/src/MangakakalotFun.kt b/multisrc/overrides/mangahub/mangakakalotfun/src/MangakakalotFun.kt index f08ef4c39..2d3b43acb 100644 --- a/multisrc/overrides/mangahub/mangakakalotfun/src/MangakakalotFun.kt +++ b/multisrc/overrides/mangahub/mangakakalotfun/src/MangakakalotFun.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangakakalotfun -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangakakalotFun : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mn01" diff --git a/multisrc/overrides/mangahub/manganel/src/MangaNel.kt b/multisrc/overrides/mangahub/manganel/src/MangaNel.kt index e8d22c66a..e9a0ca17d 100644 --- a/multisrc/overrides/mangahub/manganel/src/MangaNel.kt +++ b/multisrc/overrides/mangahub/manganel/src/MangaNel.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.manganel -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaNel : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mn05" diff --git a/multisrc/overrides/mangahub/mangaonlinefun/src/MangaOnlineFun.kt b/multisrc/overrides/mangahub/mangaonlinefun/src/MangaOnlineFun.kt index 7cdf16127..98599439c 100644 --- a/multisrc/overrides/mangahub/mangaonlinefun/src/MangaOnlineFun.kt +++ b/multisrc/overrides/mangahub/mangaonlinefun/src/MangaOnlineFun.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangaonlinefun -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaOnlineFun : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "m02" diff --git a/multisrc/overrides/mangahub/mangapandaonl/src/MangaPandaOnl.kt b/multisrc/overrides/mangahub/mangapandaonl/src/MangaPandaOnl.kt index 6f799aa33..04877bd43 100644 --- a/multisrc/overrides/mangahub/mangapandaonl/src/MangaPandaOnl.kt +++ b/multisrc/overrides/mangahub/mangapandaonl/src/MangaPandaOnl.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangapandaonl -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaPandaOnl : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mr02" diff --git a/multisrc/overrides/mangahub/mangareadersite/src/MangaReaderSite.kt b/multisrc/overrides/mangahub/mangareadersite/src/MangaReaderSite.kt index a1acd4ccb..9e887e8af 100644 --- a/multisrc/overrides/mangahub/mangareadersite/src/MangaReaderSite.kt +++ b/multisrc/overrides/mangahub/mangareadersite/src/MangaReaderSite.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangareadersite -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaReaderSite : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mr01" diff --git a/multisrc/overrides/mangahub/mangatoday/src/MangaToday.kt b/multisrc/overrides/mangahub/mangatoday/src/MangaToday.kt index 9e186830e..2b2e61eca 100644 --- a/multisrc/overrides/mangahub/mangatoday/src/MangaToday.kt +++ b/multisrc/overrides/mangahub/mangatoday/src/MangaToday.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangatoday -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaToday : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "m03" diff --git a/multisrc/overrides/mangahub/mangatownhub/src/MangaTownHub.kt b/multisrc/overrides/mangahub/mangatownhub/src/MangaTownHub.kt index cc876e733..7e6d99e53 100644 --- a/multisrc/overrides/mangahub/mangatownhub/src/MangaTownHub.kt +++ b/multisrc/overrides/mangahub/mangatownhub/src/MangaTownHub.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.mangatownhub -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class MangaTownHub : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mt01" diff --git a/multisrc/overrides/mangahub/onemangaco/src/OneMangaCo.kt b/multisrc/overrides/mangahub/onemangaco/src/OneMangaCo.kt index 322bdd9a7..495a481ef 100644 --- a/multisrc/overrides/mangahub/onemangaco/src/OneMangaCo.kt +++ b/multisrc/overrides/mangahub/onemangaco/src/OneMangaCo.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.onemangaco -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class OneMangaCo : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mn03" diff --git a/multisrc/overrides/mangahub/onemangainfo/src/OneMangaInfo.kt b/multisrc/overrides/mangahub/onemangainfo/src/OneMangaInfo.kt index 0ee8c7293..dd82c31c1 100644 --- a/multisrc/overrides/mangahub/onemangainfo/src/OneMangaInfo.kt +++ b/multisrc/overrides/mangahub/onemangainfo/src/OneMangaInfo.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.extension.en.onemangainfo -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.lib.ratelimit.SpecificHostRateLimitInterceptor import eu.kanade.tachiyomi.multisrc.mangahub.MangaHub import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit @@ -11,7 +11,7 @@ class OneMangaInfo : MangaHub( "en" ) { override val client: OkHttpClient = super.client.newBuilder() - .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .addInterceptor(SpecificHostRateLimitInterceptor(cdnHost, 1, 2)) .build() override val serverId = "mn02" diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt index b142090e2..3512a5e0e 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt @@ -41,6 +41,8 @@ abstract class MangaHub( protected abstract val serverId: String + protected open val cdnHost = " https://img.mghubcdn.com/".toHttpUrl() + // Popular override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/popular/page/$page", headers) @@ -367,7 +369,7 @@ data class ChapterInnerDto( val manga: MangaInnerDto, @SerialName("mangaID") val mangaId: Int, val noAd: Boolean, - val number: Int, + val number: Float, val pages: String, val slug: String, val title: String diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt index d5bab6b4b..79794317f 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt @@ -9,7 +9,7 @@ class MangaHubGenerator : ThemeSourceGenerator { override val themeClass = "MangaHub" - override val baseVersionCode: Int = 1 + override val baseVersionCode: Int = 2 override val sources = listOf( SingleLang("1Manga.co", "https://1manga.co", "en", isNsfw = true, className = "OneMangaCo"),