feat: record sw version
parent
c72866a4ee
commit
4fc9f3a84b
|
@ -35,6 +35,7 @@ class Models:
|
|||
'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"),
|
||||
'version': fields.String(description="The fediverse version running in this instance", example="0.19.3"),
|
||||
'claimed': fields.Integer(description="How many admins from this instance has claimed it."),
|
||||
'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."),
|
||||
|
|
|
@ -130,6 +130,7 @@ class Instance(db.Model):
|
|||
approval_required = db.Column(db.Boolean, unique=False, nullable=True, index=True)
|
||||
has_captcha = db.Column(db.Boolean, unique=False, nullable=True, index=True)
|
||||
software = db.Column(db.String(50), unique=False, nullable=False, index=True)
|
||||
version = db.Column(db.String(255), unique=False, nullable=False, index=True)
|
||||
sysadmins = db.Column(db.Integer, unique=False, nullable=True)
|
||||
moderators = db.Column(db.Integer, unique=False, nullable=True)
|
||||
max_list_size = db.Column(db.Integer, unique=False, nullable=False, default=2000)
|
||||
|
@ -170,6 +171,7 @@ class Instance(db.Model):
|
|||
"id": self.id,
|
||||
"domain": self.domain,
|
||||
"software": self.software,
|
||||
"version": self.version,
|
||||
"claimed": len(self.admins),
|
||||
"open_registrations": self.open_registrations,
|
||||
"email_verify": email_verification,
|
||||
|
|
|
@ -12,6 +12,7 @@ class InstanceInfo():
|
|||
instance_info = None
|
||||
admin_usernames = set()
|
||||
software = None
|
||||
version = None
|
||||
open_registrations = None
|
||||
approval_required = None
|
||||
email_verify = None
|
||||
|
@ -32,6 +33,7 @@ class InstanceInfo():
|
|||
self.email_verify = True
|
||||
self.has_captcha = True
|
||||
self.software = "lemmy"
|
||||
self.version = "0.19.3"
|
||||
self.admin_usernames = {"db0"}
|
||||
self.node_info = InstanceInfo.get_nodeinfo("lemmy.dbzer0.com")
|
||||
self.instance_info = {}
|
||||
|
@ -42,6 +44,7 @@ class InstanceInfo():
|
|||
self.email_verify = False
|
||||
self.has_captcha = False
|
||||
self.software = "fediseer"
|
||||
self.version = FEDISEER_VERSION
|
||||
self.admin_usernames = {"fediseer"}
|
||||
self.node_info = {}
|
||||
self.instance_info = {}
|
||||
|
@ -252,10 +255,12 @@ class InstanceInfo():
|
|||
if not self.node_info:
|
||||
if self._allow_unreachable:
|
||||
self.software = "unknown"
|
||||
self.version = "unknown"
|
||||
if "*" in self.domain:
|
||||
self.software = "wildcard"
|
||||
else:
|
||||
self.software = self.node_info["software"]["name"].lower()
|
||||
self.version = self.node_info.get("version","unknown")
|
||||
software_map = {
|
||||
"lemmy": self.get_lemmy_info,
|
||||
"mastodon": self.get_mastodon_info,
|
||||
|
|
|
@ -30,6 +30,7 @@ def ensure_instance_registered(domain, allow_unreachable=False, record_unreachab
|
|||
if instance:
|
||||
if (
|
||||
instance.software != instance_info.software or
|
||||
instance.version != instance_info.version or
|
||||
instance.open_registrations != instance_info.open_registrations or
|
||||
instance.approval_required != instance_info.approval_required or
|
||||
instance.email_verify != instance_info.email_verify or
|
||||
|
@ -40,6 +41,7 @@ def ensure_instance_registered(domain, allow_unreachable=False, record_unreachab
|
|||
# logger.debug(["old", instance.software,instance.open_registrations,instance.approval_required,instance.email_verify,instance.has_captcha])
|
||||
logger.debug(f"Updated instance info for {domain}")
|
||||
instance.software = instance_info.software
|
||||
instance.version = instance_info.version
|
||||
instance.open_registrations = instance_info.open_registrations
|
||||
instance.approval_required = instance_info.approval_required
|
||||
instance.email_verify = instance_info.email_verify
|
||||
|
|
Loading…
Reference in New Issue