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 51333a0a..7de7f70e 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 4b29a8d8..1d4e5520 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 75b94ccf..28871b2a 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 06577031..89a08531 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 cb3481d9..3f8863fb 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 3fa311ea..27f2ee3e 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 931c8864..d0260a42 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 26f08d9e..ff33c2f3 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 939a4301..0d3b1665 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 abbed05c..158b4418 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 6c00a531..69a15811 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 46db4080..2d7c85c6 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 4f57f04b..7de52d1c 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 901ef83d..c3f155e3 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 a39ba8fd..93ec230f 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 3d5020b6..67a28410 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 ec182823..1f84bddc 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 c0c14454..9eea168f 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 ae8856cc..9ef6ab20 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 37afaf0f..89c24638 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 8d2114e6..05734d3a 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 c432096a..3c364c07 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 8ac8bbc9..d33473ef 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 0ba26476..fc373e93 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 4383ee07..af06d6be 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 3bbbf032..d7a42055 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 807a630f..94b988ff 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 80b332a5..2a7aa0cb 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 e7aeaebf..9c849dc9 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 c24c858c..612114b5 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 90d17006..92b3ea3c 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 284948c1..1e43bce2 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 0a65d952..da308af1 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 8f62f42f..90e478fa 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 66e6686a..4d141636 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 d5c3db3c..2312ff8f 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 459ecc3f..013e73f1 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 3252921f..c97b774e 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 5dd90f92..f9b3ee0c 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 3f2ab384..1d20bf56 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 b4225404..c7d25ff8 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 9c257a2a..6d50790f 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 e04c7c3e..57ac1c51 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 6b113bee..4f4a4e12 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 65cc3419..a773597e 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 adfa161e..faba6a93 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 d54f93b0..87e15c21 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 cdb226d6..482bed09 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 41f07780..4149a8c4 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 f32404e5..faf1bd26 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 9edfb7c9..8ea0f31d 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 7d857f25..e3152db4 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 c7f00765..a507a961 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 62bd0442..675d75f2 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 3927aa2e..3ec1f299 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 81f3ee1d..460c52fd 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 9ef27f8b..1dc40e26 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 40940993..22f5ded2 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 bd15d06f..4980ad64 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 9076a2a8..bf4fc712 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 9c0f3f0b..0d5e422c 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 e5f08ddc..a82fdf34 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 21b764d2..8ea7aae5 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 14becf6e..2cb19902 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 58e37bc2..b273174d 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 46a06c16..81c4d9b8 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 db7447ac..9d7a98f2 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 09f48768..f3b96354 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 0110308b..ce987662 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 2e7eb86a..7dd28686 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 6997ba54..1c137a78 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 66edf2cb..cdc0b2b7 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 d95324b6..ca852782 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 65cd6e1d..883dfe25 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 96107b49..c2b71bbd 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 df727c92..241a5262 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 4e2ebd63..d39dc3d9 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 2be647a9..f28e6665 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 ce1f326f..4abefa32 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 70c73063..fadcbe0f 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 b1a1a184..0b69c8eb 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 9552f353..7985c9b4 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 eda45976..3dd0902e 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 a43f4100..f314a167 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 3e75d2ec..92133213 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 70d34bac..811067c0 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 7ccb441e..51889727 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 b1673cda..5f077daa 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 c6ae3d20..520ecc8d 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 46c9233d..5849423b 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 a3aa7698..8db23d58 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 69915bcb..a0a035b1 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 9ea6d143..1c7226a7 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 af73205c..e45349a3 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 a998503a..e712960a 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 069883fc..9cea5b6d 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 87a25934..649c7c4f 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 1e7aff47..9d7ee8e6 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 4f2f0790..15ce1c33 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 c1d23d04..4932452f 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 3b76d71e..947444ad 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 d4130ead..bc25cc12 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 aa1c1e99..ec427f42 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 d430b26b..e29ef129 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 b522152c..df66b316 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 5e852a27..0467eb45 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 bbc46223..681433cb 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 d0bd4494..f51e76ce 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)