diff --git a/multisrc/overrides/flixscans/flixscans/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/flixscans/flixscans/res/mipmap-hdpi/ic_launcher.png index 96992a185..2e1b076a3 100644 Binary files a/multisrc/overrides/flixscans/flixscans/res/mipmap-hdpi/ic_launcher.png and b/multisrc/overrides/flixscans/flixscans/res/mipmap-hdpi/ic_launcher.png differ diff --git a/multisrc/overrides/flixscans/flixscans/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/flixscans/flixscans/res/mipmap-mdpi/ic_launcher.png index bf4daa417..5964e5f77 100644 Binary files a/multisrc/overrides/flixscans/flixscans/res/mipmap-mdpi/ic_launcher.png and b/multisrc/overrides/flixscans/flixscans/res/mipmap-mdpi/ic_launcher.png differ diff --git a/multisrc/overrides/flixscans/flixscans/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/flixscans/flixscans/res/mipmap-xhdpi/ic_launcher.png index 8beccb9bc..477a1a146 100644 Binary files a/multisrc/overrides/flixscans/flixscans/res/mipmap-xhdpi/ic_launcher.png and b/multisrc/overrides/flixscans/flixscans/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/flixscans/flixscans/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/flixscans/flixscans/res/mipmap-xxhdpi/ic_launcher.png index d09cf7a56..937b9daa6 100644 Binary files a/multisrc/overrides/flixscans/flixscans/res/mipmap-xxhdpi/ic_launcher.png and b/multisrc/overrides/flixscans/flixscans/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/flixscans/flixscans/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/flixscans/flixscans/res/mipmap-xxxhdpi/ic_launcher.png index 9067ecd9c..4175a36e0 100644 Binary files a/multisrc/overrides/flixscans/flixscans/res/mipmap-xxxhdpi/ic_launcher.png and b/multisrc/overrides/flixscans/flixscans/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/flixscans/flixscans/src/FlixScansNet.kt b/multisrc/overrides/flixscans/flixscans/src/FlixScansNet.kt deleted file mode 100644 index 9fbdbdb85..000000000 --- a/multisrc/overrides/flixscans/flixscans/src/FlixScansNet.kt +++ /dev/null @@ -1,5 +0,0 @@ -package eu.kanade.tachiyomi.extension.en.flixscans - -import eu.kanade.tachiyomi.multisrc.flixscans.FlixScans - -class FlixScansNet : FlixScans("Flix Scans", "https://flixscans.org", "en", cdnUrl = "https://media.flixscans.org/") diff --git a/multisrc/overrides/flixscans/galaxymanga/src/GalaxyManga.kt b/multisrc/overrides/flixscans/galaxymanga/src/GalaxyManga.kt index b121b0117..ea536d9ad 100644 --- a/multisrc/overrides/flixscans/galaxymanga/src/GalaxyManga.kt +++ b/multisrc/overrides/flixscans/galaxymanga/src/GalaxyManga.kt @@ -1,13 +1,7 @@ package eu.kanade.tachiyomi.extension.ar.galaxymanga import eu.kanade.tachiyomi.multisrc.flixscans.FlixScans -import eu.kanade.tachiyomi.network.GET -import okhttp3.Request class GalaxyManga : FlixScans("جالاكسي مانجا", "https://flixscans.com", "ar") { override val versionId = 2 - - override fun popularMangaRequest(page: Int): Request { - return GET("$apiUrl/webtoon/pages/home/action", headers) - } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScans.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScans.kt index d282fbfae..10d878b38 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScans.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScans.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.multisrc.flixscans import android.util.Log -import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter @@ -16,7 +15,6 @@ import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import okhttp3.Call import okhttp3.Callback -import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.RequestBody.Companion.toRequestBody @@ -28,8 +26,8 @@ abstract class FlixScans( override val name: String, override val baseUrl: String, override val lang: String, - protected val apiUrl: String = baseUrl.replace("://", "://api.").plus("/api/v1"), - protected val cdnUrl: String = baseUrl.replace("://", "://api.").plus("/storage/"), + protected val apiUrl: String = "$baseUrl/api/__api_party/noxApi", + protected val cdnUrl: String = baseUrl.replace("://", "://media.").plus("/"), ) : HttpSource() { override val supportsLatest = true @@ -43,6 +41,12 @@ abstract class FlixScans( override fun headersBuilder() = super.headersBuilder() .add("Referer", baseUrl) + protected open fun postPath(path: String): Request { + val payload = """{"path":"$path","headers":{}}""".toRequestBody(JSON_MEDIA_TYPE) + + return POST(apiUrl, headers, payload) + } + override fun fetchPopularManga(page: Int): Observable { runCatching { fetchGenre() } @@ -50,7 +54,7 @@ abstract class FlixScans( } override fun popularMangaRequest(page: Int): Request { - return GET("$apiUrl/webtoon/homepage/home", headers) + return postPath("webtoon/pages/home/romance") } override fun popularMangaParse(response: Response): MangasPage { @@ -70,16 +74,14 @@ abstract class FlixScans( } override fun latestUpdatesRequest(page: Int): Request { - return GET("$apiUrl/search/advance?page=$page&serie_type=webtoon", headers) + return postPath("search/advance?page=$page&serie_type=webtoon") } override fun latestUpdatesParse(response: Response): MangasPage { val result = response.parseAs>() - val currentPage = response.request.url.queryParameter("page") - ?.toIntOrNull() ?: 1 val entries = result.data.map { it.toSManga(cdnUrl) } - val hasNextPage = result.meta.lastPage > currentPage + val hasNextPage = result.meta.lastPage > result.meta.currentPage return MangasPage(entries, hasNextPage) } @@ -131,7 +133,7 @@ abstract class FlixScans( } private fun fetchGenreRequest(): Request { - return GET("$apiUrl/search/genres", headers) + return postPath("search/genres") } private fun fetchGenreParse(response: Response): List { @@ -168,53 +170,55 @@ abstract class FlixScans( override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { if (query.isNotEmpty()) { - val requestBody = SearchInput(query.trim()) + val searchBody = SearchInput(query.trim()) .let(json::encodeToString) - .toRequestBody(JSON_MEDIA_TYPE) + .replace("\"", "\\\"") - val newHeaders = headersBuilder() - .add("Content-Length", requestBody.contentLength().toString()) - .add("Content-Type", requestBody.contentType().toString()) - .build() + val requestBody = """{ + |"path":"search/serie?page=$page", + |"headers":{"Content-type":"application/json"}, + |"method":"POST","body":"$searchBody" + |} + """.trimMargin().toRequestBody(JSON_MEDIA_TYPE) - return POST("$apiUrl/search/serie?page=$page", newHeaders, requestBody) + return POST(apiUrl, headers, requestBody) } - val advSearchUrl = apiUrl.toHttpUrl().newBuilder().apply { - addPathSegments("search/advance") - addQueryParameter("page", page.toString()) - addQueryParameter("serie_type", "webtoon") + val advSearchBody = buildString { + append("search/advance") + append("?page=", page) + append("&serie_type=webtoon") filters.forEach { filter -> when (filter) { is GenreFilter -> { filter.checked.let { if (it.isNotEmpty()) { - addQueryParameter("genres", it.joinToString(",")) + append("&genres=", it.joinToString(",")) } } } is MainGenreFilter -> { if (filter.state > 0) { - addQueryParameter("main_genres", filter.selected) + append("&main_genres=", filter.selected) } } is TypeFilter -> { if (filter.state > 0) { - addQueryParameter("type", filter.selected) + append("&type=", filter.selected) } } is StatusFilter -> { if (filter.state > 0) { - addQueryParameter("status", filter.selected) + append("&status=", filter.selected) } } else -> {} } } - }.build() + } - return GET(advSearchUrl, headers) + return postPath(advSearchBody) } override fun searchMangaParse(response: Response) = latestUpdatesParse(response) @@ -222,7 +226,7 @@ abstract class FlixScans( override fun mangaDetailsRequest(manga: SManga): Request { val id = manga.url.split("-")[1] - return GET("$apiUrl/webtoon/series/$id", headers) + return postPath("webtoon/series/$id") } override fun getMangaUrl(manga: SManga) = baseUrl + manga.url @@ -236,7 +240,7 @@ abstract class FlixScans( override fun chapterListRequest(manga: SManga): Request { val id = manga.url.split("-")[1] - return GET("$apiUrl/webtoon/chapters/$id-desc", headers) + return postPath("webtoon/chapters/$id-desc") } override fun chapterListParse(response: Response): List { @@ -250,7 +254,7 @@ abstract class FlixScans( .substringAfterLast("/") .substringBefore("-") - return GET("$apiUrl/webtoon/chapters/chapter/$id", headers) + return postPath("webtoon/chapters/chapter/$id") } override fun getChapterUrl(chapter: SChapter) = baseUrl + chapter.url @@ -269,6 +273,6 @@ abstract class FlixScans( use { body.string() }.let(json::decodeFromString) companion object { - private val JSON_MEDIA_TYPE = "application/json; charset=utf-8".toMediaTypeOrNull() + private val JSON_MEDIA_TYPE = "application/json".toMediaTypeOrNull() } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansDto.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansDto.kt index 637841a38..9578e1f3a 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansDto.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansDto.kt @@ -17,6 +17,7 @@ data class ApiResponse( @Serializable data class PageInfo( @SerialName("last_page") val lastPage: Int, + @SerialName("current_page") val currentPage: Int, ) @Serializable diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansGenerator.kt index 3a9368cad..85e1a3ed4 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/flixscans/FlixScansGenerator.kt @@ -9,7 +9,7 @@ class FlixScansGenerator : ThemeSourceGenerator { override val themeClass = "FlixScans" - override val baseVersionCode: Int = 3 + override val baseVersionCode: Int = 4 override val sources = listOf( SingleLang("Flix Scans", "https://flixscans.org", "en", className = "FlixScansNet", pkgName = "flixscans"),