restore /csp_violations

pull/110/head
Aevann 2023-02-02 22:15:03 +02:00
parent 6e389bccc7
commit 28dbece47e
1 changed files with 11 additions and 11 deletions

View File

@ -356,14 +356,14 @@ def donate(v):
return render_template(f'donate_{SITE_NAME}.html', v=v)
# @app.post('/csp_violations')
# @limiter.limit("5/minute;10/day")
# def csp_violations():
# content = request.get_json(force=True)['csp-report']
# if content.get('source-file').startswith(SITE_FULL):
# print('--------', flush=True)
# for k, val in content.items():
# if k != 'original-policy':
# print(f"{k}: {val}", flush=True)
# print('--------', flush=True)
# return ''
@app.post('/csp_violations')
@limiter.limit("5/minute;10/day")
def csp_violations():
content = request.get_json(force=True)['csp-report']
if content.get('source-file') and content['source-file'].startswith(SITE_FULL):
print('--------', flush=True)
for k, val in content.items():
if k != 'original-policy':
print(f"{k}: {val}", flush=True)
print('--------', flush=True)
return ''