diff --git a/fediseer/apis/models/v1.py b/fediseer/apis/models/v1.py index 053211a..9a0dcbb 100644 --- a/fediseer/apis/models/v1.py +++ b/fediseer/apis/models/v1.py @@ -25,13 +25,14 @@ class Models: 'csv': fields.String(description="The suspicious domains as a csv."), }) self.response_model_instances = api.model('InstanceDetails', { - 'id': fields.Integer(description="The instance id"), - 'domain': fields.String(description="The instance domain"), + 'id': fields.Integer(description="The instance id", example=1), + 'domain': fields.String(description="The instance domain", example="lemmy.dbzer0.com"), + 'software': fields.String(description="The fediverse software running in this instance", example="lemmy"), 'open_registrations': fields.Boolean(description="The instance uptime pct. 100% and thousand of users is unlikely"), 'email_verify': fields.Boolean(description="The amount of local posts in that instance"), 'approvals': fields.Integer(description="The amount of endorsements this instance has given out"), 'endorsements': fields.Integer(description="The amount of endorsements this instance has received"), - 'guarantor': fields.String(description="The domain of the instance which guaranteed this instance."), + 'guarantor': fields.String(description="The domain of the instance which guaranteed this instance.", example="fediseer.com"), }) self.response_model_model_Whitelist_get = api.model('WhitelistedInstances', { 'instances': fields.List(fields.Nested(self.response_model_instances)), diff --git a/fediseer/apis/v1/base.py b/fediseer/apis/v1/base.py index 3c338ec..3f4abde 100644 --- a/fediseer/apis/v1/base.py +++ b/fediseer/apis/v1/base.py @@ -71,8 +71,6 @@ def ensure_instance_registered(domain): if not nodeinfo: raise e.BadRequest(f"Error encountered while polling domain {domain}. Please check it's running correctly") software = nodeinfo["software"]["name"] - if software not in SUPPORTED_SOFTWARE: - raise e.BadRequest(f"Fediverse software {software} not supported at this time") if software == "lemmy": requested_lemmy = Lemmy(f"https://{domain}") site = requested_lemmy.site.get() diff --git a/fediseer/apis/v1/whitelist.py b/fediseer/apis/v1/whitelist.py index faea374..bb85c28 100644 --- a/fediseer/apis/v1/whitelist.py +++ b/fediseer/apis/v1/whitelist.py @@ -69,7 +69,10 @@ class WhitelistDomain(Resource): if not guarantor_instance: raise e.BadRequest(f"Requested guarantor domain {self.args.guarantor} is not registered with the Fediseer yet!") if self.args.admin not in admin_usernames: - raise e.Forbidden(f"Only admins of that {instance.software} are allowed to claim it.") + if len(admin_usernames) == 0: + raise e.Unauthorized(f"We have not implemented admin lookup and messaging for this fediverse software at this point, so this instance cannot be claimed. Please consider sending a PR to add this functionality.") + else: + raise e.Forbidden(f"Only admins of that {instance.software} are allowed to claim it.") existing_claim = database.find_claim(f"@{self.args.admin}@{domain}") if existing_claim: raise e.Forbidden(f"You have already claimed this instance as this admin. Please use the PATCH method to reset your API key.") diff --git a/fediseer/classes/instance.py b/fediseer/classes/instance.py index abc367c..5296656 100644 --- a/fediseer/classes/instance.py +++ b/fediseer/classes/instance.py @@ -78,6 +78,7 @@ class Instance(db.Model): ret_dict = { "id": self.id, "domain": self.domain, + "software": self.software, "open_registrations": self.open_registrations, "email_verify": self.email_verify, "endorsements": len(self.endorsements), diff --git a/fediseer/fediverse.py b/fediseer/fediverse.py index 1ada2b0..dfa8181 100644 --- a/fediseer/fediverse.py +++ b/fediseer/fediverse.py @@ -25,7 +25,7 @@ def get_admin_for_software(software: str, domain: str): "mastodon": get_mastodon_admins, } if software not in software_map: - return None + return [] return software_map[software](domain)