mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2025-01-12 00:39:07 +01:00
fix chapters not being loaded correctly
This commit is contained in:
parent
9e649eef79
commit
1802271358
@ -28,10 +28,16 @@ fun getTrueImageUrl(page: Page, source: HttpSource): String {
|
|||||||
return page.imageUrl!!
|
return page.imageUrl!!
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPageImage(mangaId: Int, chapterId: Int, index: Int): Pair<InputStream, String> {
|
fun getPageImage(mangaId: Int, chapterIndex: Int, index: Int): Pair<InputStream, String> {
|
||||||
val mangaEntry = transaction { MangaTable.select { MangaTable.id eq mangaId }.firstOrNull()!! }
|
val mangaEntry = transaction { MangaTable.select { MangaTable.id eq mangaId }.firstOrNull()!! }
|
||||||
val source = getHttpSource(mangaEntry[MangaTable.sourceReference])
|
val source = getHttpSource(mangaEntry[MangaTable.sourceReference])
|
||||||
val chapterEntry = transaction { ChapterTable.select { ChapterTable.id eq chapterId }.firstOrNull()!! }
|
val chapterEntry = transaction {
|
||||||
|
ChapterTable.select {
|
||||||
|
(ChapterTable.chapterIndex eq chapterIndex) and (ChapterTable.manga eq mangaId)
|
||||||
|
}.firstOrNull()!!
|
||||||
|
}
|
||||||
|
val chapterId = chapterEntry[ChapterTable.id].value
|
||||||
|
|
||||||
val pageEntry = transaction { PageTable.select { (PageTable.chapter eq chapterId) and (PageTable.index eq index) }.firstOrNull()!! }
|
val pageEntry = transaction { PageTable.select { (PageTable.chapter eq chapterId) and (PageTable.index eq index) }.firstOrNull()!! }
|
||||||
|
|
||||||
val tachiPage = Page(
|
val tachiPage = Page(
|
||||||
|
@ -60,7 +60,8 @@ fun javalinSetup() {
|
|||||||
openInBrowser()
|
openInBrowser()
|
||||||
}
|
}
|
||||||
|
|
||||||
app.exception(NullPointerException::class.java) { _, ctx ->
|
app.exception(NullPointerException::class.java) { e, ctx ->
|
||||||
|
logger.error("NullPointerException while handling the request", e)
|
||||||
ctx.status(404)
|
ctx.status(404)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,11 +180,11 @@ fun javalinSetup() {
|
|||||||
ctx.json(getChapter(chapterIndex, mangaId))
|
ctx.json(getChapter(chapterIndex, mangaId))
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get("/api/v1/manga/:mangaId/chapter/:chapterId/page/:index") { ctx ->
|
app.get("/api/v1/manga/:mangaId/chapter/:chapterIndex/page/:index") { ctx ->
|
||||||
val chapterId = ctx.pathParam("chapterId").toInt()
|
|
||||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
val mangaId = ctx.pathParam("mangaId").toInt()
|
||||||
|
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
||||||
val index = ctx.pathParam("index").toInt()
|
val index = ctx.pathParam("index").toInt()
|
||||||
val result = getPageImage(mangaId, chapterId, index)
|
val result = getPageImage(mangaId, chapterIndex, index)
|
||||||
|
|
||||||
ctx.result(result.first)
|
ctx.result(result.first)
|
||||||
ctx.header("content-type", result.second)
|
ctx.header("content-type", result.second)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user