API: Refactor "GET /api/v1/config" endpoint for JWT sessions #5230

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-10-29 12:29:12 +01:00
parent 99cf43261d
commit e1e673be7f
6 changed files with 79 additions and 20 deletions

View File

@@ -112,6 +112,18 @@ func authAnyJWT(c *gin.Context, clientIP, authToken string, resource acl.Resourc
IssuedAt: issuedAt,
NotBefore: notBefore,
ExpiresAt: expiresAt,
PreviewToken: func() string {
if tokenScopes.Contains(acl.ResourceFiles.String()) {
return conf.PreviewToken()
}
return ""
}(),
DownloadToken: func() string {
if tokenScopes.Contains(acl.ResourceFiles.String()) {
return conf.DownloadToken()
}
return ""
}(),
})
}