Fix for when a request requests page 1 (#14323)

* Fix for #14276

* increase versionCode

* fixed issue with requests going to page 1

Co-authored-by: Alec <alec.l@digipen.edu>
This commit is contained in:
Ritox2 2022-11-20 12:57:47 -08:00 committed by GitHub
parent f2198c975e
commit 1cefaf0867
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'E-Hentai'
pkgNameSuffix = 'all.ehentai'
extClass = '.EHFactory'
extVersionCode = 18
extVersionCode = 19
isNsfw = true
}

View File

@ -171,6 +171,7 @@ abstract class EHentai(
if (uri.toString().contains("f_spf") || uri.toString().contains("f_spt")) {
if (page > 1) uri.appendQueryParameter("from", lastMangaId)
}
return exGet(uri.toString(), page)
}
@ -181,8 +182,10 @@ abstract class EHentai(
override fun latestUpdatesParse(response: Response) = genericMangaParse(response)
private fun exGet(url: String, page: Int? = null, additionalHeaders: Headers? = null, cache: Boolean = true): Request {
//pages no longer exist, if app attempts to go to the first page after a request, do not include the page append
val pageIndex = if (page == 1) null else page
return GET(
page?.let {
pageIndex?.let {
addParam(url, "next", lastMangaId)
} ?: url,
additionalHeaders?.let { header ->
@ -194,6 +197,7 @@ abstract class EHentai(
}
headers.build()
} ?: headers
).let {
if (!cache) {
it.newBuilder().cacheControl(CacheControl.FORCE_NETWORK).build()