mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2025-01-11 16:29:08 +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!!
|
||||
}
|
||||
|
||||
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 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 tachiPage = Page(
|
||||
|
@ -60,7 +60,8 @@ fun javalinSetup() {
|
||||
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)
|
||||
}
|
||||
|
||||
@ -179,11 +180,11 @@ fun javalinSetup() {
|
||||
ctx.json(getChapter(chapterIndex, mangaId))
|
||||
}
|
||||
|
||||
app.get("/api/v1/manga/:mangaId/chapter/:chapterId/page/:index") { ctx ->
|
||||
val chapterId = ctx.pathParam("chapterId").toInt()
|
||||
app.get("/api/v1/manga/:mangaId/chapter/:chapterIndex/page/:index") { ctx ->
|
||||
val mangaId = ctx.pathParam("mangaId").toInt()
|
||||
val chapterIndex = ctx.pathParam("chapterIndex").toInt()
|
||||
val index = ctx.pathParam("index").toInt()
|
||||
val result = getPageImage(mangaId, chapterId, index)
|
||||
val result = getPageImage(mangaId, chapterIndex, index)
|
||||
|
||||
ctx.result(result.first)
|
||||
ctx.header("content-type", result.second)
|
||||
|
@ -40,7 +40,7 @@ val androidCompat by lazy { AndroidCompat() }
|
||||
fun applicationSetup() {
|
||||
// register server config
|
||||
GlobalConfigManager.registerModule(
|
||||
ServerConfig.register(GlobalConfigManager.config)
|
||||
ServerConfig.register(GlobalConfigManager.config)
|
||||
)
|
||||
|
||||
// set application wide logging level
|
||||
@ -50,10 +50,10 @@ fun applicationSetup() {
|
||||
|
||||
// make dirs we need
|
||||
listOf(
|
||||
applicationDirs.dataRoot,
|
||||
applicationDirs.extensionsRoot,
|
||||
"${applicationDirs.extensionsRoot}/icon",
|
||||
applicationDirs.thumbnailsRoot
|
||||
applicationDirs.dataRoot,
|
||||
applicationDirs.extensionsRoot,
|
||||
"${applicationDirs.extensionsRoot}/icon",
|
||||
applicationDirs.thumbnailsRoot
|
||||
).forEach {
|
||||
File(it).mkdirs()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user