обавлен эндпоинт /rate для отображения страницы с ограничением частоты запросов

This commit is contained in:
Vlad 2025-05-07 00:29:50 +03:00
parent 4c640798a9
commit 273eec2726

8
app.py
View File

@ -769,6 +769,14 @@ def ads_txt():
def logo(): def logo():
return send_file(app_path+"/static/favicon.ico") return send_file(app_path+"/static/favicon.ico")
@app.route('/rate')
def rate_limit():
try:
return render_template('rate_limit.html', site=site)
except:
app.logger.error(traceback.format_exc())
return 'bad request!', 500
def get_ip(req) -> str: def get_ip(req) -> str:
if 'X-Forwarded-For' in req.headers: if 'X-Forwarded-For' in req.headers: