mirror of https://gitlab.com/bashrc2/epicyon
Button on moderator screen to clear actor cache
parent
5160005509
commit
1825b058a8
25
cache.py
25
cache.py
|
@ -32,6 +32,31 @@ def _remove_person_from_cache(base_dir: str, person_url: str,
|
||||||
del person_cache[person_url]
|
del person_cache[person_url]
|
||||||
|
|
||||||
|
|
||||||
|
def clear_actor_cache(base_dir: str, person_cache: {},
|
||||||
|
clear_domain: str) -> None:
|
||||||
|
"""Clears the actor cache for the given domain
|
||||||
|
This is useful if you know that a given instance has rotated their
|
||||||
|
signing keys after a security incident
|
||||||
|
"""
|
||||||
|
if not clear_domain:
|
||||||
|
return
|
||||||
|
if '.' not in clear_domain:
|
||||||
|
return
|
||||||
|
|
||||||
|
actor_cache_dir = base_dir + '/cache/actors'
|
||||||
|
for subdir, _, files in os.walk(actor_cache_dir):
|
||||||
|
for fname in files:
|
||||||
|
filename = os.path.join(subdir, fname)
|
||||||
|
if not filename.endswith('.json'):
|
||||||
|
continue
|
||||||
|
if clear_domain not in fname:
|
||||||
|
continue
|
||||||
|
person_url = fname.replace('#', '/').replace('.json', '')
|
||||||
|
_remove_person_from_cache(base_dir, person_url,
|
||||||
|
person_cache)
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def check_for_changed_actor(session, base_dir: str,
|
def check_for_changed_actor(session, base_dir: str,
|
||||||
http_prefix: str, domain_full: str,
|
http_prefix: str, domain_full: str,
|
||||||
person_url: str, avatar_url: str, person_cache: {},
|
person_url: str, avatar_url: str, person_cache: {},
|
||||||
|
|
|
@ -378,6 +378,7 @@ from content import add_html_tags
|
||||||
from content import extract_media_in_form_post
|
from content import extract_media_in_form_post
|
||||||
from content import save_media_in_form_post
|
from content import save_media_in_form_post
|
||||||
from content import extract_text_fields_in_post
|
from content import extract_text_fields_in_post
|
||||||
|
from cache import clear_actor_cache
|
||||||
from cache import get_actor_public_key_from_id
|
from cache import get_actor_public_key_from_id
|
||||||
from cache import check_for_changed_actor
|
from cache import check_for_changed_actor
|
||||||
from cache import store_person_in_cache
|
from cache import store_person_in_cache
|
||||||
|
@ -2697,6 +2698,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
moderation_button = 'filter'
|
moderation_button = 'filter'
|
||||||
elif moderation_str.startswith('submitUnfilter'):
|
elif moderation_str.startswith('submitUnfilter'):
|
||||||
moderation_button = 'unfilter'
|
moderation_button = 'unfilter'
|
||||||
|
elif moderation_str.startswith('submitClearCache'):
|
||||||
|
moderation_button = 'clearcache'
|
||||||
elif moderation_str.startswith('submitSuspend'):
|
elif moderation_str.startswith('submitSuspend'):
|
||||||
moderation_button = 'suspend'
|
moderation_button = 'suspend'
|
||||||
elif moderation_str.startswith('submitUnsuspend'):
|
elif moderation_str.startswith('submitUnsuspend'):
|
||||||
|
@ -2723,6 +2726,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
add_global_filter(base_dir, moderation_text)
|
add_global_filter(base_dir, moderation_text)
|
||||||
if moderation_button == 'unfilter':
|
if moderation_button == 'unfilter':
|
||||||
remove_global_filter(base_dir, moderation_text)
|
remove_global_filter(base_dir, moderation_text)
|
||||||
|
if moderation_button == 'clearcache':
|
||||||
|
clear_actor_cache(base_dir,
|
||||||
|
self.server.person_cache,
|
||||||
|
moderation_text)
|
||||||
if moderation_button == 'block':
|
if moderation_button == 'block':
|
||||||
full_block_domain = None
|
full_block_domain = None
|
||||||
moderation_text = moderation_text.strip()
|
moderation_text = moderation_text.strip()
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "السماح فقط بالردود من المتبادلين",
|
"Only allow replies from mutuals": "السماح فقط بالردود من المتبادلين",
|
||||||
"Reason": "سبب",
|
"Reason": "سبب",
|
||||||
"Chat": "محادثة",
|
"Chat": "محادثة",
|
||||||
"Chat link": "رابط الدردشة"
|
"Chat link": "رابط الدردشة",
|
||||||
|
"Clear Cache": "مسح ذاكرة التخزين المؤقت"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "শুধুমাত্র মিউচুয়াল থেকে উত্তরের অনুমতি দিন",
|
"Only allow replies from mutuals": "শুধুমাত্র মিউচুয়াল থেকে উত্তরের অনুমতি দিন",
|
||||||
"Reason": "কারণ",
|
"Reason": "কারণ",
|
||||||
"Chat": "চ্যাট",
|
"Chat": "চ্যাট",
|
||||||
"Chat link": "চ্যাট লিঙ্ক"
|
"Chat link": "চ্যাট লিঙ্ক",
|
||||||
|
"Clear Cache": "ক্যাশে সাফ করুন"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Només permet respostes de mútues",
|
"Only allow replies from mutuals": "Només permet respostes de mútues",
|
||||||
"Reason": "Raó",
|
"Reason": "Raó",
|
||||||
"Chat": "Xatejar",
|
"Chat": "Xatejar",
|
||||||
"Chat link": "Enllaç de xat"
|
"Chat link": "Enllaç de xat",
|
||||||
|
"Clear Cache": "Netejar memòria cau"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Caniatewch atebion gan gwmnïau cydfuddiannol yn unig",
|
"Only allow replies from mutuals": "Caniatewch atebion gan gwmnïau cydfuddiannol yn unig",
|
||||||
"Reason": "Rheswm",
|
"Reason": "Rheswm",
|
||||||
"Chat": "Sgwrsio",
|
"Chat": "Sgwrsio",
|
||||||
"Chat link": "Dolen sgwrs"
|
"Chat link": "Dolen sgwrs",
|
||||||
|
"Clear Cache": "Clirio Cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Erlauben Sie nur Antworten von Gegenseitigkeitsgesellschaften",
|
"Only allow replies from mutuals": "Erlauben Sie nur Antworten von Gegenseitigkeitsgesellschaften",
|
||||||
"Reason": "Grund",
|
"Reason": "Grund",
|
||||||
"Chat": "Plaudern",
|
"Chat": "Plaudern",
|
||||||
"Chat link": "Chat-Link"
|
"Chat link": "Chat-Link",
|
||||||
|
"Clear Cache": "Cache leeren"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Επιτρέπονται μόνο απαντήσεις από αμοιβαία μέλη",
|
"Only allow replies from mutuals": "Επιτρέπονται μόνο απαντήσεις από αμοιβαία μέλη",
|
||||||
"Reason": "Λόγος",
|
"Reason": "Λόγος",
|
||||||
"Chat": "Κουβέντα",
|
"Chat": "Κουβέντα",
|
||||||
"Chat link": "Σύνδεσμος συνομιλίας"
|
"Chat link": "Σύνδεσμος συνομιλίας",
|
||||||
|
"Clear Cache": "Εκκαθάριση προσωρινής μνήμης"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Only allow replies from mutuals",
|
"Only allow replies from mutuals": "Only allow replies from mutuals",
|
||||||
"Reason": "Reason",
|
"Reason": "Reason",
|
||||||
"Chat": "Chat",
|
"Chat": "Chat",
|
||||||
"Chat link": "Chat link"
|
"Chat link": "Chat link",
|
||||||
|
"Clear Cache": "Clear Cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Permitir solo respuestas de mutuas",
|
"Only allow replies from mutuals": "Permitir solo respuestas de mutuas",
|
||||||
"Reason": "Razón",
|
"Reason": "Razón",
|
||||||
"Chat": "Charlar",
|
"Chat": "Charlar",
|
||||||
"Chat link": "Enlace de chat"
|
"Chat link": "Enlace de chat",
|
||||||
|
"Clear Cache": "Limpiar cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "فقط اجازه پاسخ از طرف متقابل را بدهید",
|
"Only allow replies from mutuals": "فقط اجازه پاسخ از طرف متقابل را بدهید",
|
||||||
"Reason": "دلیل",
|
"Reason": "دلیل",
|
||||||
"Chat": "چت کنید",
|
"Chat": "چت کنید",
|
||||||
"Chat link": "لینک چت"
|
"Chat link": "لینک چت",
|
||||||
|
"Clear Cache": "پاک کردن حافظه پنهان"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Autoriser uniquement les réponses des mutuelles",
|
"Only allow replies from mutuals": "Autoriser uniquement les réponses des mutuelles",
|
||||||
"Reason": "Raison",
|
"Reason": "Raison",
|
||||||
"Chat": "Discuter",
|
"Chat": "Discuter",
|
||||||
"Chat link": "Lien de discussion"
|
"Chat link": "Lien de discussion",
|
||||||
|
"Clear Cache": "Vider le cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Ná ceadaigh ach freagraí ó chomhlachtaí frithpháirteacha",
|
"Only allow replies from mutuals": "Ná ceadaigh ach freagraí ó chomhlachtaí frithpháirteacha",
|
||||||
"Reason": "Cúis",
|
"Reason": "Cúis",
|
||||||
"Chat": "Comhrá",
|
"Chat": "Comhrá",
|
||||||
"Chat link": "Nasc comhrá"
|
"Chat link": "Nasc comhrá",
|
||||||
|
"Clear Cache": "Glan Taisce"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "केवल पारस्परिक उत्तरों की अनुमति दें",
|
"Only allow replies from mutuals": "केवल पारस्परिक उत्तरों की अनुमति दें",
|
||||||
"Reason": "कारण",
|
"Reason": "कारण",
|
||||||
"Chat": "बात करना",
|
"Chat": "बात करना",
|
||||||
"Chat link": "चैट लिंक"
|
"Chat link": "चैट लिंक",
|
||||||
|
"Clear Cache": "कैश को साफ़ करें"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Consenti solo risposte da mutue",
|
"Only allow replies from mutuals": "Consenti solo risposte da mutue",
|
||||||
"Reason": "Motivo",
|
"Reason": "Motivo",
|
||||||
"Chat": "Chiacchierata",
|
"Chat": "Chiacchierata",
|
||||||
"Chat link": "Collegamento alla chat"
|
"Chat link": "Collegamento alla chat",
|
||||||
|
"Clear Cache": "Cancella cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "相互からの返信のみを許可する",
|
"Only allow replies from mutuals": "相互からの返信のみを許可する",
|
||||||
"Reason": "理由",
|
"Reason": "理由",
|
||||||
"Chat": "チャット",
|
"Chat": "チャット",
|
||||||
"Chat link": "チャットリンク"
|
"Chat link": "チャットリンク",
|
||||||
|
"Clear Cache": "キャッシュの消去"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "상호 간의 답장만 허용",
|
"Only allow replies from mutuals": "상호 간의 답장만 허용",
|
||||||
"Reason": "이유",
|
"Reason": "이유",
|
||||||
"Chat": "채팅",
|
"Chat": "채팅",
|
||||||
"Chat link": "채팅 링크"
|
"Chat link": "채팅 링크",
|
||||||
|
"Clear Cache": "캐시 지우기"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Tenê destûr bidin bersivên ji hevdu",
|
"Only allow replies from mutuals": "Tenê destûr bidin bersivên ji hevdu",
|
||||||
"Reason": "Semed",
|
"Reason": "Semed",
|
||||||
"Chat": "Galgalkirin",
|
"Chat": "Galgalkirin",
|
||||||
"Chat link": "Lînka chatê"
|
"Chat link": "Lînka chatê",
|
||||||
|
"Clear Cache": "Cache paqij bike"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Sta alleen reacties van onderlinge maatschappijen toe",
|
"Only allow replies from mutuals": "Sta alleen reacties van onderlinge maatschappijen toe",
|
||||||
"Reason": "Reden",
|
"Reason": "Reden",
|
||||||
"Chat": "Chatten",
|
"Chat": "Chatten",
|
||||||
"Chat link": "Chat-link"
|
"Chat link": "Chat-link",
|
||||||
|
"Clear Cache": "Cache wissen"
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,5 +624,6 @@
|
||||||
"Only allow replies from mutuals": "Only allow replies from mutuals",
|
"Only allow replies from mutuals": "Only allow replies from mutuals",
|
||||||
"Reason": "Reason",
|
"Reason": "Reason",
|
||||||
"Chat": "Chat",
|
"Chat": "Chat",
|
||||||
"Chat link": "Chat link"
|
"Chat link": "Chat link",
|
||||||
|
"Clear Cache": "Clear Cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Zezwalaj tylko na odpowiedzi od towarzystw wzajemnych",
|
"Only allow replies from mutuals": "Zezwalaj tylko na odpowiedzi od towarzystw wzajemnych",
|
||||||
"Reason": "Powód",
|
"Reason": "Powód",
|
||||||
"Chat": "Czat",
|
"Chat": "Czat",
|
||||||
"Chat link": "Link do czatu"
|
"Chat link": "Link do czatu",
|
||||||
|
"Clear Cache": "Wyczyść pamięć podręczną"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Permitir apenas respostas de mútuos",
|
"Only allow replies from mutuals": "Permitir apenas respostas de mútuos",
|
||||||
"Reason": "Razão",
|
"Reason": "Razão",
|
||||||
"Chat": "Bater papo",
|
"Chat": "Bater papo",
|
||||||
"Chat link": "Link de bate-papo"
|
"Chat link": "Link de bate-papo",
|
||||||
|
"Clear Cache": "Limpar cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Разрешить ответы только от взаимных",
|
"Only allow replies from mutuals": "Разрешить ответы только от взаимных",
|
||||||
"Reason": "Причина",
|
"Reason": "Причина",
|
||||||
"Chat": "Чат",
|
"Chat": "Чат",
|
||||||
"Chat link": "Ссылка на чат"
|
"Chat link": "Ссылка на чат",
|
||||||
|
"Clear Cache": "Очистить кэш"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Ruhusu tu majibu kutoka kwa pande zote mbili",
|
"Only allow replies from mutuals": "Ruhusu tu majibu kutoka kwa pande zote mbili",
|
||||||
"Reason": "Sababu",
|
"Reason": "Sababu",
|
||||||
"Chat": "Soga",
|
"Chat": "Soga",
|
||||||
"Chat link": "Kiungo cha gumzo"
|
"Chat link": "Kiungo cha gumzo",
|
||||||
|
"Clear Cache": "Futa Cache"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Yalnızca ortaklardan gelen yanıtlara izin ver",
|
"Only allow replies from mutuals": "Yalnızca ortaklardan gelen yanıtlara izin ver",
|
||||||
"Reason": "Sebep",
|
"Reason": "Sebep",
|
||||||
"Chat": "Sohbet",
|
"Chat": "Sohbet",
|
||||||
"Chat link": "Sohbet bağlantısı"
|
"Chat link": "Sohbet bağlantısı",
|
||||||
|
"Clear Cache": "Önbelleği Temizle"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "Дозволити відповіді лише від взаємних клієнтів",
|
"Only allow replies from mutuals": "Дозволити відповіді лише від взаємних клієнтів",
|
||||||
"Reason": "Причина",
|
"Reason": "Причина",
|
||||||
"Chat": "Чат",
|
"Chat": "Чат",
|
||||||
"Chat link": "Посилання на чат"
|
"Chat link": "Посилання на чат",
|
||||||
|
"Clear Cache": "Очистити кеш"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "לאָזן בלויז ענטפֿערס פון מיוטשואַלז",
|
"Only allow replies from mutuals": "לאָזן בלויז ענטפֿערס פון מיוטשואַלז",
|
||||||
"Reason": "סיבה",
|
"Reason": "סיבה",
|
||||||
"Chat": "שמועסן",
|
"Chat": "שמועסן",
|
||||||
"Chat link": "שמועס לינק"
|
"Chat link": "שמועס לינק",
|
||||||
|
"Clear Cache": "קלאָר קאַש"
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,5 +628,6 @@
|
||||||
"Only allow replies from mutuals": "只允许来自相互的回复",
|
"Only allow replies from mutuals": "只允许来自相互的回复",
|
||||||
"Reason": "原因",
|
"Reason": "原因",
|
||||||
"Chat": "聊天",
|
"Chat": "聊天",
|
||||||
"Chat link": "聊天链接"
|
"Chat link": "聊天链接",
|
||||||
|
"Clear Cache": "קלאָר קאַש"
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,6 +294,13 @@ def _html_timeline_moderation_buttons(moderator: bool, box_name: str,
|
||||||
'alt="' + \
|
'alt="' + \
|
||||||
translate['Unfilter words'] + ' | " ' + \
|
translate['Unfilter words'] + ' | " ' + \
|
||||||
'name="submitUnfilter" value="' + translate['Unfilter'] + '">\n'
|
'name="submitUnfilter" value="' + translate['Unfilter'] + '">\n'
|
||||||
|
tl_str += \
|
||||||
|
' <input type="submit" title="' + \
|
||||||
|
translate['Clear Cache'] + '" ' + \
|
||||||
|
'alt="' + \
|
||||||
|
translate['Clear Cache'] + ' | " ' + \
|
||||||
|
'name="submitClearCache" value="' + \
|
||||||
|
translate['Clear Cache'] + '">\n'
|
||||||
|
|
||||||
tl_str += '</div>\n</form>\n'
|
tl_str += '</div>\n</form>\n'
|
||||||
return tl_str
|
return tl_str
|
||||||
|
|
Loading…
Reference in New Issue