Add "service" field in bans when sending it to the API from bwcli

This commit is contained in:
Théophile Diot 2024-10-23 11:44:09 +02:00
parent 0d6fdbdd18
commit f29095a555
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -216,7 +216,7 @@ class CLI(ApiCaller):
self.__logger.error(f"Failed to ban {ip} in redis: {e}")
try:
if self.send_to_apis("POST", "/ban", data={"ip": ip, "exp": exp, "reason": reason}):
if self.send_to_apis("POST", "/ban", data={"ip": ip, "exp": exp, "reason": reason, "service": "bwcli"}):
return True, f"IP {ip} has been banned for {format_remaining_time(exp)} with reason {reason}"
except BaseException as e:
return False, f"Failed to ban {ip}: {e}"