From 23d091f7cefc44f3d09ada4a5c9beff5106672f4 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sat, 20 Jul 2024 00:18:44 +0200 Subject: [PATCH] fix(federation): :bug: Make WebFinger always search for local users --- server/api/well-known/webfinger/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/api/well-known/webfinger/index.ts b/server/api/well-known/webfinger/index.ts index b5746f76..b772f997 100644 --- a/server/api/well-known/webfinger/index.ts +++ b/server/api/well-known/webfinger/index.ts @@ -13,7 +13,7 @@ import { FederationRequester, type ResponseError, } from "@lysand-org/federation/requester"; -import { eq } from "drizzle-orm"; +import { and, eq, isNull } from "drizzle-orm"; import { lookup } from "mime-types"; import { z } from "zod"; import { Users } from "~/drizzle/schema"; @@ -66,9 +66,12 @@ export default (app: Hono) => const isUuid = requestedUser.split("@")[0].match(idValidator); const user = await User.fromSql( - eq( - isUuid ? Users.id : Users.username, - requestedUser.split("@")[0], + and( + eq( + isUuid ? Users.id : Users.username, + requestedUser.split("@")[0], + ), + isNull(Users.instanceId), ), );