diff --git a/blocking.py b/blocking.py index f8ecf32dc..eff3eef99 100644 --- a/blocking.py +++ b/blocking.py @@ -1922,6 +1922,27 @@ def load_blocked_military(base_dir: str) -> {}: return nicknames_dict +def load_blocked_government(base_dir: str) -> {}: + """Loads a list of nicknames for accounts which block government instances + """ + block_government_filename = data_dir(base_dir) + '/block_government.txt' + nicknames_list = [] + if os.path.isfile(block_government_filename): + try: + with open(block_government_filename, 'r', + encoding='utf-8') as fp_gov: + nicknames_list = fp_gov.read() + except OSError: + print('EX: error while reading block government file') + if not nicknames_list: + return {} + nicknames_list = nicknames_list.split('\n') + nicknames_dict = {} + for nickname in nicknames_list: + nicknames_dict[nickname] = True + return nicknames_dict + + def load_blocked_bluesky(base_dir: str) -> {}: """Loads a list of nicknames for accounts which block bluesky bridges """ @@ -1930,8 +1951,8 @@ def load_blocked_bluesky(base_dir: str) -> {}: if os.path.isfile(block_bluesky_filename): try: with open(block_bluesky_filename, 'r', - encoding='utf-8') as fp_mil: - nicknames_list = fp_mil.read() + encoding='utf-8') as fp_bsky: + nicknames_list = fp_bsky.read() except OSError: print('EX: error while reading block bluesky file') if not nicknames_list: @@ -1959,6 +1980,22 @@ def save_blocked_military(base_dir: str, block_military: {}) -> None: print('EX: error while saving block military file') +def save_blocked_government(base_dir: str, block_government: {}) -> None: + """Saves a list of nicknames for accounts which block government instances + """ + nicknames_str = '' + for nickname, _ in block_government.items(): + nicknames_str += nickname + '\n' + + block_government_filename = data_dir(base_dir) + '/block_government.txt' + try: + with open(block_government_filename, 'w+', + encoding='utf-8') as fp_gov: + fp_gov.write(nicknames_str) + except OSError: + print('EX: error while saving block government file') + + def save_blocked_bluesky(base_dir: str, block_bluesky: {}) -> None: """Saves a list of nicknames for accounts which block bluesky bridges """ @@ -1969,8 +2006,8 @@ def save_blocked_bluesky(base_dir: str, block_bluesky: {}) -> None: block_bluesky_filename = data_dir(base_dir) + '/block_bluesky.txt' try: with open(block_bluesky_filename, 'w+', - encoding='utf-8') as fp_mil: - fp_mil.write(nicknames_str) + encoding='utf-8') as fp_bsky: + fp_bsky.write(nicknames_str) except OSError: print('EX: error while saving block bluesky file') @@ -1982,6 +2019,12 @@ def get_mil_domains_list() -> []: 'sncorp.com', 'sierranevadacorp.us', 'ncontext.com') +def get_gov_domains_list() -> []: + """returns a list of government domains + """ + return ('.gov', '.overheid.nl', '.bund.de') + + def get_bsky_domains_list() -> []: """returns a list of bluesky bridges """ @@ -2005,20 +2048,27 @@ def contains_military_domain(message_str: str) -> bool: return False +def contains_government_domain(message_str: str) -> bool: + """Returns true if the given string contains a government domain + """ + if '.gov.' in message_str: + return True + gov_domains = get_gov_domains_list() + for domain_str in gov_domains: + if domain_str + '"' in message_str or \ + domain_str + '/' in message_str: + return True + return False + + def contains_bluesky_domain(message_str: str) -> bool: """Returns true if the given string contains a bluesky bridge domain """ bsky_domains = get_bsky_domains_list() for domain_str in bsky_domains: - if '.' not in domain_str: - tld = domain_str - if '.' + tld + '"' in message_str or \ - '.' + tld + '/' in message_str: - return True - else: - if domain_str + '"' in message_str or \ - domain_str + '/' in message_str: - return True + if domain_str + '"' in message_str or \ + domain_str + '/' in message_str: + return True return False diff --git a/crawlers.py b/crawlers.py index 8dfbc53bd..537c870a2 100644 --- a/crawlers.py +++ b/crawlers.py @@ -14,6 +14,7 @@ from utils import save_json from utils import user_agent_domain from utils import remove_eol from blocking import get_mil_domains_list +from blocking import get_gov_domains_list from blocking import get_bsky_domains_list from blocking import update_blocked_cache from blocking import is_blocked_domain @@ -112,6 +113,7 @@ def blocked_user_agent(calling_domain: str, agent_str: str, crawlers_allowed: [], known_bots: [], path: str, block_military: {}, + block_government: {}, block_bluesky: {}): """Should a GET or POST be blocked based upon its user agent? """ @@ -252,6 +254,32 @@ def blocked_user_agent(calling_domain: str, agent_str: str, agent_domain) break + # optionally block government domains on a per account basis + if not blocked_ua and block_government: + if '/users/' in path: + # which accounts is this? + nickname = path.split('/users/')[1] + if '/' in nickname: + nickname = nickname.split('/')[0] + # does this account block government domains? + if block_government.get(nickname): + gov_domains = get_gov_domains_list() + for domain_str in gov_domains: + if '.' not in domain_str: + tld = domain_str + if agent_domain.endswith('.' + tld): + blocked_ua = True + print('BLOCK: ' + + 'Blocked government tld user agent: ' + + agent_domain) + break + else: + if agent_domain.endswith(domain_str): + blocked_ua = True + print('BLOCK: Blocked government user agent: ' + + agent_domain) + break + # optionally block bluesky bridges on a per account basis if not blocked_ua and block_bluesky: if '/users/' in path: diff --git a/daemon.py b/daemon.py index f2f4b0e0c..cd0504f56 100644 --- a/daemon.py +++ b/daemon.py @@ -32,6 +32,7 @@ from cwlists import load_cw_lists from blocking import run_federated_blocks_daemon from blocking import load_federated_blocks_endpoints from blocking import load_blocked_military +from blocking import load_blocked_government from blocking import load_blocked_bluesky from blocking import update_blocked_cache from blocking import set_broch_mode @@ -307,6 +308,7 @@ class EpicyonServer(ThreadingHTTPServer): sites_unavailable = None max_shares_on_profile = 0 block_military = {} + block_government = {} block_bluesky = {} followers_synchronization = False followers_sync_cache = {} @@ -785,6 +787,9 @@ def run_daemon(accounts_data_dir: str, # load a list of nicknames for accounts blocking military instances httpd.block_military = load_blocked_military(base_dir) + # load a list of nicknames for accounts blocking government instances + httpd.block_government = load_blocked_government(base_dir) + # load a list of nicknames for accounts blocking bluesky bridges httpd.block_bluesky = load_blocked_bluesky(base_dir) diff --git a/daemon_get.py b/daemon_get.py index 56d11ee8e..dc6d1c202 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -359,6 +359,7 @@ def daemon_http_get(self) -> None: self.server.crawlers_allowed, self.server.known_bots, self.path, self.server.block_military, + self.server.block_government, self.server.block_bluesky) if block: if llm: @@ -4342,6 +4343,7 @@ def daemon_http_get(self) -> None: self.server.reverse_sequence, self.server.buy_sites, self.server.block_military, + self.server.block_government, self.server.block_bluesky, self.server.block_federated_endpoints): self.server.getreq_busy = False diff --git a/daemon_get_profile.py b/daemon_get_profile.py index dfd0d8bd0..bf2634722 100644 --- a/daemon_get_profile.py +++ b/daemon_get_profile.py @@ -534,6 +534,7 @@ def edit_profile2(self, calling_domain: str, path: str, reverse_sequence: bool, buy_sites: [], block_military: {}, + block_government: {}, block_bluesky: {}, block_federated_endpoints: []) -> bool: """Show the edit profile screen @@ -563,6 +564,7 @@ def edit_profile2(self, calling_domain: str, path: str, reverse_sequence, buy_sites, block_military, + block_government, block_bluesky, block_federated_endpoints) if msg: diff --git a/daemon_post.py b/daemon_post.py index fd684e8ad..87f2dbccd 100644 --- a/daemon_post.py +++ b/daemon_post.py @@ -22,6 +22,7 @@ from utils import contains_invalid_chars from utils import remove_id_ending from utils import check_bad_path from blocking import contains_military_domain +from blocking import contains_government_domain from blocking import contains_bluesky_domain from crawlers import blocked_user_agent from session import get_session_for_domain @@ -183,6 +184,7 @@ def daemon_http_post(self) -> None: self.server.crawlers_allowed, self.server.known_bots, self.path, self.server.block_military, + self.server.block_government, self.server.block_bluesky) if block: http_400(self) @@ -1121,6 +1123,12 @@ def daemon_http_post(self) -> None: print('BLOCK: blocked military domain') self.server.postreq_busy = False return + if self.server.block_government.get(nickname): + if contains_government_domain(decoded_message_bytes): + http_400(self) + print('BLOCK: blocked government domain') + self.server.postreq_busy = False + return if self.server.block_bluesky.get(nickname): if contains_bluesky_domain(decoded_message_bytes): http_400(self) diff --git a/daemon_post_profile.py b/daemon_post_profile.py index 86ac04cf7..c9b7fc979 100644 --- a/daemon_post_profile.py +++ b/daemon_post_profile.py @@ -12,6 +12,7 @@ import errno from webfinger import webfinger_update from socket import error as SocketError from blocking import save_blocked_military +from blocking import save_blocked_government from blocking import save_blocked_bluesky from httpheaders import redirect_headers from httpheaders import clear_login_details @@ -854,6 +855,25 @@ def _profile_post_block_military(nickname: str, fields: {}, self) -> None: self.server.block_military) +def _profile_post_block_government(nickname: str, fields: {}, self) -> None: + """ HTTP POST block government instances + """ + block_gov_instances = False + if fields.get('blockGovernment'): + if fields['blockGovernment'] == 'on': + block_gov_instances = True + if block_gov_instances: + if not self.server.block_government.get(nickname): + self.server.block_government[nickname] = True + save_blocked_government(self.server.base_dir, + self.server.block_government) + else: + if self.server.block_government.get(nickname): + del self.server.block_government[nickname] + save_blocked_government(self.server.base_dir, + self.server.block_government) + + def _profile_post_block_bluesky(nickname: str, fields: {}, self) -> None: """ HTTP POST block bluesky bridges """ @@ -3259,6 +3279,7 @@ def profile_edit(self, calling_domain: str, cookie: str, actor_json, fields, self, actor_changed, premium) _profile_post_block_military(nickname, fields, self) + _profile_post_block_government(nickname, fields, self) _profile_post_block_bluesky(nickname, fields, self) _profile_post_no_reply_boosts(base_dir, nickname, domain, fields) diff --git a/translations/ar.json b/translations/ar.json index ee4de1571..7d566861b 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -704,5 +704,6 @@ "Searchable by": "قابلة للبحث بواسطة", "Yourself": "نفسك", "Epicyon Instances": "حالات Epicyon", - "Block BlueSky bridges": "حجب جسور بلو سكاي" + "Block BlueSky bridges": "حجب جسور بلو سكاي", + "Block government instances": "حظر حالات الحكومة" } diff --git a/translations/bn.json b/translations/bn.json index d10ab59f7..f91c2c4ad 100644 --- a/translations/bn.json +++ b/translations/bn.json @@ -704,5 +704,6 @@ "Searchable by": "দ্বারা অনুসন্ধানযোগ্য", "Yourself": "নিজেকে", "Epicyon Instances": "এপিসিয়ন দৃষ্টান্ত", - "Block BlueSky bridges": "ব্লুস্কাই ব্রিজ ব্লক করুন" + "Block BlueSky bridges": "ব্লুস্কাই ব্রিজ ব্লক করুন", + "Block government instances": "সরকারী দৃষ্টান্ত ব্লক করুন" } diff --git a/translations/ca.json b/translations/ca.json index 5236d99a5..5e4938467 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -704,5 +704,6 @@ "Searchable by": "Cercable per", "Yourself": "Tu mateix", "Epicyon Instances": "Instàncies d'Epicyon", - "Block BlueSky bridges": "Bloqueja els ponts BlueSky" + "Block BlueSky bridges": "Bloqueja els ponts BlueSky", + "Block government instances": "Bloquejar instàncies governamentals" } diff --git a/translations/cy.json b/translations/cy.json index f01835540..d133f6608 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -704,5 +704,6 @@ "Searchable by": "Chwiliadwy gan", "Yourself": "Eich Hun", "Epicyon Instances": "Enghreifftiau Epicyon", - "Block BlueSky bridges": "Rhwystro pontydd BlueSky" + "Block BlueSky bridges": "Rhwystro pontydd BlueSky", + "Block government instances": "Rhwystro achosion llywodraeth" } diff --git a/translations/de.json b/translations/de.json index b32e3a17f..6f2ea3ee3 100644 --- a/translations/de.json +++ b/translations/de.json @@ -704,5 +704,6 @@ "Searchable by": "Durchsuchbar nach", "Yourself": "Selbst", "Epicyon Instances": "Epicyon-Instanzen", - "Block BlueSky bridges": "Blockieren Sie BlueSky-Brücken" + "Block BlueSky bridges": "Blockieren Sie BlueSky-Brücken", + "Block government instances": "Blockieren von Regierungsinstanzen" } diff --git a/translations/el.json b/translations/el.json index 4c1817103..eaf3fe810 100644 --- a/translations/el.json +++ b/translations/el.json @@ -704,5 +704,6 @@ "Searchable by": "Δυνατότητα αναζήτησης από", "Yourself": "Σύ ο ίδιος", "Epicyon Instances": "Περιπτώσεις Epicyon", - "Block BlueSky bridges": "Αποκλείστε τις γέφυρες BlueSky" + "Block BlueSky bridges": "Αποκλείστε τις γέφυρες BlueSky", + "Block government instances": "Αποκλεισμός κρατικών περιπτώσεων" } diff --git a/translations/en.json b/translations/en.json index 151d80817..726d53ea3 100644 --- a/translations/en.json +++ b/translations/en.json @@ -704,5 +704,6 @@ "Searchable by": "Searchable by", "Yourself": "Yourself", "Epicyon Instances": "Epicyon Instances", - "Block BlueSky bridges": "Block BlueSky bridges" + "Block BlueSky bridges": "Block BlueSky bridges", + "Block government instances": "Block government instances" } diff --git a/translations/es.json b/translations/es.json index efa393dc8..324a74550 100644 --- a/translations/es.json +++ b/translations/es.json @@ -704,5 +704,6 @@ "Searchable by": "Buscable por", "Yourself": "Tú mismo", "Epicyon Instances": "Instancias de Epicyon", - "Block BlueSky bridges": "Bloquear puentes BlueSky" + "Block BlueSky bridges": "Bloquear puentes BlueSky", + "Block government instances": "Bloquear instancias gubernamentales" } diff --git a/translations/fa.json b/translations/fa.json index f1ae7c0c4..512ca66ae 100644 --- a/translations/fa.json +++ b/translations/fa.json @@ -704,5 +704,6 @@ "Searchable by": "قابل جستجو توسط", "Yourself": "خودت", "Epicyon Instances": "موارد Epicyon", - "Block BlueSky bridges": "پل های BlueSky را مسدود کنید" + "Block BlueSky bridges": "پل های BlueSky را مسدود کنید", + "Block government instances": "موارد دولتی را مسدود کنید" } diff --git a/translations/fi.json b/translations/fi.json index 71858f542..7165a956e 100644 --- a/translations/fi.json +++ b/translations/fi.json @@ -704,5 +704,6 @@ "Searchable by": "Haettavissa", "Yourself": "itseäsi", "Epicyon Instances": "Epicyonin esiintymät", - "Block BlueSky bridges": "Estä BlueSky-sillat" + "Block BlueSky bridges": "Estä BlueSky-sillat", + "Block government instances": "Estä hallituksen esiintymät" } diff --git a/translations/fr.json b/translations/fr.json index d12ed3b63..4031b9223 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -704,5 +704,6 @@ "Searchable by": "Recherchable par", "Yourself": "Toi-même", "Epicyon Instances": "Instances d'Epicyon", - "Block BlueSky bridges": "Bloquer les ponts BlueSky" + "Block BlueSky bridges": "Bloquer les ponts BlueSky", + "Block government instances": "Bloquer les instances gouvernementales" } diff --git a/translations/ga.json b/translations/ga.json index d014541d2..a19ff0f77 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -704,5 +704,6 @@ "Searchable by": "Inchuardaithe ag", "Yourself": "Tú féin", "Epicyon Instances": "Cásanna Epicyon", - "Block BlueSky bridges": "Bloc droichid BlueSky" + "Block BlueSky bridges": "Bloc droichid BlueSky", + "Block government instances": "Cuir bac ar chásanna rialtais" } diff --git a/translations/he.json b/translations/he.json index a49d850e5..9c79c908d 100644 --- a/translations/he.json +++ b/translations/he.json @@ -704,5 +704,6 @@ "Searchable by": "ניתן לחיפוש לפי", "Yourself": "עַצמְךָ", "Epicyon Instances": "מופעי Epicyon", - "Block BlueSky bridges": "חסום גשרי BlueSky" + "Block BlueSky bridges": "חסום גשרי BlueSky", + "Block government instances": "חסום מקרים ממשלתיים" } diff --git a/translations/hi.json b/translations/hi.json index 702ba691a..1ce2793f9 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -704,5 +704,6 @@ "Searchable by": "द्वारा खोजा जा सकता है", "Yourself": "अपने आप को", "Epicyon Instances": "एपिक्योन इंस्टेंसेस", - "Block BlueSky bridges": "ब्लूस्काई पुलों को ब्लॉक करें" + "Block BlueSky bridges": "ब्लूस्काई पुलों को ब्लॉक करें", + "Block government instances": "सरकारी इंस्टेंस ब्लॉक करें" } diff --git a/translations/it.json b/translations/it.json index df3b3efac..1f20844fc 100644 --- a/translations/it.json +++ b/translations/it.json @@ -704,5 +704,6 @@ "Searchable by": "Ricercabile per", "Yourself": "Te stesso", "Epicyon Instances": "Istanze di Epicyon", - "Block BlueSky bridges": "Blocca i ponti BlueSky" + "Block BlueSky bridges": "Blocca i ponti BlueSky", + "Block government instances": "Bloccare le istanze governative" } diff --git a/translations/ja.json b/translations/ja.json index 09b6c5c66..ba0a4061d 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -704,5 +704,6 @@ "Searchable by": "検索可能", "Yourself": "あなた自身", "Epicyon Instances": "エピキオンインスタンス", - "Block BlueSky bridges": "ブルースカイ橋をブロックする" + "Block BlueSky bridges": "ブルースカイ橋をブロックする", + "Block government instances": "政府インスタンスをブロックする" } diff --git a/translations/ko.json b/translations/ko.json index ef04d3d77..5570dba3d 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -704,5 +704,6 @@ "Searchable by": "검색 가능", "Yourself": "당신 자신", "Epicyon Instances": "에피시온 인스턴스", - "Block BlueSky bridges": "블루스카이 다리 차단" + "Block BlueSky bridges": "블루스카이 다리 차단", + "Block government instances": "정부 인스턴스 차단" } diff --git a/translations/ku.json b/translations/ku.json index db415f733..168fc22b8 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -704,5 +704,6 @@ "Searchable by": "Lêgerîn ji hêla", "Yourself": "Xwe", "Epicyon Instances": "Mînakên Epicyon", - "Block BlueSky bridges": "Pirên BlueSky asteng bikin" + "Block BlueSky bridges": "Pirên BlueSky asteng bikin", + "Block government instances": "Bûyerên hikûmetê asteng bikin" } diff --git a/translations/nl.json b/translations/nl.json index f4fcb85e1..5cb54738f 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -704,5 +704,6 @@ "Searchable by": "Doorzoekbaar op", "Yourself": "Jezelf", "Epicyon Instances": "Epicyon-instanties", - "Block BlueSky bridges": "Blokkeer BlueSky-bruggen" + "Block BlueSky bridges": "Blokkeer BlueSky-bruggen", + "Block government instances": "Overheidsinstanties blokkeren" } diff --git a/translations/oc.json b/translations/oc.json index 189b2b90a..31a067628 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -700,5 +700,6 @@ "Searchable by": "Searchable by", "Yourself": "Yourself", "Epicyon Instances": "Epicyon Instances", - "Block BlueSky bridges": "Block BlueSky bridges" + "Block BlueSky bridges": "Block BlueSky bridges", + "Block government instances": "Block government instances" } diff --git a/translations/pl.json b/translations/pl.json index bb4730632..6ca24d693 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -704,5 +704,6 @@ "Searchable by": "Można wyszukiwać według", "Yourself": "Się", "Epicyon Instances": "Instancje Epicyon", - "Block BlueSky bridges": "Zablokuj mosty BlueSky" + "Block BlueSky bridges": "Zablokuj mosty BlueSky", + "Block government instances": "Zablokuj wystąpienia rządowe" } diff --git a/translations/pt.json b/translations/pt.json index ec3b354c9..7b36d5830 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -704,5 +704,6 @@ "Searchable by": "Pesquisável por", "Yourself": "Tu próprio", "Epicyon Instances": "Instâncias Epicyon", - "Block BlueSky bridges": "Bloquear pontes BlueSky" + "Block BlueSky bridges": "Bloquear pontes BlueSky", + "Block government instances": "Bloquear instâncias governamentais" } diff --git a/translations/ru.json b/translations/ru.json index c3872ec1c..dd1a0e74e 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -704,5 +704,6 @@ "Searchable by": "Поиск по", "Yourself": "Сам", "Epicyon Instances": "Эпиционные экземпляры", - "Block BlueSky bridges": "Блокировать мосты BlueSky" + "Block BlueSky bridges": "Блокировать мосты BlueSky", + "Block government instances": "Блокировать правительственные инстанции" } diff --git a/translations/sw.json b/translations/sw.json index 8a536bbc4..f2b320f86 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -704,5 +704,6 @@ "Searchable by": "Inaweza kutafutwa na", "Yourself": "Mwenyewe", "Epicyon Instances": "Matukio ya Epicyon", - "Block BlueSky bridges": "Zuia madaraja ya BlueSky" + "Block BlueSky bridges": "Zuia madaraja ya BlueSky", + "Block government instances": "Zuia matukio ya serikali" } diff --git a/translations/tr.json b/translations/tr.json index 7751c47a0..7b8381200 100644 --- a/translations/tr.json +++ b/translations/tr.json @@ -704,5 +704,6 @@ "Searchable by": "Aranabilir", "Yourself": "Kendin", "Epicyon Instances": "Epikyon Örnekleri", - "Block BlueSky bridges": "BlueSky köprülerini engelle" + "Block BlueSky bridges": "BlueSky köprülerini engelle", + "Block government instances": "Hükümet örneklerini engelle" } diff --git a/translations/uk.json b/translations/uk.json index f8dd48c01..24c76f6d4 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -704,5 +704,6 @@ "Searchable by": "Можливість пошуку за", "Yourself": "себе", "Epicyon Instances": "Примірники Epicyon", - "Block BlueSky bridges": "Блок BlueSky bridges" + "Block BlueSky bridges": "Блок BlueSky bridges", + "Block government instances": "Блокувати державні інстанції" } diff --git a/translations/yi.json b/translations/yi.json index a09c65ead..c79d61d1e 100644 --- a/translations/yi.json +++ b/translations/yi.json @@ -704,5 +704,6 @@ "Searchable by": "זוך דורך", "Yourself": "זיך", "Epicyon Instances": "Epicyon ינסטאַנסיז", - "Block BlueSky bridges": "פאַרשפּאַרן בלוסקי בריקן" + "Block BlueSky bridges": "פאַרשפּאַרן בלוסקי בריקן", + "Block government instances": "פאַרשפּאַרן רעגירונג ינסטאַנסיז" } diff --git a/translations/zh.json b/translations/zh.json index 623f62a10..64a9d05ca 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -704,5 +704,6 @@ "Searchable by": "可搜索", "Yourself": "你自己", "Epicyon Instances": "史诗副本", - "Block BlueSky bridges": "封锁蓝天桥梁" + "Block BlueSky bridges": "封锁蓝天桥梁", + "Block government instances": "阻止政府实例" } diff --git a/webapp_profile.py b/webapp_profile.py index ae286f150..192ab9d9c 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -2408,6 +2408,7 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str, translate: {}, reply_interval_hours: int, cw_lists: {}, lists_enabled: str, buy_sites: {}, block_military: {}, + block_government: {}, block_bluesky: {}, block_federated_endpoints: []) -> str: """Filtering and blocking section of edit profile screen @@ -2686,6 +2687,15 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str, edit_profile_form += \ edit_check_box(idx, 'blockMilitary', block_mil) + idx = 'Block government instances' + if translate.get(idx): + name = translate[idx] + block_gov = False + if block_government.get(nickname): + block_gov = block_government[nickname] + edit_profile_form += \ + edit_check_box(idx, 'blockGovernment', block_gov) + idx = 'Block BlueSky bridges' if translate.get(idx): name = translate[idx] @@ -3275,6 +3285,7 @@ def html_edit_profile(server, translate: {}, reverse_sequence: [], buy_sites: {}, block_military: {}, + block_government: {}, block_bluesky: {}, block_federated_endpoints: []) -> str: """Shows the edit profile screen @@ -3600,7 +3611,8 @@ def html_edit_profile(server, translate: {}, user_agents_blocked, crawlers_allowed, translate, reply_interval_hours, cw_lists, lists_enabled, buy_sites, - block_military, block_bluesky, + block_military, block_government, + block_bluesky, block_federated_endpoints) # git projects section