From 21882068c58231c80b0f04e84d48066033895dcf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 28 May 2023 11:24:42 +0200 Subject: [PATCH] Continued: - let also user install their software on sub paths ... --- fba.py | 8 ++++---- fetch_instances.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fba.py b/fba.py index e5549ce..af111d3 100644 --- a/fba.py +++ b/fba.py @@ -736,10 +736,10 @@ def update_last_seen(blocker: str, blocked: str, block_level: str): def block_instance(blocker: str, blocked: str, reason: str, block_level: str): # DEBUG: print("DEBUG: blocker,blocked,reason,block_level:", blocker, blocked, reason, block_level) - if not validators.domain(blocker): + if not validators.domain(blocker.split("/")[0]): print("WARNING: Bad blocker:", blocker) raise - elif not validators.domain(blocked): + elif not validators.domain(blocked.split("/")[0]): print("WARNING: Bad blocked:", blocked) raise @@ -784,10 +784,10 @@ def is_instance_registered(domain: str) -> bool: def add_instance(domain: str, origin: str, originator: str): # DEBUG: print("DEBUG: domain,origin:", domain, origin, originator) - if not validators.domain(domain): + if not validators.domain(domain.split("/")[0]): print("WARNING: Bad domain name:", domain) raise - elif origin is not None and not validators.domain(origin): + elif origin is not None and not validators.domain(origin.split("/")[0]): print("WARNING: Bad origin name:", origin) raise diff --git a/fetch_instances.py b/fetch_instances.py index 34c9df9..3e85543 100644 --- a/fetch_instances.py +++ b/fetch_instances.py @@ -30,8 +30,8 @@ def fetch_instances(domain: str, origin: str, software: str): if instance == "": print("WARNING: Empty instance after tidyup(), domain:", domain) continue - elif not validators.domain(instance): - print("WARNING: Bad instance name,domain:", instance, domain) + elif not validators.domain(instance.split("/")[0]): + print(f"WARNING: Bad instance='{domain} from domain='{domain}',origin='{origin}',software='{software}'") continue elif fba.is_blacklisted(instance): # NOISY-DEBUG: print("DEBUG: instance is blacklisted:", instance) -- 2.39.5