summary refs log tree commit diff
path: root/src/opcodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/opcodes')
-rw-r--r--src/opcodes/Identify.ts4
-rw-r--r--src/opcodes/LazyRequest.ts21
2 files changed, 14 insertions, 11 deletions
diff --git a/src/opcodes/Identify.ts b/src/opcodes/Identify.ts

index f31eebfe..0ddc58d1 100644 --- a/src/opcodes/Identify.ts +++ b/src/opcodes/Identify.ts
@@ -11,6 +11,7 @@ import { UserModel, toObject, EVENTEnum, + Config, } from "@fosscord/server-util"; import { setupListener } from "../listener/listener"; import { IdentifySchema } from "../schema/Identify"; @@ -29,7 +30,8 @@ export async function onIdentify(this: WebSocket, data: Payload) { const identify: IdentifySchema = data.d; try { - var decoded = await checkToken(identify.token); // will throw an error if invalid + const { jwtSecret } = Config.get().security; + var decoded = await checkToken(identify.token, jwtSecret); // will throw an error if invalid } catch (error) { console.error("invalid token", error); return this.close(CLOSECODES.Authentication_failed); diff --git a/src/opcodes/LazyRequest.ts b/src/opcodes/LazyRequest.ts
index 8b97e84a..8a7bb8c4 100644 --- a/src/opcodes/LazyRequest.ts +++ b/src/opcodes/LazyRequest.ts
@@ -70,15 +70,16 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) { const items = []; for (const role of roles) { - items.push({ - group: { - count: role.members.length, - id: role.id, - }, - }); - for (const member of role.members) { - items.push({ member }); - } + items.push({ + group: { + count: role.members.length, + id: role.id === guild_id ? "online" : role.name + } + }); + for (const member of role.members) { + member.roles.remove(guild_id); + items.push({ member }); + } } return Send(this, { @@ -90,7 +91,7 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) { { range: [0, 99], op: "SYNC", - items: items, + items, }, ], online_count: member_count, // TODO count online count