from fba import federation
from fba import network
+from fba.helpers import tidyup
+
from fba.models import blocks
from fba.models import instances
except network.exceptions as exception:
print(f"WARNING: Exception during fetching JSON: domain='{domain}',exception[{type(exception)}]:'{str(exception)}'")
+ instances.set_last_error(domain, exception)
# DEBUG: print(f"DEBUG: Adding '{len(peers)}' for domain='{domain}'")
instances.set_total_peers(domain, peers)
raise ValueError("Parameter 'nodeinfo_url' is empty")
translations = [
- "blocked instances",
+ "Blocked Instances",
+ "Instàncies bloquejades",
+ "Blocáilte Ásc",
+ "封锁实例",
+ "Blokované instance",
+ "Geblokkeerde instanties",
+ "Blockerade instanser",
+ "Instàncias blocadas",
+ "Istanze bloccate",
+ "Instances bloquées",
+ "Letiltott példányok",
+ "Instancias bloqueadas",
+ "Blokeatuta dauden instantziak",
+ "차단된 인스턴스",
+ "Peladen Yang Diblokir",
+ "Blokerede servere",
+ "Blokitaj nodoj",
+ "Блокирани Инстанции",
+ "Blockierte Instanzen",
+ "Estetyt instanssit",
+ "Instâncias bloqueadas",
+ "Zablokowane instancje",
+ "Blokované inštancie",
+ "المثلاء المحجوبون",
+ "Užblokuoti serveriai",
+ "ブロックしたインスタンス",
+ "Блокированные Инстансы",
+ "Αποκλεισμένοι διακομιστές",
+ "封鎖站台",
+ "Instâncias bloqueadas",
]
try:
content = header.contents[0]
# DEBUG: print(f"DEBUG: content='{content}'")
- if content.lower() in translations:
+ if content in translations:
# DEBUG: print("DEBUG: Found header with blocked instances - BREAK!")
found = header
break
# DEBUG: print(f"DEBUG: Found {len(blocking)} blocked instance(s) ...")
for tag in blocking:
# DEBUG: print(f"DEBUG: tag[]='{type(tag)}'")
- blocked = tag.contents[0]
+ blocked = tidyup.domain(tag.contents[0])
# DEBUG: print(f"DEBUG: blocked='{blocked}'")
if not validators.domain(blocked):
fba.connection.commit()
except network.exceptions as exception:
print(f"ERROR: domain='{domain}',software='mastodon',exception[{type(exception)}]:'{str(exception)}'")
+ instances.set_last_error(domain, exception)
# DEBUG: print("DEBUG: EXIT!")