From f9566c55e47c1c6e97164baa7c6ec0d30f938746 Mon Sep 17 00:00:00 2001 From: Vetle Ledaal Date: Sat, 30 Nov 2024 18:57:51 +0100 Subject: [PATCH] Flame Comics: use friendly URL for latest tab (#6402) --- .../extension/en/flamecomics/FlameComics.kt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/en/flamecomics/src/eu/kanade/tachiyomi/extension/en/flamecomics/FlameComics.kt b/src/en/flamecomics/src/eu/kanade/tachiyomi/extension/en/flamecomics/FlameComics.kt index e62b66208..f1be321c5 100644 --- a/src/en/flamecomics/src/eu/kanade/tachiyomi/extension/en/flamecomics/FlameComics.kt +++ b/src/en/flamecomics/src/eu/kanade/tachiyomi/extension/en/flamecomics/FlameComics.kt @@ -107,12 +107,9 @@ class FlameComics : HttpSource() { SManga.create().apply { title = seriesData.title setUrlWithoutDomain( - dataApiReqBuilder().apply { - val seriesID = - seriesData.series_id + baseUrl.toHttpUrl().newBuilder().apply { addPathSegment("series") - addPathSegment("$seriesID.json") - addQueryParameter("id", seriesData.series_id.toString()) + addPathSegment(seriesData.series_id.toString()) }.build().toString(), ) thumbnail_url = imageApiUrlBuilder( @@ -164,12 +161,11 @@ class FlameComics : HttpSource() { ) } } - var lastPage = page * 20 - if (lastPage > manga.size) { - lastPage = manga.size - } - if (lastPage < 0) lastPage = 0 - return MangasPage(manga.subList((page - 1) * 20, lastPage), lastPage < manga.size) + + val itemsPerPage = 20 + val startIndex = (page - 1) * itemsPerPage + val endIndex = minOf(page * itemsPerPage, manga.size) + return MangasPage(manga.subList(startIndex, endIndex), endIndex < manga.size) } override fun mangaDetailsRequest(manga: SManga): Request = GET(