From 6e2f4bd814aba5f03a40101bab84166b442e8848 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 8 Nov 2023 15:55:38 +1100 Subject: [PATCH] fix: API rate limits --- gift.py | 4 ++-- main.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gift.py b/gift.py index 9f0b2b1..7c9360e 100644 --- a/gift.py +++ b/gift.py @@ -25,7 +25,7 @@ if os.getenv('max_gifts_per_interval') == 'true': if os.getenv('interval') == 'true': interval = int(os.getenv('interval')) -def gift(name,email,referer, ip): +def gift(name,email,referer, ip,api=False): global loaded global gifts global previous_gifts @@ -59,7 +59,7 @@ def gift(name,email,referer, ip): loaded = True # Check if the user has already submitted - if ip != os.getenv('admin_ip'): + if ip != os.getenv('admin_ip') and not api: for gift in gifts: if gift['email'] == email: return "You have already submitted a gift request" diff --git a/main.py b/main.py index ea9cd4a..f92b2b3 100644 --- a/main.py +++ b/main.py @@ -100,7 +100,7 @@ def api(): return jsonify({'error': 'Invalid email address', 'success': False}) - status = gift.gift(name, email, "api", ip) + status = gift.gift(name, email, "api", ip,True) print(status,flush=True) if status == True: