mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-06 19:02:33 +01:00
Merge pull request #556 from Thesourtimes/master
(Finally) make a temporary fix for IP leak
This commit is contained in:
commit
a72d107bb5
@ -6,9 +6,21 @@ import { getIpAdress, route } from "@fosscord/api";
|
|||||||
export interface BanCreateSchema {
|
export interface BanCreateSchema {
|
||||||
delete_message_days?: string;
|
delete_message_days?: string;
|
||||||
reason?: 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();
|
const router: Router = Router();
|
||||||
|
|
||||||
|
/* TODO: Deleting the secrets is just a temporary go-around. Views should be implemented for both safety and better handling. */
|
||||||
|
|
||||||
router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res: Response) => {
|
router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res: Response) => {
|
||||||
const { guild_id } = req.params;
|
const { guild_id } = req.params;
|
||||||
|
|
||||||
@ -16,7 +28,7 @@ router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res:
|
|||||||
|
|
||||||
/* Filter secret from database registry.*/
|
/* Filter secret from database registry.*/
|
||||||
|
|
||||||
bans.forEach((registry) => {
|
bans.forEach((registry: BanRegistrySchema) => {
|
||||||
delete registry.ip;
|
delete registry.ip;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -27,7 +39,7 @@ router.get("/:user", route({ permission: "BAN_MEMBERS" }), async (req: Request,
|
|||||||
const { guild_id } = req.params;
|
const { guild_id } = req.params;
|
||||||
const user_id = req.params.ban;
|
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. */
|
/* Filter secret from registry. */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user