Fix Kavita search pagination
Some checks failed
CI / Prepare job (push) Has been cancelled
CI / Build extensions (${{ matrix.chunk.number }}) (push) Has been cancelled
CI / Publish extension repo (push) Has been cancelled
Create Release on Merge / release (push) Has been cancelled

This commit is contained in:
2026-05-24 11:45:25 +09:00
parent 2ddbcc9fe5
commit f0de3aaea3
3 changed files with 6 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ ext {
kmkVersionCode = 1
extName = 'Kavita'
extClass = '.KavitaFactory'
extVersionCode = 33
extVersionCode = 34
isNsfw = false
}

View File

@@ -2030,7 +2030,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
}
val mangaList = filteredSeries.map { helper.createSeriesDto(it, apiUrl, apiKey) }
MangasPage(mangaList, false)
MangasPage(mangaList, helper.hasNextPage(response, result.size))
} catch (e: Exception) {
Log.e(LOG_TAG, "Error parsing search results", e)
throw IOException(intl["check_version"], e)

View File

@@ -45,14 +45,14 @@ class KavitaHelper {
val seriesMap = SeriesMapper()
fun hasNextPage(response: Response): Boolean {
fun hasNextPage(response: Response, itemCount: Int? = null, pageSize: Int = 20): Boolean {
val paginationHeader = response.header("Pagination")
var hasNextPage = false
if (!paginationHeader.isNullOrEmpty()) {
val paginationInfo = json.decodeFromString<PaginationInfo>(paginationHeader)
hasNextPage = paginationInfo.currentPage < paginationInfo.totalPages
return paginationInfo.currentPage < paginationInfo.totalPages
}
return hasNextPage
return itemCount != null && itemCount >= pageSize
}
fun getIdFromUrl(url: String): Int {