Iken: add filter to only show accessible chapters (#6155)

This commit is contained in:
dngonz 2024-11-19 15:55:00 +01:00 committed by Draff
parent e69b2141e8
commit 2e4c3010c0
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 5 additions and 2 deletions

View File

@ -2,4 +2,4 @@ plugins {
id("lib-multisrc") id("lib-multisrc")
} }
baseVersionCode = 4 baseVersionCode = 5

View File

@ -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"

View File

@ -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) }
} }