From: Roland Häder Date: Sun, 19 Nov 2023 23:58:49 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=eeec166850c3d02b4e5cbd6e5259ef5dc785de79;p=fba.git Continued: - moved translation list out of function (would reinitialized each time) --- diff --git a/fba/networks/lemmy.py b/fba/networks/lemmy.py index ebbe9a1..638cf79 100644 --- a/fba/networks/lemmy.py +++ b/fba/networks/lemmy.py @@ -33,6 +33,40 @@ logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) #logger.setLevel(logging.DEBUG) +# Lemmy translations +translations = [ + "Blocked Instances".lower(), + "Instàncies bloquejades".lower(), + "Blocáilte Ásc".lower(), + "封锁实例".lower(), + "Blokované instance".lower(), + "Geblokkeerde instanties".lower(), + "Blockerade instanser".lower(), + "Instàncias blocadas".lower(), + "Istanze bloccate".lower(), + "Instances bloquées".lower(), + "Letiltott példányok".lower(), + "Instancias bloqueadas".lower(), + "Blokeatuta dauden instantziak".lower(), + "차단된 인스턴스".lower(), + "Peladen Yang Diblokir".lower(), + "Blokerede servere".lower(), + "Blokitaj nodoj".lower(), + "Блокирани Инстанции".lower(), + "Blockierte Instanzen".lower(), + "Estetyt instanssit".lower(), + "Instâncias bloqueadas".lower(), + "Zablokowane instancje".lower(), + "Blokované inÅ¡tancie".lower(), + "المثلاء المحجوبون".lower(), + "Užblokuoti serveriai".lower(), + "ブロックしたインスタンス".lower(), + "Блокированные Инстансы".lower(), + "Αποκλεισμένοι διακομιστές".lower(), + "封鎖站台".lower(), + "Instâncias bloqueadas".lower(), +] + def fetch_peers(domain: str, origin: str) -> list: logger.debug("domain='%s',origin='%s' - CALLED!", domain, origin) domain_helper.raise_on(domain) @@ -90,39 +124,6 @@ def fetch_blocks(domain: str) -> list: if not instances.is_registered(domain): raise Exception(f"domain='{domain}' is not registered but function is invoked.") - translations = [ - "Blocked Instances".lower(), - "Instàncies bloquejades".lower(), - "Blocáilte Ásc".lower(), - "封锁实例".lower(), - "Blokované instance".lower(), - "Geblokkeerde instanties".lower(), - "Blockerade instanser".lower(), - "Instàncias blocadas".lower(), - "Istanze bloccate".lower(), - "Instances bloquées".lower(), - "Letiltott példányok".lower(), - "Instancias bloqueadas".lower(), - "Blokeatuta dauden instantziak".lower(), - "차단된 인스턴스".lower(), - "Peladen Yang Diblokir".lower(), - "Blokerede servere".lower(), - "Blokitaj nodoj".lower(), - "Блокирани Инстанции".lower(), - "Blockierte Instanzen".lower(), - "Estetyt instanssit".lower(), - "Instâncias bloqueadas".lower(), - "Zablokowane instancje".lower(), - "Blokované inÅ¡tancie".lower(), - "المثلاء المحجوبون".lower(), - "Užblokuoti serveriai".lower(), - "ブロックしたインスタンス".lower(), - "Блокированные Инстансы".lower(), - "Αποκλεισμένοι διακομιστές".lower(), - "封鎖站台".lower(), - "Instâncias bloqueadas".lower(), - ] - blocklist = list() try: diff --git a/fba/networks/misskey.py b/fba/networks/misskey.py index 045b506..8ec994d 100644 --- a/fba/networks/misskey.py +++ b/fba/networks/misskey.py @@ -208,8 +208,8 @@ def fetch_blocks(domain: str) -> list: logger.debug("instance[host]='%s' - BEFORE!", instance["host"]) blocked = tidyup.domain(instance["host"]) - logger.debug("blocked[%s]='%s' - AFTER!", type(blocked), blocked) + if blocked is None or blocked == "": logger.warning("instance[host]='%s' is None or empty after tidyup.domain() - SKIPPED!", instance["host"]) continue diff --git a/fba/networks/peertube.py b/fba/networks/peertube.py index 475982c..773af21 100644 --- a/fba/networks/peertube.py +++ b/fba/networks/peertube.py @@ -83,9 +83,7 @@ def fetch_peers(domain: str) -> list: elif record[mode2]["host"] == domain: logger.debug("record[%s]='%s' matches domain='%s' - SKIPPED!", mode2, record[mode2]["host"], domain) continue - - logger.debug("record[%s][host]='%s'", mode2, record[mode2]["host"]) - if not domain_helper.is_wanted(record[mode2]["host"]): + elif not domain_helper.is_wanted(record[mode2]["host"]): logger.debug("record[%s][host]='%s' is not wanted - SKIPPED!", mode2, record[mode2]["host"]) continue diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index 9e4eeb3..a7c2518 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -195,7 +195,10 @@ def fetch_blocks(domain: str) -> list: block_level = tidyup.domain(block_level) if block_level != "" else None logger.debug("block_level='%s' - AFTER!", block_level) - if block_level == "": + if block_level is None: + logger.warning("block_level is now None!") + continue + elif block_level == "": logger.warning("block_level is now empty!") continue elif block_level == "accept":