fix: fediseer.seek

pull/41/head
db0 2023-09-28 18:26:45 +02:00
parent 757b2989d4
commit 09ccca9127
2 changed files with 15 additions and 0 deletions

View File

@ -36,6 +36,17 @@ class InstanceInfo():
self.node_info = InstanceInfo.get_nodeinfo("lemmy.dbzer0.com") self.node_info = InstanceInfo.get_nodeinfo("lemmy.dbzer0.com")
self.instance_info = {} self.instance_info = {}
return 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: try:
self.node_info = InstanceInfo.get_nodeinfo(domain,req_timeout=self._req_timeout) self.node_info = InstanceInfo.get_nodeinfo(domain,req_timeout=self._req_timeout)
@ -217,6 +228,8 @@ class InstanceInfo():
def parse_instance_info(self): def parse_instance_info(self):
if self.domain == "fediseer.com":
return
if not self.node_info: if not self.node_info:
if self._allow_unreachable: if self._allow_unreachable:
self.software = "unknown" self.software = "unknown"

View File

@ -7,6 +7,8 @@ from datetime import datetime
from loguru import logger from loguru import logger
def ensure_instance_registered(domain, allow_unreachable=False, record_unreachable = False, allowed_timeout=5): 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) instance = database.find_instance_by_domain(domain)
try: try:
instance_info = InstanceInfo(domain,allow_unreachable=allow_unreachable, req_timeout=allowed_timeout) instance_info = InstanceInfo(domain,allow_unreachable=allow_unreachable, req_timeout=allowed_timeout)