fix: API rate limits
All checks were successful
Build Docker / Build Image (push) Successful in 23s

This commit is contained in:
Nathan Woodburn 2023-11-08 15:55:38 +11:00
parent 30c723cebb
commit 6e2f4bd814
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ if os.getenv('max_gifts_per_interval') == 'true':
if os.getenv('interval') == 'true': if os.getenv('interval') == 'true':
interval = int(os.getenv('interval')) interval = int(os.getenv('interval'))
def gift(name,email,referer, ip): def gift(name,email,referer, ip,api=False):
global loaded global loaded
global gifts global gifts
global previous_gifts global previous_gifts
@ -59,7 +59,7 @@ def gift(name,email,referer, ip):
loaded = True loaded = True
# Check if the user has already submitted # 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: for gift in gifts:
if gift['email'] == email: if gift['email'] == email:
return "You have already submitted a gift request" return "You have already submitted a gift request"

View File

@ -100,7 +100,7 @@ def api():
return jsonify({'error': 'Invalid email address', 'success': False}) 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) print(status,flush=True)
if status == True: if status == True: