mirror of https://gitlab.com/bashrc2/epicyon
Edit dogwhistle words
parent
972c29a9fa
commit
21b5462683
|
@ -1097,7 +1097,7 @@ def load_dogwhistles(filename: str) -> {}:
|
|||
except OSError:
|
||||
print('EX: unable to load dogwhistles from ' + filename)
|
||||
return {}
|
||||
separators = ('->', ',', ';', '|')
|
||||
separators = ('->', '=>', ',', ';', '|', '=')
|
||||
dogwhistles = {}
|
||||
for line in dogwhistle_lines:
|
||||
line = line.remove_eol(line).strip()
|
||||
|
@ -1109,8 +1109,8 @@ def load_dogwhistles(filename: str) -> {}:
|
|||
category = None
|
||||
for sep in separators:
|
||||
if sep in line:
|
||||
whistle = line.split(sep, 1)[0]
|
||||
category = line.split(sep, 1)[1]
|
||||
whistle = line.split(sep, 1)[0].strip()
|
||||
category = line.split(sep, 1)[1].strip()
|
||||
break
|
||||
if not whistle:
|
||||
whistle = line
|
||||
|
|
23
daemon.py
23
daemon.py
|
@ -5106,6 +5106,26 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
print('EX: _newswire_update unable to delete ' +
|
||||
filter_newswire_filename)
|
||||
|
||||
# save dogwhistle words list
|
||||
dogwhistles_filename = base_dir + '/accounts/dogwhistles.txt'
|
||||
if fields.get('dogwhistleWords'):
|
||||
try:
|
||||
with open(dogwhistles_filename, 'w+',
|
||||
encoding='utf-8') as fp_dogwhistles:
|
||||
fp_dogwhistles.write(fields['dogwhistleWords'])
|
||||
except OSError:
|
||||
print('EX: unable to write ' + dogwhistles_filename)
|
||||
self.server.dogwhistles = \
|
||||
load_dogwhistles(dogwhistles_filename)
|
||||
else:
|
||||
if os.path.isfile(dogwhistles_filename):
|
||||
try:
|
||||
os.remove(dogwhistles_filename)
|
||||
except OSError:
|
||||
print('EX: _newswire_update unable to delete ' +
|
||||
dogwhistles_filename)
|
||||
self.server.dogwhistles = {}
|
||||
|
||||
# save news tagging rules
|
||||
hashtag_rules_filename = \
|
||||
base_dir + '/accounts/hashtagrules.txt'
|
||||
|
@ -14978,7 +14998,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
http_prefix,
|
||||
self.server.default_timeline,
|
||||
self.server.theme_name,
|
||||
access_keys)
|
||||
access_keys,
|
||||
self.server.dogwhistles)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "قم بالتبديل إلى عرض الاعتدال",
|
||||
"Minimize attached images": "تصغير الصور المرفقة",
|
||||
"SHOW MEDIA": "عرض الوسائط",
|
||||
"ActivityPub Specification": "مواصفات ActivityPub"
|
||||
"ActivityPub Specification": "مواصفات ActivityPub",
|
||||
"Dogwhistle words": "كلمات Dogwhistle",
|
||||
"Content warnings will be added for the following": "ستتم إضافة تحذيرات المحتوى لما يلي"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "সংযম দৃশ্যে স্যুইচ করুন",
|
||||
"Minimize attached images": "সংযুক্ত ছবি ছোট করুন",
|
||||
"SHOW MEDIA": "মিডিয়া দেখান",
|
||||
"ActivityPub Specification": "ActivityPub স্পেসিফিকেশন"
|
||||
"ActivityPub Specification": "ActivityPub স্পেসিফিকেশন",
|
||||
"Dogwhistle words": "কুকুরের হুইসেল শব্দ",
|
||||
"Content warnings will be added for the following": "নিম্নলিখিত জন্য বিষয়বস্তু সতর্কতা যোগ করা হবে"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Canvia a la visualització de moderació",
|
||||
"Minimize attached images": "Minimitzar les imatges adjuntes",
|
||||
"SHOW MEDIA": "MOSTRA ELS MITJANS",
|
||||
"ActivityPub Specification": "Especificació d'ActivityPub"
|
||||
"ActivityPub Specification": "Especificació d'ActivityPub",
|
||||
"Dogwhistle words": "Paraules de xiulet",
|
||||
"Content warnings will be added for the following": "S'afegiran advertències de contingut per al següent"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Newid i wedd safoni",
|
||||
"Minimize attached images": "Lleihau delweddau sydd ynghlwm",
|
||||
"SHOW MEDIA": "DANGOS CYFRYNGAU",
|
||||
"ActivityPub Specification": "Manyleb GweithgareddPub"
|
||||
"ActivityPub Specification": "Manyleb GweithgareddPub",
|
||||
"Dogwhistle words": "Geiriau chwibanogl",
|
||||
"Content warnings will be added for the following": "Bydd rhybuddion cynnwys yn cael eu hychwanegu ar gyfer y canlynol"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Wechseln Sie zur Moderationsansicht",
|
||||
"Minimize attached images": "Angehängte Bilder minimieren",
|
||||
"SHOW MEDIA": "MEDIEN ZEIGEN",
|
||||
"ActivityPub Specification": "ActivityPub-Spezifikation"
|
||||
"ActivityPub Specification": "ActivityPub-Spezifikation",
|
||||
"Dogwhistle words": "Hundepfeife Worte",
|
||||
"Content warnings will be added for the following": "Inhaltswarnungen werden für Folgendes hinzugefügt"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Μετάβαση σε προβολή εποπτείας",
|
||||
"Minimize attached images": "Ελαχιστοποιήστε τις συνημμένες εικόνες",
|
||||
"SHOW MEDIA": "ΔΕΙΤΕ ΜΕΣΑ",
|
||||
"ActivityPub Specification": "Προδιαγραφές ActivityPub"
|
||||
"ActivityPub Specification": "Προδιαγραφές ActivityPub",
|
||||
"Dogwhistle words": "Σφυρίχτρα λέξεις",
|
||||
"Content warnings will be added for the following": "Θα προστεθούν προειδοποιήσεις περιεχομένου για τα ακόλουθα"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Switch to moderation view",
|
||||
"Minimize attached images": "Minimize attached images",
|
||||
"SHOW MEDIA": "SHOW MEDIA",
|
||||
"ActivityPub Specification": "ActivityPub Specification"
|
||||
"ActivityPub Specification": "ActivityPub Specification",
|
||||
"Dogwhistle words": "Dogwhistle words",
|
||||
"Content warnings will be added for the following": "Content warnings will be added for the following"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Cambiar a la vista de moderación",
|
||||
"Minimize attached images": "Minimizar imágenes adjuntas",
|
||||
"SHOW MEDIA": "MOSTRAR MEDIOS",
|
||||
"ActivityPub Specification": "Especificación de ActivityPub"
|
||||
"ActivityPub Specification": "Especificación de ActivityPub",
|
||||
"Dogwhistle words": "Palabras de silbato para perros",
|
||||
"Content warnings will be added for the following": "Se agregarán advertencias de contenido para lo siguiente"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Passer en mode modération",
|
||||
"Minimize attached images": "Réduire les images jointes",
|
||||
"SHOW MEDIA": "AFFICHER LES MÉDIAS",
|
||||
"ActivityPub Specification": "Spécification ActivityPub"
|
||||
"ActivityPub Specification": "Spécification ActivityPub",
|
||||
"Dogwhistle words": "Mots de sifflet de chien",
|
||||
"Content warnings will be added for the following": "Des avertissements de contenu seront ajoutés pour les éléments suivants"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Athraigh go dtí an t-amharc modhnóireachta",
|
||||
"Minimize attached images": "Íoslaghdaigh íomhánna ceangailte",
|
||||
"SHOW MEDIA": "Taispeáin MEÁIN",
|
||||
"ActivityPub Specification": "Sonraíocht ActivityPub"
|
||||
"ActivityPub Specification": "Sonraíocht ActivityPub",
|
||||
"Dogwhistle words": "Focail feadóg mhadra",
|
||||
"Content warnings will be added for the following": "Cuirfear rabhaidh ábhair leis maidir leis na nithe seo a leanas"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "मॉडरेशन दृश्य पर स्विच करें",
|
||||
"Minimize attached images": "संलग्न छवियों को छोटा करें",
|
||||
"SHOW MEDIA": "मीडिया दिखाएं",
|
||||
"ActivityPub Specification": "गतिविधिपब विशिष्टता"
|
||||
"ActivityPub Specification": "गतिविधिपब विशिष्टता",
|
||||
"Dogwhistle words": "कुत्ते की सीटी शब्द",
|
||||
"Content warnings will be added for the following": "निम्नलिखित के लिए सामग्री चेतावनियां जोड़ दी जाएंगी"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Passa alla visualizzazione moderazione",
|
||||
"Minimize attached images": "Riduci al minimo le immagini allegate",
|
||||
"SHOW MEDIA": "MOSTRA MEDIA",
|
||||
"ActivityPub Specification": "Specifica ActivityPub"
|
||||
"ActivityPub Specification": "Specifica ActivityPub",
|
||||
"Dogwhistle words": "Parole da fischietto",
|
||||
"Content warnings will be added for the following": "Verranno aggiunti avvisi sui contenuti per quanto segue"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "モデレートビューに切り替えます",
|
||||
"Minimize attached images": "添付画像を最小限に抑える",
|
||||
"SHOW MEDIA": "メディアを表示",
|
||||
"ActivityPub Specification": "ActivityPubの仕様"
|
||||
"ActivityPub Specification": "ActivityPubの仕様",
|
||||
"Dogwhistle words": "犬笛の言葉",
|
||||
"Content warnings will be added for the following": "以下のコンテンツ警告が追加されます"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "검토 보기로 전환",
|
||||
"Minimize attached images": "첨부된 이미지 최소화",
|
||||
"SHOW MEDIA": "미디어 표시",
|
||||
"ActivityPub Specification": "ActivityPub 사양"
|
||||
"ActivityPub Specification": "ActivityPub 사양",
|
||||
"Dogwhistle words": "개 휘파람 단어",
|
||||
"Content warnings will be added for the following": "다음에 대한 콘텐츠 경고가 추가됩니다."
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Biguherîne bo dîtina moderatoriyê",
|
||||
"Minimize attached images": "Wêneyên pêvekirî kêm bikin",
|
||||
"SHOW MEDIA": "MEDYA NÎŞAN DE",
|
||||
"ActivityPub Specification": "Specification ActivityPub"
|
||||
"ActivityPub Specification": "Specification ActivityPub",
|
||||
"Dogwhistle words": "Peyvên kûçikê",
|
||||
"Content warnings will be added for the following": "Hişyariyên naverokê dê ji bo jêrîn werin zêdekirin"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Overschakelen naar moderatieweergave",
|
||||
"Minimize attached images": "Bijgevoegde afbeeldingen minimaliseren",
|
||||
"SHOW MEDIA": "TOON MEDIA",
|
||||
"ActivityPub Specification": "ActivityPub-specificatie"
|
||||
"ActivityPub Specification": "ActivityPub-specificatie",
|
||||
"Dogwhistle words": "Hondenfluitwoorden",
|
||||
"Content warnings will be added for the following": "Er worden inhoudswaarschuwingen toegevoegd voor het volgende:"
|
||||
}
|
||||
|
|
|
@ -561,5 +561,7 @@
|
|||
"Switch to moderation view": "Switch to moderation view",
|
||||
"Minimize attached images": "Minimize attached images",
|
||||
"SHOW MEDIA": "SHOW MEDIA",
|
||||
"ActivityPub Specification": "ActivityPub Specification"
|
||||
"ActivityPub Specification": "ActivityPub Specification",
|
||||
"Dogwhistle words": "Dogwhistle words",
|
||||
"Content warnings will be added for the following": "Content warnings will be added for the following"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Przełącz na widok moderacji",
|
||||
"Minimize attached images": "Zminimalizuj załączone obrazy",
|
||||
"SHOW MEDIA": "POKAŻ MEDIA",
|
||||
"ActivityPub Specification": "Specyfikacja ActivityPub"
|
||||
"ActivityPub Specification": "Specyfikacja ActivityPub",
|
||||
"Dogwhistle words": "Słowa gwizdka na psa",
|
||||
"Content warnings will be added for the following": "Ostrzeżenia dotyczące treści zostaną dodane do następujących"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Mudar para a visualização de moderação",
|
||||
"Minimize attached images": "Minimizar imagens anexadas",
|
||||
"SHOW MEDIA": "MOSTRAR MÍDIA",
|
||||
"ActivityPub Specification": "Especificação do ActivityPub"
|
||||
"ActivityPub Specification": "Especificação do ActivityPub",
|
||||
"Dogwhistle words": "Palavras de apito",
|
||||
"Content warnings will be added for the following": "Avisos de conteúdo serão adicionados para os seguintes"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Перейти в режим модерации",
|
||||
"Minimize attached images": "Свернуть прикрепленные изображения",
|
||||
"SHOW MEDIA": "ПОКАЗАТЬ МЕДИА",
|
||||
"ActivityPub Specification": "Спецификация ActivityPub"
|
||||
"ActivityPub Specification": "Спецификация ActivityPub",
|
||||
"Dogwhistle words": "Собачий свисток",
|
||||
"Content warnings will be added for the following": "Предупреждения о содержании будут добавлены для следующих"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Badili hadi mwonekano wa udhibiti",
|
||||
"Minimize attached images": "Punguza picha zilizoambatishwa",
|
||||
"SHOW MEDIA": "ONESHA VYOMBO VYA HABARI",
|
||||
"ActivityPub Specification": "Vipimo vya ActivityPub"
|
||||
"ActivityPub Specification": "Vipimo vya ActivityPub",
|
||||
"Dogwhistle words": "Maneno ya mbwa",
|
||||
"Content warnings will be added for the following": "Maonyo ya maudhui yataongezwa kwa yafuatayo"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Denetleme görünümüne geç",
|
||||
"Minimize attached images": "Ekli resimleri simge durumuna küçült",
|
||||
"SHOW MEDIA": "MEDYA GÖSTER",
|
||||
"ActivityPub Specification": "ActivityPub Spesifikasyonu"
|
||||
"ActivityPub Specification": "ActivityPub Spesifikasyonu",
|
||||
"Dogwhistle words": "İtiraf sözleri",
|
||||
"Content warnings will be added for the following": "Aşağıdakiler için içerik uyarıları eklenecek"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "Перейти до режиму модерації",
|
||||
"Minimize attached images": "Мінімізуйте вкладені зображення",
|
||||
"SHOW MEDIA": "ПОКАЗАТИ ЗМІ",
|
||||
"ActivityPub Specification": "Специфікація ActivityPub"
|
||||
"ActivityPub Specification": "Специфікація ActivityPub",
|
||||
"Dogwhistle words": "Собачі слова",
|
||||
"Content warnings will be added for the following": "Попередження про вміст буде додано для наступних"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "באַשטימען צו מאַדעריישאַן מיינונג",
|
||||
"Minimize attached images": "מינאַמייז אַטאַטשט בילדער",
|
||||
"SHOW MEDIA": "ווייַז מעדיע",
|
||||
"ActivityPub Specification": "ActivityPub באַשרייַבונג"
|
||||
"ActivityPub Specification": "ActivityPub באַשרייַבונג",
|
||||
"Dogwhistle words": "דאָגווהיסטלע ווערטער",
|
||||
"Content warnings will be added for the following": "אינהאַלט וואָרנינגז וועט זיין מוסיף פֿאַר די פאלגענדע"
|
||||
}
|
||||
|
|
|
@ -565,5 +565,7 @@
|
|||
"Switch to moderation view": "切换到审核视图",
|
||||
"Minimize attached images": "最小化附加图像",
|
||||
"SHOW MEDIA": "展示媒体",
|
||||
"ActivityPub Specification": "ActivityPub 规范"
|
||||
"ActivityPub Specification": "ActivityPub 规范",
|
||||
"Dogwhistle words": "狗哨的话",
|
||||
"Content warnings will be added for the following": "将为以下内容添加内容警告"
|
||||
}
|
||||
|
|
|
@ -549,7 +549,7 @@ def html_newswire_mobile(css_cache: {}, base_dir: str, nickname: str,
|
|||
def html_edit_newswire(css_cache: {}, translate: {}, base_dir: str, path: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
default_timeline: str, theme: str,
|
||||
access_keys: {}) -> str:
|
||||
access_keys: {}, dogwhistles: {}) -> str:
|
||||
"""Shows the edit newswire screen
|
||||
"""
|
||||
if '/users/' not in path:
|
||||
|
@ -645,6 +645,22 @@ def html_edit_newswire(css_cache: {}, translate: {}, base_dir: str, path: str,
|
|||
'name="filteredWordsNewswire" style="height:50vh" ' + \
|
||||
'spellcheck="true">' + filter_str + '</textarea>\n'
|
||||
|
||||
dogwhistle_str = ''
|
||||
for whistle, category in dogwhistles.items():
|
||||
if not category:
|
||||
continue
|
||||
dogwhistle_str += whistle + ' -> ' + category + '\n'
|
||||
|
||||
edit_newswire_form += \
|
||||
' <br><b><label class="labels">' + \
|
||||
translate['Dogwhistle words'] + '</label></b>\n'
|
||||
edit_newswire_form += ' <br><label class="labels">' + \
|
||||
translate['Content warnings will be added for the following'] + \
|
||||
':</label>'
|
||||
edit_newswire_form += ' <textarea id="message" ' + \
|
||||
'name="dogwhistleWords" style="height:50vh" ' + \
|
||||
'spellcheck="true">' + dogwhistle_str + '</textarea>\n'
|
||||
|
||||
hashtag_rules_str = ''
|
||||
hashtag_rules_filename = \
|
||||
base_dir + '/accounts/hashtagrules.txt'
|
||||
|
|
|
@ -1566,13 +1566,12 @@ def _add_dogwhistle_warnings(summary: str, content: str,
|
|||
if not detected:
|
||||
return summary
|
||||
|
||||
for whistle, item in detected.items():
|
||||
for _, item in detected.items():
|
||||
if not item.get('category'):
|
||||
continue
|
||||
if 'dogwhistle' not in whistle:
|
||||
whistle_str = whistle + ' dogwhistle'
|
||||
else:
|
||||
whistle_str = whistle
|
||||
whistle_str = item['category']
|
||||
if translate.get(whistle_str):
|
||||
whistle_str = translate[whistle_str]
|
||||
if summary:
|
||||
summary += ', ' + whistle_str
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue