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