mirror of
https://github.com/versia-pub/server.git
synced 2026-01-26 12:16:01 +01:00
Make lookup also work on local users
This commit is contained in:
parent
59cd8c9bd1
commit
b1d7073217
|
|
@ -52,8 +52,21 @@ export default apiRoute<{
|
||||||
return errorResponse("Account not found", 404);
|
return errorResponse("Account not found", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return errorResponse(
|
let username = acct;
|
||||||
"Acct parameter is not of format username@domain.com or @username@domain.com",
|
if (username.startsWith("@")) {
|
||||||
400,
|
username = username.slice(1);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
const account = await client.user.findFirst({
|
||||||
|
where: {
|
||||||
|
username,
|
||||||
|
},
|
||||||
|
include: userRelations,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (account) {
|
||||||
|
return jsonResponse(userToAPI(account));
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorResponse(`Account with username ${username} not found"`, 404);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue