NHentai | Fixed "Pages" & "Uploaded" Filters (#4678)

Fixed "Pages" & "Uploaded" Filters

- Also removed "isOkayToSort" because I think it's useless... ( might be wrong? )
This commit is contained in:
KenjieDec 2024-08-19 16:27:55 +07:00 committed by GitHub
parent ce452d0bbe
commit df2ce43cec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'NHentai'
extClass = '.NHFactory'
extVersionCode = 45
extVersionCode = 46
isNsfw = true
}

View File

@ -140,7 +140,6 @@ open class NHentai(
val nhLangSearch = if (nhLang.isBlank()) "" else "language:$nhLang "
val advQuery = combineQuery(filterList)
val favoriteFilter = filterList.findInstance<FavoriteFilter>()
val isOkayToSort = filterList.findInstance<UploadedFilter>()?.state?.isBlank() ?: true
val offsetPage =
filterList.findInstance<OffsetPageFilter>()?.state?.toIntOrNull()?.plus(page) ?: page
@ -157,10 +156,8 @@ open class NHentai(
.addQueryParameter("q", "$query $nhLangSearch$advQuery".ifBlank { "\"\"" })
.addQueryParameter("page", offsetPage.toString())
if (isOkayToSort) {
filterList.findInstance<SortFilter>()?.let { f ->
url.addQueryParameter("sort", f.toUriPart())
}
filterList.findInstance<SortFilter>()?.let { f ->
url.addQueryParameter("sort", f.toUriPart())
}
return GET(url.build(), headers)
@ -173,8 +170,13 @@ open class NHentai(
.map(String::trim)
.filterNot(String::isBlank)
.forEach { tag ->
val y = !(filter.name == "Pages" || filter.name == "Uploaded")
if (tag.startsWith("-")) append("-")
append(filter.name, ":\"", tag.removePrefix("-"), "\" ")
append(filter.name, ':')
if (y) append('"')
append(tag.removePrefix("-"))
if (y) append('"')
append(" ")
}
}
}