From 1c12d378d66b92b1674acd17640f2bac752da289 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 25 Mar 2025 14:13:06 -0400 Subject: Converted public dashboard to admin dashboard; Made API have a consistent output message --- web/src/app/components/Guilds.jsx | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 web/src/app/components/Guilds.jsx (limited to 'web/src/app/components/Guilds.jsx') diff --git a/web/src/app/components/Guilds.jsx b/web/src/app/components/Guilds.jsx deleted file mode 100644 index 38626e4..0000000 --- a/web/src/app/components/Guilds.jsx +++ /dev/null @@ -1,25 +0,0 @@ - -export default async function Guilds({session}) { - - const response = await fetch("https://discord.com/api/users/@me/guilds", { - headers: { - Authorization: `Bearer ${session.accessToken}`, - }, - }); - const guilds = await response.json(); - - const ADMINISTRATOR = 0x0000000000000008; - const MANAGE_GUILD = 0x00000020; - - const filteredGuilds = guilds.filter((guild) => { - // Convert permissions string to a BigInt for bitwise operations - const permissions = BigInt(guild.permissions); - // Check if user is owner, has ADMINISTRATOR or MANAGE_GUILD permissions - return guild.owner || - (permissions & BigInt(ADMINISTRATOR)) === BigInt(ADMINISTRATOR) || - (permissions & BigInt(MANAGE_GUILD)) === BigInt(MANAGE_GUILD); }); - - return filteredGuilds.map((guild) => ( -
{guild.name}
- )) -} -- cgit v1.2.3