hack-chat / main

a minimal, distraction-free chat application
https://hack.chat/
1.31k stars 222 forks source link

mod rate limiting #128

Closed raf924 closed 10 months ago

raf924 commented 3 years ago

Noticed something earlier today. I was testing a bot and I had messed up the joining process so it spammed hc and was rate-limited as it should be. Then when I tried to speak on programming with my mod user (which was connected during the aforementioned testing) was also rate-limited which was undesirable.

So I guess what I'm asking is to for hc to check for mod status before checking the IP (or the hash? idk).

Also maybe, let the mods enable/disable rate-limiting for all mods so as to avoid the previous JBot situations.

All my love.

marzavec commented 3 years ago

Atm, the "mods don't get ratelimited" feature isn't part of the official release. It's been part of prod for long enough that I think it'd be safe enough to add into the official source.

The current implementation is amazingly hacky. What I think we should do is pass the socket reference over to the frisk function (instead of passing just the ip address), that way the join function can apply some special boolean property to the socket. frisk can then check this property before proceeding and also pull the address.

marzavec commented 10 months ago

Implemented with 2a5a9c150cda5b7d70a435f645e3c5ba867e78b4