dev #2
2 changed files with 11 additions and 1 deletions
|
@ -21,13 +21,22 @@ export async function useAuth(
|
|||
const decoded: IJwtData = jwt.verify(token, Buffer.from(PUBLIC_KEY), {
|
||||
algorithms: ["RS256"],
|
||||
}) as IJwtData;
|
||||
const user = await userRepo.findOne({
|
||||
let user = await userRepo.findOne({
|
||||
where: {
|
||||
apiKey: decoded.apiKey,
|
||||
},
|
||||
loadEagerRelations: eager || false,
|
||||
relations: eager ? ["sentFriendRequests", "receivedFriendRequests"] : [],
|
||||
});
|
||||
if (!user) {
|
||||
user = await userRepo.findOne({
|
||||
where: {
|
||||
id: decoded.id,
|
||||
},
|
||||
loadEagerRelations: eager || false,
|
||||
relations: eager ? ["sentFriendRequests", "receivedFriendRequests"] : [],
|
||||
});
|
||||
}
|
||||
return user;
|
||||
}
|
||||
const user = await userRepo.findOne({
|
||||
|
|
|
@ -18,6 +18,7 @@ export async function GET({ request }) {
|
|||
export async function POST({ request, getClientAddress }) {
|
||||
// TODO: per-ip room limit
|
||||
const body: IRoom = await request.json();
|
||||
console.log(body, request.headers);
|
||||
/* description may contain "### END DESCRIPTION ###" on its own line. if it does, get all lines after that */
|
||||
const parsedDescription = body.description?.split("### END DESCRIPTION ###");
|
||||
const description = parsedDescription?.slice(1)?.join("### END DESCRIPTION ###") || "";
|
||||
|
|
Loading…
Reference in a new issue