No auth for author images

This commit is contained in:
mikiher 2024-11-03 08:45:43 +02:00
parent 3bc2941445
commit bf8407274e

View File

@ -18,7 +18,7 @@ class Auth {
constructor() {
// Map of openId sessions indexed by oauth2 state-variable
this.openIdAuthSession = new Map()
this.ignorePattern = /\/api\/items\/[^/]+\/cover/
this.ignorePatterns = [/\/api\/items\/[^/]+\/cover/, /\/api\/authors\/[^/]+\/image/]
}
/**
@ -28,7 +28,7 @@ class Auth {
* @private
*/
authNotNeeded(req) {
return req.method === 'GET' && this.ignorePattern.test(req.originalUrl)
return req.method === 'GET' && this.ignorePatterns.some((pattern) => pattern.test(req.originalUrl))
}
ifAuthNeeded(middleware) {