From df9b267bc442ae0b7a48f7fe9d9b7a16318850c0 Mon Sep 17 00:00:00 2001 From: bashrc Date: Mon, 27 Jul 2026 10:29:05 +0100 Subject: [PATCH] Option to replace dashes with em dashes --- src/content.py | 8 ++++++++ src/daemon_post_profile.py | 28 ++++++++++++++++++++++++++++ src/webapp_profile.py | 17 +++++++++++++++-- translations/ar.json | 3 ++- translations/bn.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/el.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fa.json | 3 ++- translations/fi.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/he.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/ko.json | 3 ++- translations/ku.json | 3 ++- translations/nl.json | 3 ++- translations/oc.json | 3 ++- translations/pl.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/sw.json | 3 ++- translations/tr.json | 3 ++- translations/uk.json | 3 ++- translations/yi.json | 3 ++- translations/zh.json | 3 ++- 31 files changed, 107 insertions(+), 30 deletions(-) diff --git a/src/content.py b/src/content.py index c5006943e..c09d20753 100644 --- a/src/content.py +++ b/src/content.py @@ -332,6 +332,14 @@ def switch_words(base_dir: str, nickname: str, domain: str, content: str, if is_pgp_encrypted(content) or contains_pgp_public_key(content): return content + # replace dashes (-) with em dashes (—) + # This may help LLM scrapers to assume that the text is LLM generated + # and thus exclude it from their data sets + account_dir = acct_dir(base_dir, nickname, domain) + replace_dashes_filename: str = account_dir + '/.replaceDashes' + if is_a_file(replace_dashes_filename): + content = content.replace(' - ', ' — ') + if not rules: switch_words_filename = \ acct_dir(base_dir, nickname, domain) + '/replacewords.txt' diff --git a/src/daemon_post_profile.py b/src/daemon_post_profile.py index b5f1c5a57..5d090d0d7 100644 --- a/src/daemon_post_profile.py +++ b/src/daemon_post_profile.py @@ -934,6 +934,32 @@ def _profile_post_watermark_enabled(base_dir: str, watermark_enabled_filename) +def _profile_post_replace_dashes(base_dir: str, + nickname: str, domain: str, + fields: {}) -> bool: + """ HTTP POST replace dashes (-) with em dashes (—) + This may help LLM scrapers to assume that the text is LLM generated + and thus exclude it from their data sets + """ + replace_dashes_filename = \ + acct_dir(base_dir, nickname, domain) + '/.replaceDashes' + replace_dashes: bool = False + if fields.get('replaceDashes'): + if fields['replaceDashes'] == 'on': + replace_dashes = True + if replace_dashes: + if not is_a_file(replace_dashes_filename): + save_flag_file(replace_dashes_filename, + 'EX: unable to write replaceDashes ' + + replace_dashes_filename) + if not replace_dashes: + if is_a_file(replace_dashes_filename): + erase_file(replace_dashes_filename, + 'EX: _profile_edit ' + + 'unable to delete ' + + replace_dashes_filename) + + def _profile_post_hide_follows(base_dir: str, nickname: str, domain: str, actor_json: {}, fields: {}, self, actor_changed: bool, @@ -3319,6 +3345,8 @@ def profile_edit(self, calling_domain: str, cookie: str, fields) _profile_post_watermark_enabled(base_dir, nickname, domain, fields) + _profile_post_replace_dashes(base_dir, nickname, domain, + fields) notify_likes_filename = \ acct_dir(base_dir, nickname, domain) + '/.notifyLikes' diff --git a/src/webapp_profile.py b/src/webapp_profile.py index 702fff2ff..c50ae2f4c 100644 --- a/src/webapp_profile.py +++ b/src/webapp_profile.py @@ -3391,7 +3391,8 @@ def _html_edit_profile_options(is_admin: bool, premium: bool, no_seen_posts: bool, watermark_enabled: bool, - allow_on_lists: bool) -> str: + allow_on_lists: bool, + replace_dashes: bool) -> str: """option checkboxes section of edit profile screen """ edit_profile_form: str = '
\n' @@ -3479,6 +3480,10 @@ def _html_edit_profile_options(is_admin: bool, edit_profile_form += \ edit_check_box(watermark_str, 'watermarkEnabled', watermark_enabled) + replacedashes_str: str = translate["Replace dashes with em dashes"] + edit_profile_form += \ + edit_check_box(replacedashes_str, 'replaceDashes', replace_dashes) + edit_profile_form += '
\n' return edit_profile_form @@ -3962,6 +3967,14 @@ def html_edit_profile(server, translate: {}, if is_a_file(allow_on_lists_filename): allow_on_lists = True + # replace dashes (-) with em dashes (—) + # This may help LLM scrapers to assume that the text is LLM generated + # and thus exclude it from their data sets + replace_dashes_filename: str = account_dir + '/.replaceDashes' + replace_dashes: bool = False + if is_a_file(replace_dashes_filename): + replace_dashes = True + # Option checkboxes edit_profile_form += \ _html_edit_profile_options(is_admin, manually_approves_followers, @@ -3975,7 +3988,7 @@ def html_edit_profile(server, translate: {}, show_vote_posts, hide_follows, hide_recent_posts, premium, no_seen_posts, watermark_enabled, - allow_on_lists) + allow_on_lists, replace_dashes) # reply controls edit_profile_form += \ diff --git a/translations/ar.json b/translations/ar.json index 7760c8da1..585646682 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -773,5 +773,6 @@ "Loops Instances": "حلقات التكرار", "Disinformation Instances": "أمثلة على التضليل الإعلامي", "Allow this account to be added to lists": "السماح بإضافة هذا الحساب إلى القوائم", - "Apply dithering to images.": "طبّق تقنية التدرج النقطي (dithering) على الصور." + "Apply dithering to images.": "طبّق تقنية التدرج النقطي (dithering) على الصور.", + "Replace dashes with em dashes": "استبدل الشرطات (-) بشرطات طويلة (—)" } diff --git a/translations/bn.json b/translations/bn.json index d60dcb3f9..0ee5804ab 100644 --- a/translations/bn.json +++ b/translations/bn.json @@ -773,5 +773,6 @@ "Loops Instances": "লুপ ইনস্ট্যান্স", "Disinformation Instances": "ভুল তথ্যের উদাহরণ", "Allow this account to be added to lists": "এই অ্যাকাউন্টটিকে তালিকায় যুক্ত করার অনুমতি দিন", - "Apply dithering to images.": "ছবিতে ডিদারিং প্রয়োগ করুন।" + "Apply dithering to images.": "ছবিতে ডিদারিং প্রয়োগ করুন।", + "Replace dashes with em dashes": "ড্যাশগুলোকে এম-ড্যাশ (em dashes) দিয়ে প্রতিস্থাপন করুন।" } diff --git a/translations/ca.json b/translations/ca.json index 52d64bcb2..8bbf5df98 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -773,5 +773,6 @@ "Loops Instances": "Instàncies de bucles", "Disinformation Instances": "Instàncies de desinformació", "Allow this account to be added to lists": "Permet que aquest compte s'afegeixi a les llistes", - "Apply dithering to images.": "Aplica el dithering a les imatges." + "Apply dithering to images.": "Aplica el dithering a les imatges.", + "Replace dashes with em dashes": "Substitueix els guions per guions circulars" } diff --git a/translations/cy.json b/translations/cy.json index fb8350ad8..31b34a226 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -773,5 +773,6 @@ "Loops Instances": "Achosion Dolenni", "Disinformation Instances": "Achosion o Ddadwybodaeth", "Allow this account to be added to lists": "Caniatáu i'r cyfrif hwn gael ei ychwanegu at restrau", - "Apply dithering to images.": "Cymhwyso dithering i ddelweddau." + "Apply dithering to images.": "Cymhwyso dithering i ddelweddau.", + "Replace dashes with em dashes": "Disodli llinellau byr gyda llinellau byr em" } diff --git a/translations/de.json b/translations/de.json index 3f41b91de..06509f9dc 100644 --- a/translations/de.json +++ b/translations/de.json @@ -773,5 +773,6 @@ "Loops Instances": "Schleifeninstanzen", "Disinformation Instances": "Fälle von Desinformation", "Allow this account to be added to lists": "Erlauben, dass dieses Konto zu Listen hinzugefügt wird", - "Apply dithering to images.": "Wenden Sie Dithering auf Bilder an." + "Apply dithering to images.": "Wenden Sie Dithering auf Bilder an.", + "Replace dashes with em dashes": "Ersetzen Sie Bindestriche durch Geviertstriche." } diff --git a/translations/el.json b/translations/el.json index 4a470217a..839494d45 100644 --- a/translations/el.json +++ b/translations/el.json @@ -773,5 +773,6 @@ "Loops Instances": "Παρουσίες βρόχων", "Disinformation Instances": "Περιπτώσεις παραπληροφόρησης", "Allow this account to be added to lists": "Να επιτρέπεται η προσθήκη αυτού του λογαριασμού σε λίστες", - "Apply dithering to images.": "Εφαρμογή πρόσμειξης σε εικόνες." + "Apply dithering to images.": "Εφαρμογή πρόσμειξης σε εικόνες.", + "Replace dashes with em dashes": "Αντικαταστήστε τις παύλες με παύλες em" } diff --git a/translations/en.json b/translations/en.json index 33380071f..2f9b0af14 100644 --- a/translations/en.json +++ b/translations/en.json @@ -773,5 +773,6 @@ "Loops Instances": "Loops Instances", "Disinformation Instances": "Disinformation Instances", "Allow this account to be added to lists": "Allow this account to be added to lists", - "Apply dithering to images.": "Apply dithering to images." + "Apply dithering to images.": "Apply dithering to images.", + "Replace dashes with em dashes": "Replace dashes with em dashes" } diff --git a/translations/es.json b/translations/es.json index 3262c0277..e205272b6 100644 --- a/translations/es.json +++ b/translations/es.json @@ -773,5 +773,6 @@ "Loops Instances": "Instancias de bucles", "Disinformation Instances": "Casos de desinformación", "Allow this account to be added to lists": "Permitir que esta cuenta se añada a listas", - "Apply dithering to images.": "Aplica tramado a las imágenes." + "Apply dithering to images.": "Aplica tramado a las imágenes.", + "Replace dashes with em dashes": "Reemplaza los guiones por rayas." } diff --git a/translations/fa.json b/translations/fa.json index 45d7b8f5b..94c893362 100644 --- a/translations/fa.json +++ b/translations/fa.json @@ -773,5 +773,6 @@ "Loops Instances": "نمونه‌های حلقه‌ها", "Disinformation Instances": "موارد انتشار اطلاعات نادرست", "Allow this account to be added to lists": "اجازه دهید این حساب به لیست‌ها اضافه شود", - "Apply dithering to images.": "اعمال لرزش (dithering) روی تصاویر" + "Apply dithering to images.": "اعمال لرزش (dithering) روی تصاویر", + "Replace dashes with em dashes": "خط تیره را با خط تیره em جایگزین کنید" } diff --git a/translations/fi.json b/translations/fi.json index f601d7ebb..33d46fb2d 100644 --- a/translations/fi.json +++ b/translations/fi.json @@ -773,5 +773,6 @@ "Loops Instances": "Silmukat-instanssit", "Disinformation Instances": "Disinformaatiotapaukset", "Allow this account to be added to lists": "Salli tämän tilin lisääminen listoihin", - "Apply dithering to images.": "Käytä kuviin rasterointia." + "Apply dithering to images.": "Käytä kuviin rasterointia.", + "Replace dashes with em dashes": "Korvaa viivat em-viivoilla" } diff --git a/translations/fr.json b/translations/fr.json index 5b377627c..f801cb4de 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -773,5 +773,6 @@ "Loops Instances": "Instances de boucles", "Disinformation Instances": "Cas de désinformation", "Allow this account to be added to lists": "Autoriser l'ajout de ce compte à des listes", - "Apply dithering to images.": "Appliquez le tramage aux images." + "Apply dithering to images.": "Appliquez le tramage aux images.", + "Replace dashes with em dashes": "Remplacez les tirets par des tirets cadratins." } diff --git a/translations/ga.json b/translations/ga.json index e445d413c..3ccbbf474 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -773,5 +773,6 @@ "Loops Instances": "Cásanna Lúb", "Disinformation Instances": "Cásanna Mífhaisnéise", "Allow this account to be added to lists": "Ceadaigh an cuntas seo a chur le liostaí", - "Apply dithering to images.": "Cuir díodrú i bhfeidhm ar íomhánna." + "Apply dithering to images.": "Cuir díodrú i bhfeidhm ar íomhánna.", + "Replace dashes with em dashes": "Cuir fleascáin em in ionad fleascáin" } diff --git a/translations/he.json b/translations/he.json index 351b32084..d073c51af 100644 --- a/translations/he.json +++ b/translations/he.json @@ -773,5 +773,6 @@ "Loops Instances": "מופעי לולאות", "Disinformation Instances": "מקרים של דיסאינפורמציה", "Allow this account to be added to lists": "אפשר הוספת חשבון זה לרשימות", - "Apply dithering to images.": "החלת דיטרינג על תמונות." + "Apply dithering to images.": "החלת דיטרינג על תמונות.", + "Replace dashes with em dashes": "החלפת מקפים במקפים em" } diff --git a/translations/hi.json b/translations/hi.json index a2e0fbdba..8dd029a4c 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -773,5 +773,6 @@ "Loops Instances": "लूप इंस्टेंस", "Disinformation Instances": "गलत सूचना के उदाहरण", "Allow this account to be added to lists": "इस अकाउंट को लिस्ट में जोड़ने की अनुमति दें", - "Apply dithering to images.": "इमेज पर डिथरिंग लागू करें।" + "Apply dithering to images.": "इमेज पर डिथरिंग लागू करें।", + "Replace dashes with em dashes": "डैश की जगह एम-डैश (em dashes) का इस्तेमाल करें।" } diff --git a/translations/it.json b/translations/it.json index 07af8ec7f..4a7e24cfd 100644 --- a/translations/it.json +++ b/translations/it.json @@ -773,5 +773,6 @@ "Loops Instances": "Istanze di cicli", "Disinformation Instances": "Esempi di disinformazione", "Allow this account to be added to lists": "Consenti l'aggiunta di questo account agli elenchi", - "Apply dithering to images.": "Applica il dithering alle immagini." + "Apply dithering to images.": "Applica il dithering alle immagini.", + "Replace dashes with em dashes": "Sostituisci i trattini con i trattini lunghi." } diff --git a/translations/ja.json b/translations/ja.json index 89b365ef8..85a0d7410 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -773,5 +773,6 @@ "Loops Instances": "ループインスタンス", "Disinformation Instances": "偽情報事例", "Allow this account to be added to lists": "このアカウントをリストに追加できるようにする", - "Apply dithering to images.": "画像にディザリングを適用します。" + "Apply dithering to images.": "画像にディザリングを適用します。", + "Replace dashes with em dashes": "ダッシュをemダッシュに置き換えてください" } diff --git a/translations/ko.json b/translations/ko.json index f3de4fa16..d71a03268 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -773,5 +773,6 @@ "Loops Instances": "루프 인스턴스", "Disinformation Instances": "허위 정보 사례", "Allow this account to be added to lists": "이 계정을 목록에 추가할 수 있도록 허용", - "Apply dithering to images.": "이미지에 디더링을 적용합니다." + "Apply dithering to images.": "이미지에 디더링을 적용합니다.", + "Replace dashes with em dashes": "대시를 엠 대시로 바꾸세요." } diff --git a/translations/ku.json b/translations/ku.json index d49847329..75659d4ba 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -773,5 +773,6 @@ "Loops Instances": "Nimûneyên Loopan", "Disinformation Instances": "Nimûneyên Dezînformasyonê", "Allow this account to be added to lists": "Destûrê bide ku ev hesab li navnîşan were zêdekirin", - "Apply dithering to images.": "Ditheringê li ser wêneyan bicîh bîne." + "Apply dithering to images.": "Ditheringê li ser wêneyan bicîh bîne.", + "Replace dashes with em dashes": "Xêzên xêzkirî bi xêzên em biguherînin" } diff --git a/translations/nl.json b/translations/nl.json index 23e914934..c7645ac8a 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -773,5 +773,6 @@ "Loops Instances": "Lusinstanties", "Disinformation Instances": "Voorbeelden van desinformatie", "Allow this account to be added to lists": "Toestaan ​​dat dit account aan lijsten wordt toegevoegd", - "Apply dithering to images.": "Pas dithering toe op afbeeldingen." + "Apply dithering to images.": "Pas dithering toe op afbeeldingen.", + "Replace dashes with em dashes": "Vervang koppeltekens door kastlijntjes." } diff --git a/translations/oc.json b/translations/oc.json index a4ccee324..9ed4611f9 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -769,5 +769,6 @@ "Loops Instances": "Instàncias de bucles", "Disinformation Instances": "Instàncias de desinformacion", "Allow this account to be added to lists": "Autorizar aqueste compte a èsser apondut a las listas", - "Apply dithering to images.": "Aplicar lo tremolament a d'imatges." + "Apply dithering to images.": "Aplicar lo tremolament a d'imatges.", + "Replace dashes with em dashes": "Remplaçatz los tirets per de tirets em" } diff --git a/translations/pl.json b/translations/pl.json index 692105dd2..a6e5ddc96 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -773,5 +773,6 @@ "Loops Instances": "Instancje pętli", "Disinformation Instances": "Przypadki dezinformacji", "Allow this account to be added to lists": "Zezwól na dodawanie tego konta do list", - "Apply dithering to images.": "Zastosuj dithering do obrazów." + "Apply dithering to images.": "Zastosuj dithering do obrazów.", + "Replace dashes with em dashes": "Zastąp myślniki pauzami." } diff --git a/translations/pt.json b/translations/pt.json index 1735eced2..111ccc1bf 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -773,5 +773,6 @@ "Loops Instances": "Instâncias de Loops", "Disinformation Instances": "Casos de desinformação", "Allow this account to be added to lists": "Permitir que esta conta seja adicionada às listas", - "Apply dithering to images.": "Aplicar dithering às imagens." + "Apply dithering to images.": "Aplicar dithering às imagens.", + "Replace dashes with em dashes": "Substitua os travessões por travessões longos." } diff --git a/translations/ru.json b/translations/ru.json index d6a3c3243..692dd173c 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -773,5 +773,6 @@ "Loops Instances": "Экземпляры циклов", "Disinformation Instances": "Случаи дезинформации", "Allow this account to be added to lists": "Разрешить добавление этого аккаунта в списки", - "Apply dithering to images.": "Примените дизеринг к изображениям." + "Apply dithering to images.": "Примените дизеринг к изображениям.", + "Replace dashes with em dashes": "Замените дефисы на тире." } diff --git a/translations/sw.json b/translations/sw.json index 9928f77dc..b551b4ffc 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -773,5 +773,6 @@ "Loops Instances": "Matukio ya Mizunguko", "Disinformation Instances": "Matukio ya Taarifa Potofu", "Allow this account to be added to lists": "Ruhusu akaunti hii iongezwe kwenye orodha", - "Apply dithering to images.": "Weka upau wa kuchorea kwenye picha." + "Apply dithering to images.": "Weka upau wa kuchorea kwenye picha.", + "Replace dashes with em dashes": "Badilisha dashibodi na dashibodi za em" } diff --git a/translations/tr.json b/translations/tr.json index b66f0c9b9..75dd71927 100644 --- a/translations/tr.json +++ b/translations/tr.json @@ -773,5 +773,6 @@ "Loops Instances": "Döngü Örnekleri", "Disinformation Instances": "Dezenformasyon Vakaları", "Allow this account to be added to lists": "Bu hesabın listelere eklenmesine izin ver", - "Apply dithering to images.": "Görüntülere dithering uygulayın." + "Apply dithering to images.": "Görüntülere dithering uygulayın.", + "Replace dashes with em dashes": "Kısa çizgileri uzun çizgilerle (em dash) değiştirin." } diff --git a/translations/uk.json b/translations/uk.json index b547aad3c..ba7abadeb 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -773,5 +773,6 @@ "Loops Instances": "Екземпляри циклів", "Disinformation Instances": "Випадки дезінформації", "Allow this account to be added to lists": "Дозволити додавання цього облікового запису до списків", - "Apply dithering to images.": "Застосуйте дизеринг до зображень." + "Apply dithering to images.": "Застосуйте дизеринг до зображень.", + "Replace dashes with em dashes": "Замініть тире довгими тире" } diff --git a/translations/yi.json b/translations/yi.json index c8da171ad..eb46860a5 100644 --- a/translations/yi.json +++ b/translations/yi.json @@ -773,5 +773,6 @@ "Loops Instances": "לופּס אינסטאַנסן", "Disinformation Instances": "דיסאינפארמאציע אינסטאַנצן", "Allow this account to be added to lists": "ערלויבן דעם חשבון צו ווערן צוגעגעבן צו ליסטעס", - "Apply dithering to images.": "צולייגן דיטערינג צו בילדער." + "Apply dithering to images.": "צולייגן דיטערינג צו בילדער.", + "Replace dashes with em dashes": "פֿאַרבײַטן די שטריכלעך מיט עמ־שטרייכלעך" } diff --git a/translations/zh.json b/translations/zh.json index a351c8b94..dfa814b6f 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -773,5 +773,6 @@ "Loops Instances": "循环实例", "Disinformation Instances": "虚假信息实例", "Allow this account to be added to lists": "允许将此帐户添加到列表中", - "Apply dithering to images.": "对图像应用抖动处理。" + "Apply dithering to images.": "对图像应用抖动处理。", + "Replace dashes with em dashes": "将连字符替换为长破折号" }