Add a public server list to the initial login page

This commit is contained in:
miruka
2020-08-19 00:17:24 -04:00
parent 1a6273681d
commit 2fa8b2c5f9
13 changed files with 402 additions and 83 deletions

View File

@@ -30,6 +30,30 @@ class TypeSpecifier(AutoStrEnum):
MembershipChange = auto()
class PingStatus(AutoStrEnum):
"""Enum for the status of a homeserver ping operation."""
Done = auto()
Pinging = auto()
Failed = auto()
@dataclass
class Homeserver(ModelItem):
"""A homeserver we can connect to. The `id` field is the server's URL."""
id: str = field()
name: str = field()
site_url: str = field()
country: str = field()
ping: int = -1
status: PingStatus = PingStatus.Pinging
stability: float = -1
def __lt__(self, other: "Homeserver") -> bool:
return (self.name.lower(), self.id) < (other.name.lower(), other.id)
@dataclass
class Account(ModelItem):
"""A logged in matrix account."""