diff --git a/fediseer/fediverse.py b/fediseer/fediverse.py index 4eea274..b67322c 100644 --- a/fediseer/fediverse.py +++ b/fediseer/fediverse.py @@ -36,6 +36,17 @@ class InstanceInfo(): self.node_info = InstanceInfo.get_nodeinfo("lemmy.dbzer0.com") self.instance_info = {} return + if domain == "fediseer.com": + # Fake instances for testing chain of trust + self.open_registrations = False + self.approval_required = False + self.email_verify = False + self.has_captcha = False + self.software = "fediseer" + self.admin_usernames = {"fediseer"} + self.node_info = {} + self.instance_info = {} + return try: self.node_info = InstanceInfo.get_nodeinfo(domain,req_timeout=self._req_timeout) @@ -217,6 +228,8 @@ class InstanceInfo(): def parse_instance_info(self): + if self.domain == "fediseer.com": + return if not self.node_info: if self._allow_unreachable: self.software = "unknown" diff --git a/fediseer/register.py b/fediseer/register.py index 8b98682..43ee970 100644 --- a/fediseer/register.py +++ b/fediseer/register.py @@ -7,6 +7,8 @@ from datetime import datetime from loguru import logger def ensure_instance_registered(domain, allow_unreachable=False, record_unreachable = False, allowed_timeout=5): + if domain == "localhost": + raise e.BadRequest("Cannot seek for localhost") instance = database.find_instance_by_domain(domain) try: instance_info = InstanceInfo(domain,allow_unreachable=allow_unreachable, req_timeout=allowed_timeout)