mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-10 14:24:34 -05:00
Add support for opds-pse for undownloaded chapters (#1278)
* Add OPDS page streaming for undownloaded chapters * Add [D] in chapter title prefix when isDownloaded * Removed Chapter.isDownloaded check in query for other opds endpoints * Add chapter progression tracking for streaming and refactor code * dd ❌ Unicode for chapters with 0 pages [post pageRefresh] * Add Library Updates feed and remove redundant metadata fetching for OPDS chapters and manga * Address PR comments & add chapter markAsRead for cbzDownload * Address PR comment/s * Rem. markAsRead for chapter download * Rem. markAsRead for chapter download --------- Co-authored-by: ShowY <showypro@gmail.com>
This commit is contained in:
@@ -401,6 +401,7 @@ object MangaController {
|
||||
pathParam<Int>("mangaId"),
|
||||
pathParam<Int>("chapterIndex"),
|
||||
pathParam<Int>("index"),
|
||||
queryParam<Boolean?>("updateProgress"),
|
||||
documentWith = {
|
||||
withOperation {
|
||||
summary("Get a chapter page")
|
||||
@@ -409,14 +410,18 @@ object MangaController {
|
||||
)
|
||||
}
|
||||
},
|
||||
behaviorOf = { ctx, mangaId, chapterIndex, index ->
|
||||
behaviorOf = { ctx, mangaId, chapterIndex, index, updateProgress ->
|
||||
ctx.future {
|
||||
future { Page.getPageImage(mangaId, chapterIndex, index) }
|
||||
future { Page.getPageImage(mangaId, chapterIndex, index, null) }
|
||||
.thenApply {
|
||||
ctx.header("content-type", it.second)
|
||||
val httpCacheSeconds = 1.days.inWholeSeconds
|
||||
ctx.header("cache-control", "max-age=$httpCacheSeconds")
|
||||
ctx.result(it.first)
|
||||
|
||||
if (updateProgress == true) {
|
||||
Chapter.updateChapterProgress(mangaId, chapterIndex, pageNo = index)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -437,10 +442,11 @@ object MangaController {
|
||||
},
|
||||
behaviorOf = { ctx, chapterId ->
|
||||
ctx.future {
|
||||
future { ChapterDownloadHelper.getCbzDownload(chapterId) }
|
||||
.thenApply { (inputStream, contentType, fileName) ->
|
||||
ctx.header("Content-Type", contentType)
|
||||
future { ChapterDownloadHelper.getCbzForDownload(chapterId) }
|
||||
.thenApply { (inputStream, fileName, fileSize) ->
|
||||
ctx.header("Content-Type", "application/vnd.comicbook+zip")
|
||||
ctx.header("Content-Disposition", "attachment; filename=\"$fileName\"")
|
||||
ctx.header("Content-Length", fileSize.toString())
|
||||
ctx.result(inputStream)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user