forked from rDrama/rDrama
change clearing cache terminology
parent
1d85fbe470
commit
bbfb18da9a
|
@ -5934,7 +5934,7 @@ g {
|
|||
.fa-lock:before{content:"\f023"}
|
||||
.fa-lock-alt:before{content:"\f30d"}
|
||||
.fa-search:before{content:"\f002"}
|
||||
.fa-memory:before{content:"\f538"}
|
||||
.fa-cloudflare:before{content:"\e07d"}
|
||||
.fa-comment-alt-smile:before{content:"\f4aa"}
|
||||
.fa-microphone-stand:before{content:"\f8cb"}
|
||||
.fa-palette:before{content:"\f53f"}
|
||||
|
|
|
@ -176,8 +176,8 @@ ACTIONTYPES = {
|
|||
"icon": 'fa-dollar-sign',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'dump_cache': {
|
||||
"str": 'dumped cache',
|
||||
'clear_internal_cache': {
|
||||
"str": 'cleared internal cache',
|
||||
"icon": 'fa-trash-alt',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
|
@ -266,9 +266,9 @@ ACTIONTYPES = {
|
|||
"icon": 'fa-thumbtack fa-rotate--45',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'purge_cache': {
|
||||
"str": 'purged cache',
|
||||
"icon": 'fa-memory',
|
||||
'clear_cloudflare_cache': {
|
||||
"str": 'cleared cloudflare cache',
|
||||
"icon": 'fa-cloudflare',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'reject_app': {
|
||||
|
|
|
@ -26,8 +26,8 @@ def get_security_level() -> Optional[str]:
|
|||
def set_security_level(under_attack="high") -> bool:
|
||||
return _request_from_cloudflare("settings/security_level", "PATCH", f'{{"value":"{under_attack}"}}')
|
||||
|
||||
def purge_entire_cache() -> bool:
|
||||
return _request_from_cloudflare("purge_cache", "POST", '{"purge_everything":true}')
|
||||
def clear_cloudflare_cache() -> bool:
|
||||
return _request_from_cloudflare("clear_cloudflare_cache", "POST", '{"purge_everything":true}')
|
||||
|
||||
def purge_files_in_cache(files:Union[List[str],str]) -> bool:
|
||||
if CF_ZONE == DEFAULT_CLOUDFLARE_ZONE: return False
|
||||
|
|
|
@ -473,26 +473,26 @@ def change_settings(v, setting):
|
|||
|
||||
return {'message': f"{setting} {word}d successfully!"}
|
||||
|
||||
@app.post("/admin/purge_cache")
|
||||
@app.post("/admin/clear_cloudflare_cache")
|
||||
@admin_level_required(PERMS['SITE_CACHE_PURGE_CDN'])
|
||||
def purge_cache(v):
|
||||
if not purge_entire_cache():
|
||||
abort(400, 'Failed to purge cache')
|
||||
def clear_cloudflare_cache(v):
|
||||
if not clear_cloudflare_cache():
|
||||
abort(400, 'Failed to clear cloudflare cache!')
|
||||
ma = ModAction(
|
||||
kind="purge_cache",
|
||||
kind="clear_cloudflare_cache",
|
||||
user_id=v.id
|
||||
)
|
||||
g.db.add(ma)
|
||||
return {"message": "CDN cache purged!"}
|
||||
return {"message": "Cloudflare cache cleared!"}
|
||||
|
||||
@app.post("/admin/dump_cache")
|
||||
@app.post("/admin/clear_internal_cache")
|
||||
@admin_level_required(PERMS['SITE_CACHE_DUMP_INTERNAL'])
|
||||
def admin_dump_cache(v):
|
||||
def admin_clear_internal_cache(v):
|
||||
online = cache.get(ONLINE_STR)
|
||||
cache.clear()
|
||||
cache.set(ONLINE_STR, online)
|
||||
ma = ModAction(
|
||||
kind="dump_cache",
|
||||
kind="clear_internal_cache",
|
||||
user_id=v.id
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
|
|
@ -147,10 +147,10 @@
|
|||
{% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] or v.admin_level >= PERMS['SITE_CACHE_DUMP_INTERNAL'] %}
|
||||
<h4>Caching</h4>
|
||||
{% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] %}
|
||||
<button type="button" class="btn btn-primary mt-3" onclick="postToastSwitch(this,'/admin/purge_cache');" style="margin-bottom: 2em;">PURGE CDN CACHE</button>
|
||||
<button type="button" class="btn btn-primary mt-3" onclick="postToastSwitch(this,'/admin/clear_cloudflare_cache');" style="margin-bottom: 2em;">CLEAR CLOUDFLARE CACHE</button>
|
||||
{% endif %}
|
||||
{% if v.admin_level >= PERMS['SITE_CACHE_DUMP_INTERNAL'] %}
|
||||
<button type="button" class="btn btn-primary mt-3" onclick="postToastSwitch(this,'/admin/dump_cache');" style="margin-bottom: 2em;">DUMP INTERNAL CACHE</button>
|
||||
<button type="button" class="btn btn-primary mt-3 ml-2" onclick="postToastSwitch(this,'/admin/clear_internal_cache');" style="margin-bottom: 2em;">CLEAR INTERNAL CACHE</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue