Fix inconsistent json in Nekopost (#10336)

This commit is contained in:
Vetle Ledaal 2022-01-04 19:56:30 +00:00 committed by GitHub
parent 5dd0d2b891
commit c31fc35000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Nekopost'
pkgNameSuffix = 'th.nekopost'
extClass = '.Nekopost'
extVersionCode = 6
extVersionCode = 7
isNsfw = true
}

View File

@ -141,9 +141,10 @@ class Nekopost : ParsedHttpSource() {
val chapterInfo: RawChapterInfo = json.decodeFromString(responseBody.string())
chapterInfo.pageItem.map { page ->
val fileName = page.fileName ?: page.pageName
Page(
index = page.pageNo,
imageUrl = "$fileHost/collectManga/${chapterInfo.projectId}/${chapterInfo.chapterId}/${page.fileName}",
imageUrl = "$fileHost/collectManga/${chapterInfo.projectId}/${chapterInfo.chapterId}/$fileName",
)
}
}

View File

@ -4,7 +4,10 @@ import kotlinx.serialization.Serializable
@Serializable
data class RawPageItem(
val fileName: String,
val id: Int? = null,
// workaround for https://github.com/Kotlin/kotlinx.serialization/pull/1473
val fileName: String? = null,
val pageName: String? = null,
val height: Int,
val pageNo: Int,
val width: Int