phantasmobile/app/brake_backend.py
2023-07-24 19:08:30 +01:00

10 lines
267 B
Python

from brake.backends import cachebe
class BrakeBackend(cachebe.CacheBackend):
def get_ip(self, request):
ip = request.META.get("HTTP_X_FORWARDED_FOR", request.META.get("REMOTE_ADDR"))
if ip:
ip = ip.split(", ")[-1]
return ip