diff --git a/multisrc/overrides/madara/hentaizm/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/madara/hentaizm/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..84d096943 Binary files /dev/null and b/multisrc/overrides/madara/hentaizm/res/mipmap-hdpi/ic_launcher.png differ diff --git a/multisrc/overrides/madara/hentaizm/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/madara/hentaizm/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..e4098e5ed Binary files /dev/null and b/multisrc/overrides/madara/hentaizm/res/mipmap-mdpi/ic_launcher.png differ diff --git a/multisrc/overrides/madara/hentaizm/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/madara/hentaizm/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..57a90381a Binary files /dev/null and b/multisrc/overrides/madara/hentaizm/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/madara/hentaizm/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/madara/hentaizm/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..a1e2b98dd Binary files /dev/null and b/multisrc/overrides/madara/hentaizm/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/madara/hentaizm/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/madara/hentaizm/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..4dc7eb3e6 Binary files /dev/null and b/multisrc/overrides/madara/hentaizm/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/madara/hentaizm/src/HentaiZM.kt b/multisrc/overrides/madara/hentaizm/src/HentaiZM.kt new file mode 100644 index 000000000..9ba18ab18 --- /dev/null +++ b/multisrc/overrides/madara/hentaizm/src/HentaiZM.kt @@ -0,0 +1,73 @@ +package eu.kanade.tachiyomi.extension.tr.hentaizm + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.asObservable +import eu.kanade.tachiyomi.source.model.MangasPage +import okhttp3.FormBody +import okhttp3.Interceptor +import okhttp3.Response +import rx.Observable + +class HentaiZM : Madara( + "HentaiZM", + "https://manga.hentaizm.fun", + "tr", +) { + override val client by lazy { + super.client.newBuilder().addInterceptor(::loginInterceptor).build() + } + + private fun loginInterceptor(chain: Interceptor.Chain): Response { + val request = chain.request() + val url = request.url.toString() + if (baseUrl !in url) { + return chain.proceed(request) + } + + val cookies = client.cookieJar.loadForRequest(request.url) + + // Only log-in when necessary. + if (cookies.any { it.name.startsWith("wordpress_logged_in_") }) { + return chain.proceed(request) + } + + // A login is required in order to load thumbnails and pages. + val body = FormBody.Builder() + .add("log", "demo") // Default user/password, provided in + .add("pwd", "demo") // the source itself. + .add("redirect_to", "$baseUrl/wp-admin/") + .add("rememberme", "forever") + .build() + + val postUrl = "$baseUrl/wp-login.php" + val headers = headersBuilder() + .set("Origin", baseUrl) + .set("Referer", postUrl) + .build() + + super.client.newCall(POST(postUrl, headers, body)).execute().close() + + return chain.proceed(request) + } + + // ============================== Popular =============================== + // Yep, asObservable instead of asObservableSuccess, because this source + // returns HTTP 404 after the first page even in the browser, while working + // perfectly. + // TODO: Replace with getPopularManga(page) when extensions-lib v1.5 gets released. + override fun fetchPopularManga(page: Int): Observable { + return client.newCall(popularMangaRequest(page)) + .asObservable() + .map(::popularMangaParse) + } + + // =============================== Latest =============================== + // Same situation as above. + // TODO: Replace with getLatestUpdates(page) when extensions-lib v1.5 gets released. + override fun fetchLatestUpdates(page: Int): Observable { + return client.newCall(latestUpdatesRequest(page)) + .asObservable() + .map(::latestUpdatesParse) + } +} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index a2a0117d2..d495c4ca7 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -143,6 +143,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("HentaiXComic", "https://hentaixcomic.com", "en", isNsfw = true), SingleLang("HentaiXDickgirl", "https://hentaixdickgirl.com", "en", isNsfw = true), SingleLang("HentaiXYuri", "https://hentaixyuri.com", "en", isNsfw = true), + SingleLang("HentaiZM", "https://manga.hentaizm.fun", "tr", isNsfw = true), SingleLang("HentaiZone", "https://hentaizone.xyz", "fr", isNsfw = true, overrideVersionCode = 1), SingleLang("HerenScan", "https://herenscan.com", "es"), SingleLang("HipercooL", "https://hipercool.xyz", "pt-BR", isNsfw = true, className = "Hipercool"),