This commit is contained in:
Aevann1 2022-01-24 21:06:41 +02:00
parent 51424e3855
commit fca2910790
4 changed files with 19 additions and 16 deletions

View file

@ -371,6 +371,7 @@ def disable_signups(v):
@app.post("/admin/purge_cache")
@admin_level_required(3)
def purge_cache(v):
cache.clear()
response = str(requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data='{"purge_everything":true}'))
if response == "<Response [200]>": return {"message": "Cache purged!"}
return {"error": "Failed to purge cache."}