upd: also split by +

This commit is contained in:
Mar0xy 2023-09-24 21:33:16 +02:00
parent 58988c2b3c
commit 487e397810
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -43,7 +43,7 @@ export async function ApiAuthMastodon(request: FastifyRequest, client: Megalodon
const body: any = request.body || request.query; const body: any = request.body || request.query;
try { try {
let scope = body.scopes; let scope = body.scopes;
if (typeof scope === 'string') scope = scope.split(' '); if (typeof scope === 'string') scope = scope.split(' ') || scope.split('+');
const pushScope = new Set<string>(); const pushScope = new Set<string>();
for (const s of scope) { for (const s of scope) {
if (s.match(/^read/)) for (const r of readScope) pushScope.add(r); if (s.match(/^read/)) for (const r of readScope) pushScope.add(r);