mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 08:53:48 +01:00
[mastodon-client] Ignore invalid auth requests
This commit is contained in:
parent
4d6111d1a4
commit
c7d62223ef
@ -5,7 +5,7 @@ import { AuthConverter } from "@/server/api/mastodon/converters/auth.js";
|
|||||||
import { MastoApiError } from "@/server/api/mastodon/middleware/catch-errors.js";
|
import { MastoApiError } from "@/server/api/mastodon/middleware/catch-errors.js";
|
||||||
|
|
||||||
export async function AuthMiddleware(ctx: MastoContext, next: () => Promise<any>) {
|
export async function AuthMiddleware(ctx: MastoContext, next: () => Promise<any>) {
|
||||||
const auth = await authenticate(ctx.headers.authorization, null, true);
|
const auth = await authenticate(ctx.headers.authorization, null, true).catch(_ => [null, null]);
|
||||||
ctx.user = auth[0] ?? null as ILocalUser | null;
|
ctx.user = auth[0] ?? null as ILocalUser | null;
|
||||||
ctx.scopes = auth[1]?.permission ?? [] as string[];
|
ctx.scopes = auth[1]?.permission ?? [] as string[];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user