delete ability of jannies to clear internal cache

pull/83/head
Aevann 2022-12-22 22:52:36 +02:00
parent f0eee0aa68
commit e6274e06f3
5 changed files with 2 additions and 23 deletions

View File

@ -287,7 +287,6 @@ PERMS = { # Minimum admin_level to perform action.
'SITE_SETTINGS_SNAPPY_QUOTES': 3,
'SITE_SETTINGS_UNDER_ATTACK': 3,
'SITE_CACHE_PURGE_CDN': 3,
'SITE_CACHE_DUMP_INTERNAL': 2,
'SITE_WARN_ON_INVALID_AUTH': 1,
'NOTIFICATIONS_ADMIN_PING': 2,
'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2,

View File

@ -96,11 +96,6 @@ MODACTION_TYPES = {
"icon": 'fa-dollar-sign',
"color": 'bg-success'
},
'clear_internal_cache': {
"str": 'cleared internal cache',
"icon": 'fa-trash-alt',
"color": 'bg-muted'
},
'edit_post': {
"str": 'edited {self.target_link}',
"icon": 'fa-edit',

View File

@ -410,19 +410,6 @@ def clear_cloudflare_cache(v):
g.db.add(ma)
return {"message": "Cloudflare cache cleared!"}
@app.post("/admin/clear_internal_cache")
@admin_level_required(PERMS['SITE_CACHE_DUMP_INTERNAL'])
def admin_clear_internal_cache(v):
online = cache.get(CHAT_ONLINE_CACHE_KEY)
cache.clear()
cache.set(CHAT_ONLINE_CACHE_KEY, online)
ma = ModAction(
kind="clear_internal_cache",
user_id=v.id
)
g.db.add(ma)
return {"message": "Internal cache cleared!"}
@app.post("/admin/under_attack")
@admin_level_required(PERMS['SITE_SETTINGS_UNDER_ATTACK'])
def under_attack(v):

View File

@ -124,14 +124,11 @@
<br>
{% endif %}
{% 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'] %}
<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/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 ml-2" onclick="postToastSwitch(this,'/admin/clear_internal_cache');" style="margin-bottom: 2em;">CLEAR INTERNAL CACHE</button>
{% endif %}
{% endif %}
<h4>Server Status</h4>

View File

@ -0,0 +1 @@
delete from modactions where kind='clear_internal_cache';