Kagane: Fix search and chapters index (#11011)
* fix search and chapters index * bump * Update src/en/kagane/src/eu/kanade/tachiyomi/extension/en/kagane/Kagane.kt Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> --------- Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
parent
b838d8b34b
commit
f5bc644071
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'Kagane'
|
extName = 'Kagane'
|
||||||
extClass = '.Kagane'
|
extClass = '.Kagane'
|
||||||
extVersionCode = 5
|
extVersionCode = 6
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -84,10 +84,11 @@ class ChapterDto(
|
|||||||
@SerialName("pages_count")
|
@SerialName("pages_count")
|
||||||
val pagesCount: Int,
|
val pagesCount: Int,
|
||||||
) {
|
) {
|
||||||
fun toSChapter(): SChapter = SChapter.create().apply {
|
fun toSChapter(index: Int): SChapter = SChapter.create().apply {
|
||||||
url = "$seriesId;$id;$pagesCount"
|
url = "$seriesId;$id;$pagesCount"
|
||||||
name = title
|
name = title
|
||||||
date_upload = dateFormat.tryParse(releaseDate)
|
date_upload = dateFormat.tryParse(releaseDate)
|
||||||
|
chapter_number = index.toFloat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,9 @@ class Kagane : HttpSource(), ConfigurableSource {
|
|||||||
|
|
||||||
// ============================== Popular ===============================
|
// ============================== Popular ===============================
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int) = searchMangaRequest(page, "", FilterList(SortFilter(0)))
|
override fun popularMangaRequest(page: Int) =
|
||||||
|
searchMangaRequest(page, "", FilterList(SortFilter(1)))
|
||||||
|
|
||||||
override fun popularMangaParse(response: Response) = searchMangaParse(response)
|
override fun popularMangaParse(response: Response) = searchMangaParse(response)
|
||||||
|
|
||||||
// =============================== Latest ===============================
|
// =============================== Latest ===============================
|
||||||
@ -203,7 +205,7 @@ class Kagane : HttpSource(), ConfigurableSource {
|
|||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val dto = response.parseAs<ChapterDto>()
|
val dto = response.parseAs<ChapterDto>()
|
||||||
return dto.content.map { it.toSChapter() }.reversed()
|
return dto.content.mapIndexed { i, it -> it.toSChapter(i + 1) }.reversed()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun chapterListRequest(manga: SManga): Request {
|
override fun chapterListRequest(manga: SManga): Request {
|
||||||
@ -351,11 +353,12 @@ class Kagane : HttpSource(), ConfigurableSource {
|
|||||||
throw Exception("Failed to get drm challenge")
|
throw Exception("Failed to get drm challenge")
|
||||||
}
|
}
|
||||||
|
|
||||||
val challengeUrl = "$apiUrl/api/v1/books/$seriesId/file/$chapterId".toHttpUrl().newBuilder().apply {
|
val challengeUrl =
|
||||||
if (preferences.dataSaver) {
|
"$apiUrl/api/v1/books/$seriesId/file/$chapterId".toHttpUrl().newBuilder().apply {
|
||||||
addQueryParameter("datasaver", true.toString())
|
if (preferences.dataSaver) {
|
||||||
}
|
addQueryParameter("datasaver", true.toString())
|
||||||
}.build()
|
}
|
||||||
|
}.build()
|
||||||
val challengeBody = buildJsonObject {
|
val challengeBody = buildJsonObject {
|
||||||
put("challenge", jsInterface.challenge)
|
put("challenge", jsInterface.challenge)
|
||||||
}.toJsonString().toRequestBody("application/json".toMediaType())
|
}.toJsonString().toRequestBody("application/json".toMediaType())
|
||||||
@ -441,7 +444,8 @@ class Kagane : HttpSource(), ConfigurableSource {
|
|||||||
class SortFilter(state: Int = 0) : UriPartFilter(
|
class SortFilter(state: Int = 0) : UriPartFilter(
|
||||||
"Sort By",
|
"Sort By",
|
||||||
arrayOf(
|
arrayOf(
|
||||||
Pair("Relevance", "avg_views,desc"),
|
Pair("Relevance", ""),
|
||||||
|
Pair("Popular", "avg_views,desc"),
|
||||||
Pair("Latest", "updated_at"),
|
Pair("Latest", "updated_at"),
|
||||||
Pair("Latest Descending", "updated_at,desc"),
|
Pair("Latest Descending", "updated_at,desc"),
|
||||||
Pair("By Name", "series_name"),
|
Pair("By Name", "series_name"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user