From 98cbee11b9cba3a5f897cc303f70c84b433c781f Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sat, 17 Aug 2024 10:47:17 +0300 Subject: [PATCH] Unify user agent header processing --- .../kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt | 6 ++++-- .../koitharu/kotatsu/parsers/site/all/BatoToParser.kt | 2 -- .../kotatsu/parsers/site/all/ComickFunParser.kt | 2 -- .../kotatsu/parsers/site/all/ExHentaiParser.kt | 2 -- .../kotatsu/parsers/site/all/HitomiLaParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/all/ImHentai.kt | 2 -- .../kotatsu/parsers/site/all/LineWebtoonsParser.kt | 2 +- .../kotatsu/parsers/site/all/MangaDexParser.kt | 2 -- .../kotatsu/parsers/site/all/MangaFireParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/all/MangaPark.kt | 2 -- .../kotatsu/parsers/site/all/MangaPlusParser.kt | 2 -- .../kotatsu/parsers/site/all/MangaReaderToParser.kt | 3 --- .../kotatsu/parsers/site/all/NineMangaParser.kt | 4 +--- .../parsers/site/all/NineNineNineHentaiParser.kt | 2 -- .../kotatsu/parsers/site/all/WebtoonsParser.kt | 2 +- .../site/animebootstrap/AnimeBootstrapParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/ar/FlixScans.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/ar/MangaStorm.kt | 2 +- .../org/koitharu/kotatsu/parsers/site/ar/TeamXNovel.kt | 2 -- .../koitharu/kotatsu/parsers/site/be/AnibelParser.kt | 2 -- .../kotatsu/parsers/site/cupfox/CupFoxParser.kt | 2 -- .../kotatsu/parsers/site/en/AsuraScansParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/en/BeeToon.kt | 2 -- .../kotatsu/parsers/site/en/CloneMangaParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/en/ComicExtra.kt | 2 +- .../koitharu/kotatsu/parsers/site/en/DynastyScans.kt | 2 +- .../koitharu/kotatsu/parsers/site/en/FlixScansOrg.kt | 1 - .../org/koitharu/kotatsu/parsers/site/en/MangaGeko.kt | 2 -- .../koitharu/kotatsu/parsers/site/en/MangaKawaiiEn.kt | 4 +--- .../kotatsu/parsers/site/en/MangaTownParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/en/Mangaowl.kt | 2 +- .../koitharu/kotatsu/parsers/site/en/Manhwa18Parser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/en/ManhwasMen.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/en/Po2Scans.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/en/Pururin.kt | 2 -- .../koitharu/kotatsu/parsers/site/es/TempleScanEsp.kt | 2 +- .../kotatsu/parsers/site/es/TuMangaOnlineParser.kt | 10 ++++------ .../kotatsu/parsers/site/fmreader/FmreaderParser.kt | 2 -- .../kotatsu/parsers/site/foolslide/FoolSlideParser.kt | 2 -- .../kotatsu/parsers/site/fr/BentomangaParser.kt | 2 -- .../koitharu/kotatsu/parsers/site/fr/FuryoSociety.kt | 2 +- .../kotatsu/parsers/site/fr/LegacyScansParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/fr/LireScan.kt | 2 -- .../koitharu/kotatsu/parsers/site/fr/LugnicaScans.kt | 2 +- .../koitharu/kotatsu/parsers/site/fr/MangaKawaii.kt | 4 +--- .../org/koitharu/kotatsu/parsers/site/fr/MangaMana.kt | 9 +-------- .../koitharu/kotatsu/parsers/site/fr/ScansMangasMe.kt | 2 +- .../koitharu/kotatsu/parsers/site/fr/ScantradUnion.kt | 2 +- .../parsers/site/fuzzydoodle/FuzzyDoodleParser.kt | 2 -- .../parsers/site/galleryadults/GalleryAdultsParser.kt | 2 -- .../parsers/site/galleryadults/all/NHentaiParser.kt | 9 +++------ .../kotatsu/parsers/site/gattsu/GattsuParser.kt | 2 -- .../koitharu/kotatsu/parsers/site/guya/GuyaParser.kt | 2 -- .../koitharu/kotatsu/parsers/site/heancms/HeanCms.kt | 2 -- .../kotatsu/parsers/site/heancmsalt/HeanCmsAlt.kt | 2 -- .../kotatsu/parsers/site/hotcomics/HotComicsParser.kt | 4 +--- .../kotatsu/parsers/site/id/DoujinDesuParser.kt | 4 +--- .../org/koitharu/kotatsu/parsers/site/id/HentaiCrot.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/id/PixHentai.kt | 2 -- .../koitharu/kotatsu/parsers/site/iken/IkenParser.kt | 2 -- .../kotatsu/parsers/site/ja/NicovideoSeigaParser.kt | 2 +- .../kotatsu/parsers/site/keyoapp/KeyoappParser.kt | 2 -- .../kotatsu/parsers/site/likemanga/LikeMangaParser.kt | 2 -- .../kotatsu/parsers/site/madara/MadaraParser.kt | 2 -- .../koitharu/kotatsu/parsers/site/madara/id/Mgkomik.kt | 2 +- .../kotatsu/parsers/site/madtheme/MadthemeParser.kt | 2 -- .../kotatsu/parsers/site/manga18/Manga18Parser.kt | 2 -- .../kotatsu/parsers/site/mangabox/MangaboxParser.kt | 3 --- .../parsers/site/mangadventure/MangAdventureParser.kt | 2 +- .../parsers/site/mangareader/MangaReaderParser.kt | 10 ++++------ .../parsers/site/mangaworld/MangaWorldParser.kt | 2 -- .../kotatsu/parsers/site/mmrcms/MmrcmsParser.kt | 2 -- .../kotatsu/parsers/site/nepnep/NepnepParser.kt | 10 +++++----- .../kotatsu/parsers/site/onemanga/OneMangaParser.kt | 2 -- .../site/otakusanctuary/OtakuSanctuaryParser.kt | 2 -- .../parsers/site/pizzareader/PizzaReaderParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/pt/BrMangas.kt | 2 +- .../org/koitharu/kotatsu/parsers/site/pt/LerManga.kt | 8 +------- .../koitharu/kotatsu/parsers/site/pt/LerMangaOnline.kt | 2 -- .../kotatsu/parsers/site/pt/LuratoonScansParser.kt | 5 +---- .../koitharu/kotatsu/parsers/site/pt/MangaOnline.kt | 2 -- .../koitharu/kotatsu/parsers/site/pt/MuitoHentai.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/pt/OnePieceEx.kt | 2 -- .../koitharu/kotatsu/parsers/site/pt/YugenMangas.kt | 2 -- .../koitharu/kotatsu/parsers/site/ru/DesuMeParser.kt | 2 +- .../koitharu/kotatsu/parsers/site/ru/RemangaParser.kt | 5 +---- .../kotatsu/parsers/site/ru/grouple/GroupleParser.kt | 4 ++-- .../koitharu/kotatsu/parsers/site/scan/ScanParser.kt | 2 -- .../koitharu/kotatsu/parsers/site/sinmh/SinmhParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/tr/MangaAy.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/tr/SadScans.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/tr/TrWebtoon.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/tr/YaoiFlix.kt | 2 -- .../kotatsu/parsers/site/uk/HentaiUkrParser.kt | 2 -- .../kotatsu/parsers/site/uk/HoneyMangaParser.kt | 2 -- .../kotatsu/parsers/site/uk/MangaInUaParser.kt | 2 -- .../kotatsu/parsers/site/vi/BlogTruyenParser.kt | 6 +++--- .../kotatsu/parsers/site/vi/BlogTruyenVNParser.kt | 6 +++--- .../koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt | 1 - .../org/koitharu/kotatsu/parsers/site/vi/LxManga.kt | 2 +- .../org/koitharu/kotatsu/parsers/site/vi/Truyenqq.kt | 2 -- .../koitharu/kotatsu/parsers/site/vi/YurinekoParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt | 2 -- .../kotatsu/parsers/site/wpcomics/WpComicsParser.kt | 4 +--- .../parsers/site/zeistmanga/ZeistMangaParser.kt | 2 -- .../org/koitharu/kotatsu/parsers/site/zh/Baozimh.kt | 2 -- .../kotatsu/parsers/site/zmanga/ZMangaParser.kt | 2 -- .../kotatsu/parsers/CommonHeadersInterceptor.kt | 2 +- 108 files changed, 56 insertions(+), 236 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt index 51333a0a6..7de7f70ec 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt @@ -74,8 +74,10 @@ abstract class MangaParser @InternalParsersApi constructor( @InternalParsersApi abstract val configKeyDomain: ConfigKey.Domain - open val headers: Headers = Headers.Builder() - .add("User-Agent", context.getDefaultUserAgent()) + protected open val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) + + open fun getRequestHeaders(): Headers = Headers.Builder() + .add("User-Agent", config[userAgentKey]) .build() /** diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/BatoToParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/BatoToParser.kt index 4b29a8d89..1d4e5520a 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/BatoToParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/BatoToParser.kt @@ -27,8 +27,6 @@ internal class BatoToParser(context: MangaLoaderContext) : PagedMangaParser( searchPageSize = 20, ), MangaParserAuthProvider { - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ComickFunParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ComickFunParser.kt index 75b94ccff..28871b2a7 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ComickFunParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ComickFunParser.kt @@ -26,8 +26,6 @@ internal class ComickFunParser(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("comick.io", "comick.cc") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ExHentaiParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ExHentaiParser.kt index 065770315..89a085315 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ExHentaiParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ExHentaiParser.kt @@ -26,8 +26,6 @@ internal class ExHentaiParser( context: MangaLoaderContext, ) : PagedMangaParser(context, MangaParserSource.EXHENTAI, pageSize = 25), MangaParserAuthProvider { - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override val availableSortOrders: Set = setOf(SortOrder.NEWEST) override val isTagsExclusionSupported: Boolean = true diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt index cb3481d93..3f8863fbe 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt @@ -30,8 +30,6 @@ import kotlin.math.min class HitomiLaParser(context: MangaLoaderContext) : MangaParser(context, MangaParserSource.HITOMILA) { override val configKeyDomain = ConfigKey.Domain("hitomi.la") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ImHentai.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ImHentai.kt index 3fa311ea3..27f2ee3e2 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ImHentai.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/ImHentai.kt @@ -22,8 +22,6 @@ internal class ImHentai(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("imhentai.xxx") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/LineWebtoonsParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/LineWebtoonsParser.kt index 931c88641..d0260a428 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/LineWebtoonsParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/LineWebtoonsParser.kt @@ -48,7 +48,7 @@ internal abstract class LineWebtoonsParser( SortOrder.UPDATED, ) - private val userAgentKey = ConfigKey.UserAgent("nApps (Android 12;; linewebtoon; 3.1.0)") + override val userAgentKey = ConfigKey.UserAgent("nApps (Android 12;; linewebtoon; 3.1.0)") override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaDexParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaDexParser.kt index 26f08d9e4..ff33c2f30 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaDexParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaDexParser.kt @@ -28,8 +28,6 @@ internal class MangaDexParser(context: MangaLoaderContext) : MangaParser(context override val configKeyDomain = ConfigKey.Domain("mangadex.org") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaFireParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaFireParser.kt index 939a43010..0d3b16652 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaFireParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaFireParser.kt @@ -39,8 +39,6 @@ internal abstract class MangaFireParser( SortOrder.ALPHABETICAL, ) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPark.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPark.kt index abbed05c3..158b44186 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPark.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPark.kt @@ -26,8 +26,6 @@ internal class MangaPark(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("mangapark.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPlusParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPlusParser.kt index 6c00a5318..69a15811d 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPlusParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaPlusParser.kt @@ -29,8 +29,6 @@ internal abstract class MangaPlusParser( private val apiUrl = "https://jumpg-webapi.tokyo-cdn.com/api" override val configKeyDomain = ConfigKey.Domain("mangaplus.shueisha.co.jp") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaReaderToParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaReaderToParser.kt index 46db40802..2d7c85c67 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaReaderToParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/MangaReaderToParser.kt @@ -26,9 +26,6 @@ class MangaReaderToParser(context: MangaLoaderContext) : PagedMangaParser(contex override val configKeyDomain = ConfigKey.Domain("mangareader.to") - - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt index 4f57f04bf..7de52d1c7 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt @@ -23,8 +23,6 @@ internal abstract class NineMangaParser( override val configKeyDomain = ConfigKey.Domain(defaultDomain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) @@ -34,7 +32,7 @@ internal abstract class NineMangaParser( context.cookieJar.insertCookies(domain, "ninemanga_template_desk=yes") } - override val headers = super.headers.newBuilder() + override fun getRequestHeaders() = super.getRequestHeaders().newBuilder() .add("Accept-Language", "en-US;q=0.7,en;q=0.3") .build() diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineNineNineHentaiParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineNineNineHentaiParser.kt index 901ef83d9..c3f155e35 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineNineNineHentaiParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineNineNineHentaiParser.kt @@ -24,8 +24,6 @@ internal class NineNineNineHentaiParser(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("animeh.to") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/WebtoonsParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/WebtoonsParser.kt index a39ba8fd5..93ec230f2 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/WebtoonsParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/WebtoonsParser.kt @@ -49,7 +49,7 @@ internal abstract class WebtoonsParser( SortOrder.UPDATED, ) - private val userAgentKey = ConfigKey.UserAgent("nApps (Android 12;; linewebtoon; 3.1.0)") + override val userAgentKey = ConfigKey.UserAgent("nApps (Android 12;; linewebtoon; 3.1.0)") override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/animebootstrap/AnimeBootstrapParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/animebootstrap/AnimeBootstrapParser.kt index 3d5020b6a..67a284106 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/animebootstrap/AnimeBootstrapParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/animebootstrap/AnimeBootstrapParser.kt @@ -20,8 +20,6 @@ internal abstract class AnimeBootstrapParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/FlixScans.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/FlixScans.kt index ec182823a..1f84bddc6 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/FlixScans.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/FlixScans.kt @@ -23,8 +23,6 @@ internal class FlixScans(context: MangaLoaderContext) : PagedMangaParser(context override val availableContentRating: Set = EnumSet.of(ContentRating.ADULT) override val configKeyDomain = ConfigKey.Domain("flixscans.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/MangaStorm.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/MangaStorm.kt index c0c14454b..9eea168f7 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/MangaStorm.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/MangaStorm.kt @@ -18,7 +18,7 @@ internal class MangaStorm(context: MangaLoaderContext) : PagedMangaParser(contex override val configKeyDomain = ConfigKey.Domain("mangastorm.org") override val isMultipleTagsSupported = false - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/TeamXNovel.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/TeamXNovel.kt index ae8856cce..9ef6ab203 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/TeamXNovel.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ar/TeamXNovel.kt @@ -22,8 +22,6 @@ internal class TeamXNovel(context: MangaLoaderContext) : PagedMangaParser(contex override val configKeyDomain = ConfigKey.Domain("teamoney.site") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/be/AnibelParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/be/AnibelParser.kt index 37afaf0f6..89c246384 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/be/AnibelParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/be/AnibelParser.kt @@ -25,8 +25,6 @@ internal class AnibelParser(context: MangaLoaderContext) : MangaParser(context, override val configKeyDomain = ConfigKey.Domain("anibel.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/cupfox/CupFoxParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/cupfox/CupFoxParser.kt index 8d2114e6d..05734d3a8 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/cupfox/CupFoxParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/cupfox/CupFoxParser.kt @@ -17,8 +17,6 @@ internal abstract class CupFoxParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/AsuraScansParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/AsuraScansParser.kt index c432096ae..3c364c070 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/AsuraScansParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/AsuraScansParser.kt @@ -29,8 +29,6 @@ internal class AsuraScansParser(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("asuracomic.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/BeeToon.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/BeeToon.kt index 8ac8bbc9f..d33473ef1 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/BeeToon.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/BeeToon.kt @@ -17,8 +17,6 @@ internal class BeeToon(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("manhwafull.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/CloneMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/CloneMangaParser.kt index 0ba264769..fc373e934 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/CloneMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/CloneMangaParser.kt @@ -18,8 +18,6 @@ internal class CloneMangaParser(context: MangaLoaderContext) : MangaParser(conte override val configKeyDomain = ConfigKey.Domain("manga.clone-army.org") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ComicExtra.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ComicExtra.kt index 4383ee070..af06d6be5 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ComicExtra.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ComicExtra.kt @@ -21,7 +21,7 @@ internal class ComicExtra(context: MangaLoaderContext) : PagedMangaParser(contex override val configKeyDomain = ConfigKey.Domain("comixextra.com") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/DynastyScans.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/DynastyScans.kt index 3bbbf0327..d7a42055b 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/DynastyScans.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/DynastyScans.kt @@ -23,7 +23,7 @@ internal class DynastyScans(context: MangaLoaderContext) : override val availableSortOrders: Set = EnumSet.of(SortOrder.ALPHABETICAL) override val configKeyDomain = ConfigKey.Domain("dynasty-scans.com") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/FlixScansOrg.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/FlixScansOrg.kt index 807a630fc..94b988ff6 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/FlixScansOrg.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/FlixScansOrg.kt @@ -23,7 +23,6 @@ internal class FlixScansOrg(context: MangaLoaderContext) : override val availableStates: Set = EnumSet.allOf(MangaState::class.java) override val availableContentRating: Set = EnumSet.of(ContentRating.ADULT) override val configKeyDomain = ConfigKey.Domain("flixscans.org") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaGeko.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaGeko.kt index 80b332a5d..2a7aa0cb4 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaGeko.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaGeko.kt @@ -21,8 +21,6 @@ internal class MangaGeko(context: MangaLoaderContext) : PagedMangaParser(context override val isMultipleTagsSupported = false - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaKawaiiEn.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaKawaiiEn.kt index e7aeaebf7..9c849dc93 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaKawaiiEn.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaKawaiiEn.kt @@ -20,14 +20,12 @@ internal class MangaKawaiiEn(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("www.mangakawaii.io") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) } - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("Accept-Language", "en") .build() diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaTownParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaTownParser.kt index c24c858cf..612114b5e 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaTownParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaTownParser.kt @@ -16,8 +16,6 @@ internal class MangaTownParser(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("www.mangatown.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Mangaowl.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Mangaowl.kt index 90d17006f..92b3ea3cc 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Mangaowl.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Mangaowl.kt @@ -29,7 +29,7 @@ internal class Mangaowl(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("mangaowl.to") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Manhwa18Parser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Manhwa18Parser.kt index 284948c1e..1e43bce2d 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Manhwa18Parser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Manhwa18Parser.kt @@ -15,8 +15,6 @@ class Manhwa18Parser(context: MangaLoaderContext) : override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("manhwa18.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ManhwasMen.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ManhwasMen.kt index 0a65d9522..da308af1e 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ManhwasMen.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/ManhwasMen.kt @@ -16,8 +16,6 @@ class ManhwasMen(context: MangaLoaderContext) : override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("manhwas.men") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Po2Scans.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Po2Scans.kt index 8f62f42f5..90e478fad 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Po2Scans.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Po2Scans.kt @@ -15,8 +15,6 @@ internal class Po2Scans(context: MangaLoaderContext) : MangaParser(context, Mang override val availableSortOrders: Set = EnumSet.of(SortOrder.ALPHABETICAL) override val configKeyDomain = ConfigKey.Domain("po2scans.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Pururin.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Pururin.kt index 66e6686ae..4d1416369 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Pururin.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Pururin.kt @@ -22,8 +22,6 @@ internal class Pururin(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("pururin.to") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TempleScanEsp.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TempleScanEsp.kt index d5c3db3ca..2312ff8f4 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TempleScanEsp.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TempleScanEsp.kt @@ -20,7 +20,7 @@ internal class TempleScanEsp(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("templescanesp.net") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TuMangaOnlineParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TuMangaOnlineParser.kt index 459ecc3f0..013e73f14 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TuMangaOnlineParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/es/TuMangaOnlineParser.kt @@ -22,8 +22,6 @@ class TuMangaOnlineParser(context: MangaLoaderContext) : PagedMangaParser( override val configKeyDomain = ConfigKey.Domain("visortmo.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) @@ -93,7 +91,7 @@ class TuMangaOnlineParser(context: MangaLoaderContext) : PagedMangaParser( append("&_pg=1&page=") append(page.toString()) } - val doc = webClient.httpGet(url, headers).parseHtml() + val doc = webClient.httpGet(url, getRequestHeaders()).parseHtml() val items = doc.body().select("div.element") return items.mapNotNull { item -> val href = @@ -183,7 +181,7 @@ class TuMangaOnlineParser(context: MangaLoaderContext) : PagedMangaParser( override suspend fun getPages(chapter: MangaChapter): List { - val redirectDoc = webClient.httpGet(chapter.url.toAbsoluteUrl(domain), headers).parseHtml() + val redirectDoc = webClient.httpGet(chapter.url.toAbsoluteUrl(domain), getRequestHeaders()).parseHtml() var doc = redirectToReadingPage(redirectDoc) val currentUrl = doc.location() val newUrl = if (!currentUrl.contains("cascade")) { @@ -193,7 +191,7 @@ class TuMangaOnlineParser(context: MangaLoaderContext) : PagedMangaParser( } if (currentUrl != newUrl) { - doc = webClient.httpGet(newUrl, headers).parseHtml() + doc = webClient.httpGet(newUrl, getRequestHeaders()).parseHtml() } return doc.select("div.viewer-container img:not(noscript img)").map { @@ -285,7 +283,7 @@ class TuMangaOnlineParser(context: MangaLoaderContext) : PagedMangaParser( override suspend fun getAvailableTags(): Set { - val doc = webClient.httpGet("https://$domain/library", headers).parseHtml() + val doc = webClient.httpGet("https://$domain/library", getRequestHeaders()).parseHtml() val elements = doc.body().select("div#books-genders > div > div") return elements.mapNotNullToSet { element -> MangaTag( diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fmreader/FmreaderParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fmreader/FmreaderParser.kt index 3252921f4..c97b774e7 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fmreader/FmreaderParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fmreader/FmreaderParser.kt @@ -21,8 +21,6 @@ internal abstract class FmreaderParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt index 5dd90f92a..f9b3ee0c8 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/foolslide/FoolSlideParser.kt @@ -20,8 +20,6 @@ internal abstract class FoolSlideParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/BentomangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/BentomangaParser.kt index 3f2ab3840..1d20bf567 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/BentomangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/BentomangaParser.kt @@ -32,8 +32,6 @@ internal class BentomangaParser(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("bentomanga.com", "www.bentomanga.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/FuryoSociety.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/FuryoSociety.kt index b42254049..c7d25ff81 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/FuryoSociety.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/FuryoSociety.kt @@ -22,7 +22,7 @@ internal class FuryoSociety(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("furyosociety.com") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LegacyScansParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LegacyScansParser.kt index 9c257a2a9..6d50790f1 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LegacyScansParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LegacyScansParser.kt @@ -22,8 +22,6 @@ internal class LegacyScansParser(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("legacy-scans.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LireScan.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LireScan.kt index e04c7c3e6..57ac1c516 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LireScan.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LireScan.kt @@ -18,8 +18,6 @@ internal class LireScan(context: MangaLoaderContext) : PagedMangaParser(context, override val configKeyDomain = ConfigKey.Domain("lire-scan.me") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LugnicaScans.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LugnicaScans.kt index 6b113bee4..4f4a4e12f 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LugnicaScans.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/LugnicaScans.kt @@ -30,7 +30,7 @@ internal class LugnicaScans(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("lugnica-scans.com") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaKawaii.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaKawaii.kt index 65cc34198..a773597e0 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaKawaii.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaKawaii.kt @@ -19,14 +19,12 @@ internal class MangaKawaii(context: MangaLoaderContext) : PagedMangaParser(conte override val configKeyDomain = ConfigKey.Domain("www.mangakawaii.io") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) } - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("Accept-Language", "fr") .build() diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaMana.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaMana.kt index adfa161e7..faba6a93a 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaMana.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/MangaMana.kt @@ -1,11 +1,6 @@ package org.koitharu.kotatsu.parsers.site.fr -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.async -import kotlinx.coroutines.awaitAll -import kotlinx.coroutines.coroutineScope -import kotlinx.coroutines.delay -import kotlinx.coroutines.withContext +import kotlinx.coroutines.* import okhttp3.Headers import okhttp3.Request import okhttp3.RequestBody @@ -42,8 +37,6 @@ internal class MangaMana(context: MangaLoaderContext) : PagedMangaParser(context override val configKeyDomain = ConfigKey.Domain("www.manga-mana.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScansMangasMe.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScansMangasMe.kt index d54f93b0e..87e15c214 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScansMangasMe.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScansMangasMe.kt @@ -25,7 +25,7 @@ internal class ScansMangasMe(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("scansmangas.me") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScantradUnion.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScantradUnion.kt index cdb226d6b..482bed094 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScantradUnion.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fr/ScantradUnion.kt @@ -24,7 +24,7 @@ internal class ScantradUnion(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("scantrad-union.com") - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fuzzydoodle/FuzzyDoodleParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fuzzydoodle/FuzzyDoodleParser.kt index 41f077804..4149a8c41 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fuzzydoodle/FuzzyDoodleParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/fuzzydoodle/FuzzyDoodleParser.kt @@ -24,8 +24,6 @@ internal abstract class FuzzyDoodleParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/GalleryAdultsParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/GalleryAdultsParser.kt index f32404e5d..faf1bd263 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/GalleryAdultsParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/GalleryAdultsParser.kt @@ -23,8 +23,6 @@ internal abstract class GalleryAdultsParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/all/NHentaiParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/all/NHentaiParser.kt index 9edfb7c93..8ea0f31d2 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/all/NHentaiParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/galleryadults/all/NHentaiParser.kt @@ -30,12 +30,9 @@ internal class NHentaiParser(context: MangaLoaderContext) : override val isMultipleTagsSupported = true - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - - override val headers: Headers - get() = super.headers.newBuilder() - .set("User-Agent", config[userAgentKey]) - .build() + override fun getRequestHeaders(): Headers = super.getRequestHeaders().newBuilder() + .set("User-Agent", config[userAgentKey]) + .build() override suspend fun getListPage(page: Int, filter: MangaListFilter?): List { diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/gattsu/GattsuParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/gattsu/GattsuParser.kt index 7d857f25a..e3152db47 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/gattsu/GattsuParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/gattsu/GattsuParser.kt @@ -18,8 +18,6 @@ internal abstract class GattsuParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/guya/GuyaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/guya/GuyaParser.kt index c7f007651..a507a9611 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/guya/GuyaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/guya/GuyaParser.kt @@ -17,8 +17,6 @@ internal abstract class GuyaParser( override val availableSortOrders: Set = EnumSet.of(SortOrder.ALPHABETICAL) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancms/HeanCms.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancms/HeanCms.kt index 62bd0442c..675d75f22 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancms/HeanCms.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancms/HeanCms.kt @@ -23,8 +23,6 @@ internal abstract class HeanCms( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancmsalt/HeanCmsAlt.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancmsalt/HeanCmsAlt.kt index 3927aa2ef..3ec1f299b 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancmsalt/HeanCmsAlt.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/heancmsalt/HeanCmsAlt.kt @@ -21,8 +21,6 @@ internal abstract class HeanCmsAlt( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/hotcomics/HotComicsParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/hotcomics/HotComicsParser.kt index 81f3ee1d7..460c52fd4 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/hotcomics/HotComicsParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/hotcomics/HotComicsParser.kt @@ -24,8 +24,6 @@ internal abstract class HotComicsParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) @@ -39,7 +37,7 @@ internal abstract class HotComicsParser( protected open val onePage = false - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("User-Agent", UserAgents.CHROME_DESKTOP) .build() diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/DoujinDesuParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/DoujinDesuParser.kt index 9ef27f8be..1dc40e26a 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/DoujinDesuParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/DoujinDesuParser.kt @@ -17,8 +17,6 @@ class DoujinDesuParser(context: MangaLoaderContext) : override val configKeyDomain: ConfigKey.Domain get() = ConfigKey.Domain("doujindesu.tv") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) @@ -30,7 +28,7 @@ class DoujinDesuParser(context: MangaLoaderContext) : override val availableStates: Set = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED) - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("X-Requested-With", "XMLHttpRequest") .add("Referer", "https://$domain/") .build() diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/HentaiCrot.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/HentaiCrot.kt index 409409930..22f5ded2d 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/HentaiCrot.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/HentaiCrot.kt @@ -17,8 +17,6 @@ internal class HentaiCrot(context: MangaLoaderContext) : ) override val configKeyDomain = ConfigKey.Domain("hentaicrot.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/PixHentai.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/PixHentai.kt index bd15d06f6..4980ad64f 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/PixHentai.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/PixHentai.kt @@ -17,8 +17,6 @@ internal class PixHentai(context: MangaLoaderContext) : ) override val configKeyDomain = ConfigKey.Domain("pixhentai.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/iken/IkenParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/iken/IkenParser.kt index 9076a2a8f..bf4fc712c 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/iken/IkenParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/iken/IkenParser.kt @@ -21,8 +21,6 @@ internal abstract class IkenParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ja/NicovideoSeigaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ja/NicovideoSeigaParser.kt index 9c0f3f0b3..0d5e422c7 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ja/NicovideoSeigaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ja/NicovideoSeigaParser.kt @@ -16,7 +16,7 @@ class NicovideoSeigaParser(context: MangaLoaderContext) : MangaParser(context, MangaParserSource.NICOVIDEO_SEIGA), MangaParserAuthProvider { - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/keyoapp/KeyoappParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/keyoapp/KeyoappParser.kt index e5f08ddc0..a82fdf34b 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/keyoapp/KeyoappParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/keyoapp/KeyoappParser.kt @@ -22,8 +22,6 @@ internal abstract class KeyoappParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/likemanga/LikeMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/likemanga/LikeMangaParser.kt index 21b764d26..8ea7aae55 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/likemanga/LikeMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/likemanga/LikeMangaParser.kt @@ -24,8 +24,6 @@ internal abstract class LikeMangaParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt index 14becf6e2..2cb199027 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt @@ -27,8 +27,6 @@ internal abstract class MadaraParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/id/Mgkomik.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/id/Mgkomik.kt index 58e37bc24..b273174d3 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/id/Mgkomik.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/id/Mgkomik.kt @@ -18,7 +18,7 @@ internal class Mgkomik(context: MangaLoaderContext) : override val sourceLocale: Locale = Locale.ENGLISH private val randomLength = Random.Default.nextInt(13, 21) private val randomString = generateRandomString(randomLength) - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8") .add("Accept-Language", "en-US,en;q=0.9,id;q=0.8") .add("Sec-Fetch-Dest", "document") diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madtheme/MadthemeParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madtheme/MadthemeParser.kt index 46a06c169..81c4d9b84 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madtheme/MadthemeParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madtheme/MadthemeParser.kt @@ -21,8 +21,6 @@ internal abstract class MadthemeParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/manga18/Manga18Parser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/manga18/Manga18Parser.kt index db7447ac5..9d7a98f26 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/manga18/Manga18Parser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/manga18/Manga18Parser.kt @@ -20,8 +20,6 @@ internal abstract class Manga18Parser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt index 09f487680..f3b96354c 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/MangaboxParser.kt @@ -18,9 +18,6 @@ internal abstract class MangaboxParser( pageSize: Int = 24, ) : PagedMangaParser(context, source, pageSize) { - - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangadventure/MangAdventureParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangadventure/MangAdventureParser.kt index 0110308b3..ce9876627 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangadventure/MangAdventureParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangadventure/MangAdventureParser.kt @@ -20,7 +20,7 @@ internal abstract class MangAdventureParser( ) : PagedMangaParser(context, source, pageSize) { override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(UserAgents.KOTATSU) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.KOTATSU) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/MangaReaderParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/MangaReaderParser.kt index 2e7eb86ae..7dd286865 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/MangaReaderParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangareader/MangaReaderParser.kt @@ -29,8 +29,6 @@ internal abstract class MangaReaderParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) @@ -225,18 +223,18 @@ internal abstract class MangaReaderParser( "En cours de publication", "Đang tiến hành", "Em lançamento", "em lançamento", "Em Lançamento", "Онгоінг", "Publishing", "Devam Ediyor", "Em Andamento", "In Corso", "Güncel", "Berjalan", "Продолжается", "Updating", "Lançando", "In Arrivo", "Emision", "En emision", "مستمر", "Curso", "En marcha", "Publicandose", "Publicando", "连载中", "Devam ediyor", "Devam Etmekte", - -> MangaState.ONGOING + -> MangaState.ONGOING "Completed", "Completo", "Complété", "Fini", "Achevé", "Terminé", "Terminé ⚫", "Tamamlandı", "Đã hoàn thành", "Hoàn Thành", "مكتملة", "Завершено", "Finished", "Finalizado", "Completata", "One-Shot", "Bitti", "Tamat", "Completado", "Concluído", "Concluido", "已完结", "Bitmiş", - -> MangaState.FINISHED + -> MangaState.FINISHED "Canceled", "Cancelled", "Cancelado", "cancellato", "Cancelados", "Dropped", "Discontinued", "abandonné", "Abandonné", - -> MangaState.ABANDONED + -> MangaState.ABANDONED "Hiatus", "On Hold", "Pausado", "En espera", "En pause", "En Pause", "En attente", - -> MangaState.PAUSED + -> MangaState.PAUSED else -> null } diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangaworld/MangaWorldParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangaworld/MangaWorldParser.kt index 6997ba545..1c137a788 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangaworld/MangaWorldParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangaworld/MangaWorldParser.kt @@ -29,8 +29,6 @@ abstract class MangaWorldParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mmrcms/MmrcmsParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mmrcms/MmrcmsParser.kt index 66edf2cb5..cdc0b2b7d 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mmrcms/MmrcmsParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mmrcms/MmrcmsParser.kt @@ -20,8 +20,6 @@ internal abstract class MmrcmsParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/nepnep/NepnepParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/nepnep/NepnepParser.kt index d95324b6a..ca8527822 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/nepnep/NepnepParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/nepnep/NepnepParser.kt @@ -23,7 +23,7 @@ internal abstract class NepnepParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) @@ -186,17 +186,17 @@ internal abstract class NepnepParser( altTitle = null, state = when (doc.selectFirstOrThrow(".list-group-item:contains(Status:) a").text()) { "Ongoing (Scan)", "Ongoing (Publish)", - -> MangaState.ONGOING + -> MangaState.ONGOING "Complete (Scan)", "Complete (Publish)", - -> MangaState.FINISHED + -> MangaState.FINISHED "Cancelled (Scan)", "Cancelled (Publish)", "Discontinued (Scan)", "Discontinued (Publish)", - -> MangaState.ABANDONED + -> MangaState.ABANDONED "Hiatus (Scan)", "Hiatus (Publish)", - -> MangaState.PAUSED + -> MangaState.PAUSED else -> null }, diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/onemanga/OneMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/onemanga/OneMangaParser.kt index 65cd6e1de..883dfe25e 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/onemanga/OneMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/onemanga/OneMangaParser.kt @@ -16,8 +16,6 @@ internal abstract class OneMangaParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/otakusanctuary/OtakuSanctuaryParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/otakusanctuary/OtakuSanctuaryParser.kt index 96107b49a..c2b71bbdf 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/otakusanctuary/OtakuSanctuaryParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/otakusanctuary/OtakuSanctuaryParser.kt @@ -20,8 +20,6 @@ internal abstract class OtakuSanctuaryParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pizzareader/PizzaReaderParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pizzareader/PizzaReaderParser.kt index df727c92f..241a52620 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pizzareader/PizzaReaderParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pizzareader/PizzaReaderParser.kt @@ -23,8 +23,6 @@ internal abstract class PizzaReaderParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/BrMangas.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/BrMangas.kt index 4e2ebd636..d39dc3d92 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/BrMangas.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/BrMangas.kt @@ -20,7 +20,7 @@ internal class BrMangas(context: MangaLoaderContext) : PagedMangaParser(context, override val isMultipleTagsSupported = false - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerManga.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerManga.kt index 2be647a9d..f28e66653 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerManga.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerManga.kt @@ -1,10 +1,6 @@ package org.koitharu.kotatsu.parsers.site.pt -import org.koitharu.kotatsu.parsers.Broken -import org.koitharu.kotatsu.parsers.ErrorMessages -import org.koitharu.kotatsu.parsers.MangaLoaderContext -import org.koitharu.kotatsu.parsers.MangaSourceParser -import org.koitharu.kotatsu.parsers.PagedMangaParser +import org.koitharu.kotatsu.parsers.* import org.koitharu.kotatsu.parsers.config.ConfigKey import org.koitharu.kotatsu.parsers.model.* import org.koitharu.kotatsu.parsers.util.* @@ -26,8 +22,6 @@ class LerManga(context: MangaLoaderContext) : PagedMangaParser(context, MangaPar override val configKeyDomain = ConfigKey.Domain("lermanga.org") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerMangaOnline.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerMangaOnline.kt index ce1f326f7..4abefa325 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerMangaOnline.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LerMangaOnline.kt @@ -19,8 +19,6 @@ class LerMangaOnline(context: MangaLoaderContext) : PagedMangaParser(context, Ma override val configKeyDomain = ConfigKey.Domain("lermangaonline.com.br") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LuratoonScansParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LuratoonScansParser.kt index 70c730638..fadcbe0f0 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LuratoonScansParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/LuratoonScansParser.kt @@ -22,10 +22,7 @@ internal class LuratoonScansParser(context: MangaLoaderContext) : MangaParser(co override val configKeyDomain = ConfigKey.Domain("luratoons.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - - override val headers: Headers - get() = Headers.Builder().add("User-Agent", config[userAgentKey]).build() + override fun getRequestHeaders(): Headers = Headers.Builder().add("User-Agent", config[userAgentKey]).build() override val isSearchSupported = false override val isTagsExclusionSupported = false diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MangaOnline.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MangaOnline.kt index b1a1a1842..0b69c8eb1 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MangaOnline.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MangaOnline.kt @@ -16,8 +16,6 @@ class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(context, Manga override val configKeyDomain = ConfigKey.Domain("mangaonline.biz") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MuitoHentai.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MuitoHentai.kt index 9552f3531..7985c9b4b 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MuitoHentai.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/MuitoHentai.kt @@ -15,8 +15,6 @@ class MuitoHentai(context: MangaLoaderContext) : PagedMangaParser(context, Manga override val configKeyDomain = ConfigKey.Domain("www.muitohentai.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/OnePieceEx.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/OnePieceEx.kt index eda45976e..3dd0902e2 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/OnePieceEx.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/OnePieceEx.kt @@ -17,8 +17,6 @@ class OnePieceEx(context: MangaLoaderContext) : PagedMangaParser(context, MangaP override val configKeyDomain = ConfigKey.Domain("onepieceex.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/YugenMangas.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/YugenMangas.kt index a43f41005..f314a167d 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/YugenMangas.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/pt/YugenMangas.kt @@ -18,8 +18,6 @@ class YugenMangas(context: MangaLoaderContext) : PagedMangaParser(context, Manga override val availableSortOrders: Set = EnumSet.of(SortOrder.UPDATED, SortOrder.ALPHABETICAL) override val configKeyDomain = ConfigKey.Domain("yugenapp.lat") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/DesuMeParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/DesuMeParser.kt index 3e75d2ec2..92133213c 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/DesuMeParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/DesuMeParser.kt @@ -25,7 +25,7 @@ internal class DesuMeParser(context: MangaLoaderContext) : PagedMangaParser(cont SortOrder.ALPHABETICAL, ) - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("User-Agent", UserAgents.KOTATSU) .build() diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/RemangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/RemangaParser.kt index 70d34bac7..811067c05 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/RemangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/RemangaParser.kt @@ -31,15 +31,12 @@ internal class RemangaParser( context: MangaLoaderContext, ) : PagedMangaParser(context, MangaParserSource.REMANGA, PAGE_SIZE), MangaParserAuthProvider, Interceptor { - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - private val baseHeaders: Headers get() = Headers.Builder() .add("User-Agent", config[userAgentKey]) .build() - override val headers - get() = getApiHeaders() + override fun getRequestHeaders() = getApiHeaders() override val configKeyDomain = ConfigKey.Domain("remanga.org", "реманга.орг") diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt index 7ccb441ef..518897270 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt @@ -43,12 +43,12 @@ internal abstract class GroupleParser( private var cachedPagesServer: String? = null protected open val defaultIsNsfw = false - private val userAgentKey = ConfigKey.UserAgent( + override val userAgentKey = ConfigKey.UserAgent( "Mozilla/5.0 (X11; U; UNICOS lcLinux; en-US) Gecko/20140730 (KHTML, like Gecko, Safari/419.3) Arora/0.8.0", ) private val splitTranslationsKey = ConfigKey.SplitByTranslations(false) - override val headers: Headers = Headers.Builder().add("User-Agent", config[userAgentKey]).build() + override fun getRequestHeaders(): Headers = Headers.Builder().add("User-Agent", config[userAgentKey]).build() override val availableSortOrders: Set = EnumSet.of( SortOrder.UPDATED, diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/scan/ScanParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/scan/ScanParser.kt index b1673cdae..5f077daad 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/scan/ScanParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/scan/ScanParser.kt @@ -21,8 +21,6 @@ internal abstract class ScanParser( ) : PagedMangaParser(context, source, pageSize) { override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/sinmh/SinmhParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/sinmh/SinmhParser.kt index c6ae3d202..520ecc8db 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/sinmh/SinmhParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/sinmh/SinmhParser.kt @@ -18,8 +18,6 @@ internal abstract class SinmhParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/MangaAy.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/MangaAy.kt index 46c9233d4..5849423b4 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/MangaAy.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/MangaAy.kt @@ -20,8 +20,6 @@ class MangaAy(context: MangaLoaderContext) : PagedMangaParser(context, MangaPars override val configKeyDomain = ConfigKey.Domain("manga-ay.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/SadScans.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/SadScans.kt index a3aa7698b..8db23d582 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/SadScans.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/SadScans.kt @@ -15,8 +15,6 @@ internal class SadScans(context: MangaLoaderContext) : MangaParser(context, Mang override val availableSortOrders: Set = EnumSet.of(SortOrder.ALPHABETICAL) override val configKeyDomain = ConfigKey.Domain("sadscans.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/TrWebtoon.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/TrWebtoon.kt index 69915bcb5..a0a035b18 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/TrWebtoon.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/TrWebtoon.kt @@ -17,8 +17,6 @@ class TrWebtoon(context: MangaLoaderContext) : override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("trwebtoon.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/YaoiFlix.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/YaoiFlix.kt index 9ea6d1432..1c7226a72 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/YaoiFlix.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/tr/YaoiFlix.kt @@ -16,8 +16,6 @@ class YaoiFlix(context: MangaLoaderContext) : PagedMangaParser(context, MangaPar override val configKeyDomain = ConfigKey.Domain("www.yaoiflix.dev") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HentaiUkrParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HentaiUkrParser.kt index af73205c4..e45349a37 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HentaiUkrParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HentaiUkrParser.kt @@ -40,8 +40,6 @@ class HentaiUkrParser(context: MangaLoaderContext) : MangaParser(context, MangaP override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("hentaiukr.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HoneyMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HoneyMangaParser.kt index a998503ae..e712960a5 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HoneyMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/HoneyMangaParser.kt @@ -39,8 +39,6 @@ class HoneyMangaParser(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("honey-manga.com.ua") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/MangaInUaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/MangaInUaParser.kt index 069883fcc..9cea5b6db 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/MangaInUaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/uk/MangaInUaParser.kt @@ -24,8 +24,6 @@ class MangaInUaParser(context: MangaLoaderContext) : PagedMangaParser( override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("manga.in.ua") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenParser.kt index 87a259344..649c7c4fe 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenParser.kt @@ -1,10 +1,10 @@ package org.koitharu.kotatsu.parsers.site.vi import androidx.collection.ArrayMap +import okhttp3.Headers import org.json.JSONArray import org.jsoup.nodes.Document import org.jsoup.nodes.Element -import okhttp3.Headers import org.koitharu.kotatsu.parsers.MangaLoaderContext import org.koitharu.kotatsu.parsers.MangaSourceParser import org.koitharu.kotatsu.parsers.PagedMangaParser @@ -25,10 +25,10 @@ class BlogTruyenParser(context: MangaLoaderContext) : override val availableSortOrders: Set get() = EnumSet.of(SortOrder.UPDATED) - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("User-Agent", UserAgents.CHROME_DESKTOP) .build() - + override val isMultipleTagsSupported = false private val dateFormat = SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenVNParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenVNParser.kt index 1e7aff477..9d7ee8e65 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenVNParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/BlogTruyenVNParser.kt @@ -1,10 +1,10 @@ package org.koitharu.kotatsu.parsers.site.vi import androidx.collection.ArrayMap +import okhttp3.Headers import org.json.JSONArray import org.jsoup.nodes.Document import org.jsoup.nodes.Element -import okhttp3.Headers import org.koitharu.kotatsu.parsers.MangaLoaderContext import org.koitharu.kotatsu.parsers.MangaSourceParser import org.koitharu.kotatsu.parsers.PagedMangaParser @@ -25,10 +25,10 @@ class BlogTruyenVNParser(context: MangaLoaderContext) : override val availableSortOrders: Set get() = EnumSet.of(SortOrder.UPDATED) - override val headers: Headers = Headers.Builder() + override fun getRequestHeaders(): Headers = Headers.Builder() .add("User-Agent", UserAgents.CHROME_DESKTOP) .build() - + override val isMultipleTagsSupported = false private val dateFormat = SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt index 4f2f0790a..15ce1c336 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt @@ -22,7 +22,6 @@ private const val SEARCH_PAGE_SIZE = 10 class HentaiVNParser(context: MangaLoaderContext) : MangaParser(context, MangaParserSource.HENTAIVN) { override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("hentaiayame.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/LxManga.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/LxManga.kt index c1d23d04f..4932452f5 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/LxManga.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/LxManga.kt @@ -26,7 +26,7 @@ internal class LxManga(context: MangaLoaderContext) : PagedMangaParser(context, override val isMultipleTagsSupported = false - private val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) + override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP) override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Truyenqq.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Truyenqq.kt index 3b76d71e3..947444ad8 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Truyenqq.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Truyenqq.kt @@ -19,8 +19,6 @@ internal class Truyenqq(context: MangaLoaderContext) : PagedMangaParser(context, override val configKeyDomain = ConfigKey.Domain("truyenqqto.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/YurinekoParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/YurinekoParser.kt index d4130ead6..bc25cc128 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/YurinekoParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/YurinekoParser.kt @@ -16,8 +16,6 @@ class YurinekoParser(context: MangaLoaderContext) : PagedMangaParser(context, Ma override val configKeyDomain: ConfigKey.Domain get() = ConfigKey.Domain("yurineko.net") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt index aa1c1e99f..ec427f427 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vmp/VmpParser.kt @@ -17,8 +17,6 @@ internal abstract class VmpParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/wpcomics/WpComicsParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/wpcomics/WpComicsParser.kt index d430b26b9..e29ef1292 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/wpcomics/WpComicsParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/wpcomics/WpComicsParser.kt @@ -26,8 +26,6 @@ internal abstract class WpComicsParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) @@ -290,7 +288,7 @@ internal abstract class WpComicsParser( return when { d.endsWith(" ago") || d.endsWith(" trước") - -> parseRelativeDate(date) + -> parseRelativeDate(date) d.startsWith("year") -> Calendar.getInstance().apply { add(Calendar.DAY_OF_MONTH, -1) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zeistmanga/ZeistMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zeistmanga/ZeistMangaParser.kt index b522152ce..df66b316d 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zeistmanga/ZeistMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zeistmanga/ZeistMangaParser.kt @@ -25,8 +25,6 @@ internal abstract class ZeistMangaParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zh/Baozimh.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zh/Baozimh.kt index 5e852a27a..0467eb45a 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zh/Baozimh.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zh/Baozimh.kt @@ -23,8 +23,6 @@ internal class Baozimh(context: MangaLoaderContext) : override val configKeyDomain = ConfigKey.Domain("www.baozimh.com") - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zmanga/ZMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zmanga/ZMangaParser.kt index bbc46223e..681433cb1 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zmanga/ZMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/zmanga/ZMangaParser.kt @@ -21,8 +21,6 @@ internal abstract class ZMangaParser( override val configKeyDomain = ConfigKey.Domain(domain) - private val userAgentKey = ConfigKey.UserAgent(context.getDefaultUserAgent()) - override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) diff --git a/src/test/kotlin/org/koitharu/kotatsu/parsers/CommonHeadersInterceptor.kt b/src/test/kotlin/org/koitharu/kotatsu/parsers/CommonHeadersInterceptor.kt index d0bd4494e..f51e76cec 100644 --- a/src/test/kotlin/org/koitharu/kotatsu/parsers/CommonHeadersInterceptor.kt +++ b/src/test/kotlin/org/koitharu/kotatsu/parsers/CommonHeadersInterceptor.kt @@ -20,7 +20,7 @@ internal class CommonHeadersInterceptor : Interceptor { } else { null } - val sourceHeaders = parser?.headers + val sourceHeaders = parser?.getRequestHeaders() val headersBuilder = request.headers.newBuilder() if (sourceHeaders != null) { headersBuilder.mergeWith(sourceHeaders, replaceExisting = false)