change clearing cache terminology

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-11-06 07:28:44 +02:00
parent 1d85fbe470
commit bbfb18da9a
5 changed files with 19 additions and 19 deletions

View File

@ -5934,7 +5934,7 @@ g {
.fa-lock:before{content:"\f023"} .fa-lock:before{content:"\f023"}
.fa-lock-alt:before{content:"\f30d"} .fa-lock-alt:before{content:"\f30d"}
.fa-search:before{content:"\f002"} .fa-search:before{content:"\f002"}
.fa-memory:before{content:"\f538"} .fa-cloudflare:before{content:"\e07d"}
.fa-comment-alt-smile:before{content:"\f4aa"} .fa-comment-alt-smile:before{content:"\f4aa"}
.fa-microphone-stand:before{content:"\f8cb"} .fa-microphone-stand:before{content:"\f8cb"}
.fa-palette:before{content:"\f53f"} .fa-palette:before{content:"\f53f"}

View File

@ -176,8 +176,8 @@ ACTIONTYPES = {
"icon": 'fa-dollar-sign', "icon": 'fa-dollar-sign',
"color": 'bg-success' "color": 'bg-success'
}, },
'dump_cache': { 'clear_internal_cache': {
"str": 'dumped cache', "str": 'cleared internal cache',
"icon": 'fa-trash-alt', "icon": 'fa-trash-alt',
"color": 'bg-muted' "color": 'bg-muted'
}, },
@ -266,9 +266,9 @@ ACTIONTYPES = {
"icon": 'fa-thumbtack fa-rotate--45', "icon": 'fa-thumbtack fa-rotate--45',
"color": 'bg-success' "color": 'bg-success'
}, },
'purge_cache': { 'clear_cloudflare_cache': {
"str": 'purged cache', "str": 'cleared cloudflare cache',
"icon": 'fa-memory', "icon": 'fa-cloudflare',
"color": 'bg-muted' "color": 'bg-muted'
}, },
'reject_app': { 'reject_app': {

View File

@ -26,8 +26,8 @@ def get_security_level() -> Optional[str]:
def set_security_level(under_attack="high") -> bool: def set_security_level(under_attack="high") -> bool:
return _request_from_cloudflare("settings/security_level", "PATCH", f'{{"value":"{under_attack}"}}') return _request_from_cloudflare("settings/security_level", "PATCH", f'{{"value":"{under_attack}"}}')
def purge_entire_cache() -> bool: def clear_cloudflare_cache() -> bool:
return _request_from_cloudflare("purge_cache", "POST", '{"purge_everything":true}') return _request_from_cloudflare("clear_cloudflare_cache", "POST", '{"purge_everything":true}')
def purge_files_in_cache(files:Union[List[str],str]) -> bool: def purge_files_in_cache(files:Union[List[str],str]) -> bool:
if CF_ZONE == DEFAULT_CLOUDFLARE_ZONE: return False if CF_ZONE == DEFAULT_CLOUDFLARE_ZONE: return False

View File

@ -473,26 +473,26 @@ def change_settings(v, setting):
return {'message': f"{setting} {word}d successfully!"} 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']) @admin_level_required(PERMS['SITE_CACHE_PURGE_CDN'])
def purge_cache(v): def clear_cloudflare_cache(v):
if not purge_entire_cache(): if not clear_cloudflare_cache():
abort(400, 'Failed to purge cache') abort(400, 'Failed to clear cloudflare cache!')
ma = ModAction( ma = ModAction(
kind="purge_cache", kind="clear_cloudflare_cache",
user_id=v.id user_id=v.id
) )
g.db.add(ma) 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']) @admin_level_required(PERMS['SITE_CACHE_DUMP_INTERNAL'])
def admin_dump_cache(v): def admin_clear_internal_cache(v):
online = cache.get(ONLINE_STR) online = cache.get(ONLINE_STR)
cache.clear() cache.clear()
cache.set(ONLINE_STR, online) cache.set(ONLINE_STR, online)
ma = ModAction( ma = ModAction(
kind="dump_cache", kind="clear_internal_cache",
user_id=v.id user_id=v.id
) )
g.db.add(ma) g.db.add(ma)

View File

@ -147,10 +147,10 @@
{% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] or v.admin_level >= PERMS['SITE_CACHE_DUMP_INTERNAL'] %} {% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] or v.admin_level >= PERMS['SITE_CACHE_DUMP_INTERNAL'] %}
<h4>Caching</h4> <h4>Caching</h4>
{% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] %} {% 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 %} {% endif %}
{% if v.admin_level >= PERMS['SITE_CACHE_DUMP_INTERNAL'] %} {% 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 %}
{% endif %} {% endif %}