Iken: add filter to only show accessible chapters (#6155)
This commit is contained in:
parent
e69b2141e8
commit
2e4c3010c0
|
@ -2,4 +2,4 @@ plugins {
|
||||||
id("lib-multisrc")
|
id("lib-multisrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
baseVersionCode = 4
|
baseVersionCode = 5
|
||||||
|
|
|
@ -96,10 +96,13 @@ class Chapter(
|
||||||
private val createdBy: Name,
|
private val createdBy: Name,
|
||||||
private val createdAt: String,
|
private val createdAt: String,
|
||||||
private val chapterStatus: String,
|
private val chapterStatus: String,
|
||||||
|
private val isAccessible: Boolean,
|
||||||
private val mangaPost: ChapterPostDetails,
|
private val mangaPost: ChapterPostDetails,
|
||||||
) {
|
) {
|
||||||
fun isPublic() = chapterStatus == "PUBLIC"
|
fun isPublic() = chapterStatus == "PUBLIC"
|
||||||
|
|
||||||
|
fun isAccessible() = isAccessible
|
||||||
|
|
||||||
fun toSChapter(mangaSlug: String?) = SChapter.create().apply {
|
fun toSChapter(mangaSlug: String?) = SChapter.create().apply {
|
||||||
val seriesSlug = mangaSlug ?: mangaPost.slug
|
val seriesSlug = mangaSlug ?: mangaPost.slug
|
||||||
url = "/series/$seriesSlug/$slug#$id"
|
url = "/series/$seriesSlug/$slug#$id"
|
||||||
|
|
|
@ -128,7 +128,7 @@ abstract class Iken(
|
||||||
assert(!data.post.isNovel) { "Novels are unsupported" }
|
assert(!data.post.isNovel) { "Novels are unsupported" }
|
||||||
|
|
||||||
return data.post.chapters
|
return data.post.chapters
|
||||||
.filter { it.isPublic() }
|
.filter { it.isPublic() && it.isAccessible() }
|
||||||
.map { it.toSChapter(data.post.slug) }
|
.map { it.toSChapter(data.post.slug) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue