forked from rDrama/rDrama
fix /csp_violations
parent
24ba5a6663
commit
ae83aa15ed
|
@ -356,17 +356,12 @@ def donate(v):
|
|||
return render_template(f'donate_{SITE_NAME}.html', v=v)
|
||||
|
||||
|
||||
items_we_want = ('blocked-uri', 'document-uri', 'effective-directive', 'source-file', 'violated-directive')
|
||||
|
||||
@app.post('/csp_violations')
|
||||
@limiter.limit("10/minute;50/day")
|
||||
def csp_violations():
|
||||
content = json.dumps(request.get_json())
|
||||
try:
|
||||
if content["source-file"].startswith(SITE_FULL):
|
||||
content = request.get_json(force=True)['csp-report']
|
||||
print('--------', flush=True)
|
||||
for k, val in content.items():
|
||||
print(f"{k}: {val}", flush=True)
|
||||
print('--------', flush=True)
|
||||
for i in items_we_want:
|
||||
print(f"{i}: {content['i']}", flush=True)
|
||||
except:
|
||||
print(content, flush=True)
|
||||
return ''
|
||||
|
|
Loading…
Reference in New Issue