Add named-token auth support to middleware and configService

authMiddleware now falls back to checking named tokens from settings
when JWT verification fails. configService.getNamedTokens() filters by
endDate, skipping expired tokens. Tokens without an endDate never expire.
This commit is contained in:
X4Lo committed 2026-06-30 23:54:04 +01:00
1 parent c6a838a91c
commit 0a79ee9768
2 files changed
+57 -9

No files matched your search

+13
View File
@@ -138,6 +138,19 @@ class ConfigService {
getTmdbApiKey() {
return this.settings.tmdbApiKey;
}
getNamedTokens() {
const tokens = this.settings.namedTokens || [];
const now = new Date();
return tokens.filter((token) => {
if (!token.value) return false;
if (token.endDate) {
const end = new Date(token.endDate);
if (end < now) return false;
}
return true;
});
}
}
// const instance = new ConfigService();