mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 11:27:31 -07:00
[mastodon-client] Ignore invalid auth requests
This commit is contained in:
parent
4d6111d1a4
commit
c7d62223ef
1 changed files with 1 additions and 1 deletions
|
@ -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 a new issue