From e192f60eedc2119a6f914b8e4f47f4c31caf35bc Mon Sep 17 00:00:00 2001 From: UnRealReincarlution Date: Wed, 19 Oct 2022 22:05:23 +1300 Subject: [PATCH] Will not connect user who has exceeded usage --- src/components/reseda.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/components/reseda.tsx b/src/components/reseda.tsx index 5fef681..2d7a085 100644 --- a/src/components/reseda.tsx +++ b/src/components/reseda.tsx @@ -431,6 +431,8 @@ class WireGuard extends Component<{ file_path: string, user: any }> { totalUp += parseInt(e.up); }); + return {totalDown, totalUp}; + console.log(totalDown, totalUp); } @@ -490,6 +492,25 @@ class WireGuard extends Component<{ file_path: string, user: any }> { } connect(location: Server, callback_time: Function) { + // If user has exceeded limits, do not allow them to connect. + if(this.state.tier == "FREE" || this.state.tier == "SUPPORTER") { + const limits = this.determineLimits(); + + if(this.state.tier == "FREE") { + const limit = 5000000000; + + if(limits.totalDown >= limit || limits.totalUp >= limit) { + return; + } + }else { + const limit = 50000000000; + + if(limits.totalDown >= limit || limits.totalUp >= limit) { + return; + } + } + } + console.time("start->sendws"); callback_time(new Date().getTime()); console.log(this.config.keys);