Optionally allow basic auth fallback for chapter page endpoint (#1757)

Requesting a chapter page while having a non basic auth mode (e.g. ui login) enabled caused the basic auth prompt.
However, this is only supposed to be happen for opds
This commit is contained in:
schroda
2025-11-01 19:31:01 +01:00
committed by GitHub
parent fb41ad38f6
commit 53c4659044
2 changed files with 9 additions and 3 deletions

View File

@@ -457,6 +457,7 @@ object MangaController {
pathParam<Int>("index"), pathParam<Int>("index"),
queryParam<Boolean?>("updateProgress"), queryParam<Boolean?>("updateProgress"),
queryParam<String?>("format"), queryParam<String?>("format"),
queryParam<Boolean?>("opds"),
documentWith = { documentWith = {
withOperation { withOperation {
summary("Get a chapter page") summary("Get a chapter page")
@@ -465,8 +466,13 @@ object MangaController {
) )
} }
}, },
behaviorOf = { ctx, mangaId, chapterIndex, index, updateProgress, format -> behaviorOf = { ctx, mangaId, chapterIndex, index, updateProgress, format, opds ->
if (opds == true) {
ctx.getAttribute(Attribute.TachideskUser).requireUserWithBasicFallback(ctx) ctx.getAttribute(Attribute.TachideskUser).requireUserWithBasicFallback(ctx)
} else {
ctx.getAttribute(Attribute.TachideskUser).requireUser()
}
ctx.future { ctx.future {
future { future {
Page.getPageImage( Page.getPageImage(

View File

@@ -365,7 +365,7 @@ object OpdsEntryBuilder {
if (chapter.pageCount > 0) { if (chapter.pageCount > 0) {
val basePageHref = val basePageHref =
"/api/v1/manga/${manga.id}/chapter/${chapter.sourceOrder}/page/{pageNumber}" + "/api/v1/manga/${manga.id}/chapter/${chapter.sourceOrder}/page/{pageNumber}" +
"?updateProgress=${serverConfig.opdsEnablePageReadProgress.value}" "?updateProgress=${serverConfig.opdsEnablePageReadProgress.value}&opds=true"
val title: String = val title: String =
when { when {