summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-03-06 02:31:00 +0100
committerRory& <root@rory.gay>2026-03-06 02:31:00 +0100
commit95337600776a1eda43f7b7dd4d74d1b1bc3145a3 (patch)
treeb7a2439a97a2c0746ed51aa4c63bf7edd9502a06
parentoooops (diff)
downloadserver-ts-95337600776a1eda43f7b7dd4d74d1b1bc3145a3.tar.xz
temp hack: re-create sessiosn that went missing
-rw-r--r--src/util/util/Token.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/util/Token.ts b/src/util/util/Token.ts

index 81063ec0..be1d31c7 100644 --- a/src/util/util/Token.ts +++ b/src/util/util/Token.ts
@@ -81,7 +81,8 @@ export const checkToken = ( return rejectAndLog(reject, 401, "Invalid Token meow " + err); } - const [user, session] = await Promise.all([ + // eslint-disable-next-line prefer-const + let [user, session] = await Promise.all([ User.findOne({ where: { id: decoded.id }, select: [...(opts?.select || []), "id", "bot", "disabled", "deleted", "rights", "data"], @@ -96,6 +97,15 @@ export const checkToken = ( } if (decoded.did && !session) { + // temporary hack: create new session + session = Session.create({ + session_id: randomUpperString(10), // readable at a glance + user_id: user.id, + is_admin_session: false, + client_status: {}, + status: "online", + client_info: {}, + }); logAuth("validateUser rejected: Session not found"); return rejectAndLog(reject, 401, "Invalid Token"); }