From 6c965d1c060c730736973186fb6ae7ba7eceb3d9 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 23 Jan 2023 04:37:43 +0200 Subject: [PATCH] make ratelimiting work when not-proxied by cloudflare --- files/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/__main__.py b/files/__main__.py index 47628c4b5..5f8d3760d 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -59,7 +59,9 @@ if "load_chat" in argv: def get_CF(): with app.app_context(): - return request.headers.get('CF-Connecting-IP') + x = request.headers.get('CF-Connecting-IP') + if x: return x + return request.remote_addr limiter = Limiter( app=app,