summary refs log tree commit diff
path: root/api/src/routes/guilds/#guild_id
diff options
context:
space:
mode:
authorThesourtimes <cckhmck@gmail.com>2021-12-24 21:55:34 +0300
committerThesourtimes <cckhmck@gmail.com>2021-12-24 21:55:34 +0300
commitd55e7c5b8d72b7a5b953a35bad08f5e1f6aa6284 (patch)
tree4db9c859ad69054704d03bc1f06e86ca57941c60 /api/src/routes/guilds/#guild_id
parentFix typo (diff)
downloadserver-d55e7c5b8d72b7a5b953a35bad08f5e1f6aa6284.tar.xz
(Finally) make a temporary fix for IP leak
Diffstat (limited to 'api/src/routes/guilds/#guild_id')
-rw-r--r--api/src/routes/guilds/#guild_id/bans.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/api/src/routes/guilds/#guild_id/bans.ts b/api/src/routes/guilds/#guild_id/bans.ts
index 4d12ae46..75a50038 100644
--- a/api/src/routes/guilds/#guild_id/bans.ts
+++ b/api/src/routes/guilds/#guild_id/bans.ts
@@ -6,9 +6,19 @@ import { getIpAdress, route } from "@fosscord/api";
 export interface BanCreateSchema {
 	delete_message_days?: string;
 	reason?: string;
-}
+};
+
+export interface BanRegistrySchema {
+	id: string;
+	user_id: string;
+	guild_id: string;
+	executor_id: string;
+	ip?: string;
+	reason?: string | undefined;
+};
 
 const router: Router = Router();
+
 router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res: Response) => {
 	const { guild_id } = req.params;
 
@@ -16,7 +26,7 @@ router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res:
 
 	/* Filter secret from database registry.*/
 	
-	bans.forEach((registry) => {
+	bans.forEach((registry: BanRegistrySchema) => {
 	delete registry.ip;
 	});
 
@@ -27,7 +37,7 @@ router.get("/:user", route({ permission: "BAN_MEMBERS" }), async (req: Request,
 	const { guild_id } = req.params;
 	const user_id = req.params.ban;
 
-	let ban = await Ban.findOneOrFail({ guild_id: guild_id, user_id: user_id });
+	let ban = await Ban.findOneOrFail({ guild_id: guild_id, user_id: user_id }) as BanRegistrySchema;
 	
 	/* Filter secret from registry. */