Change: Change the way sessions are named to put the account first, then the social network.

This commit is contained in:
Manuel Cortez 2024-05-22 16:28:06 -06:00
parent 68651ff736
commit 14a956d207
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
3 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,8 @@ TWBlue Changelog
## changes in this version ## changes in this version
* Core:
* The way sessions are named has been changed. Now the account is indicated first, followed by the social network it belongs to.
* Mastodon: * Mastodon:
* fixed an error that caused TWBlue to not display some posts correctly. * fixed an error that caused TWBlue to not display some posts correctly.
* Fixed name for community timelines when created during startup. Now it should be clear if it's a federated or local timeline. * Fixed name for community timelines when created during startup. Now it should be clear if it's a federated or local timeline.

View File

@ -3,9 +3,11 @@ from sessions.mastodon import session
class Session(session.Session): class Session(session.Session):
# disable version check so Mastodon.py won't throw exceptions. # disable version check so Mastodon.py won't throw exceptions.
version_check_mode = "none" version_check_mode = "none"
name = "GoToSocial"
def get_lists(self): def get_lists(self):
""" Gets the lists that the user is subscribed to and stores them in the database. Returns None.""" """ Gets the lists that the user is subscribed to and stores them in the database. Returns None."""
self.db["lists"] = [] self.db["lists"] = []
def get_muted_users(self): def get_muted_users(self):
self.db["muted_users"] = [] self.db["muted_users"] = []

View File

@ -23,6 +23,7 @@ MASTODON_VERSION = "4.0.1"
class Session(base.baseSession): class Session(base.baseSession):
version_check_mode = "created" version_check_mode = "created"
name = "Mastodon"
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Session, self).__init__(*args, **kwargs) super(Session, self).__init__(*args, **kwargs)
@ -52,7 +53,7 @@ class Session(base.baseSession):
log.debug("Logged.") log.debug("Logged.")
self.counter = 0 self.counter = 0
except MastodonError: except MastodonError:
log.exception("The login attempt failed.") log.exception(f"The login attempt failed on instance {self.settings['mastodon']['instance']}.")
self.logged = False self.logged = False
else: else:
self.logged = False self.logged = False
@ -241,7 +242,7 @@ class Session(base.baseSession):
instance = self.settings["mastodon"]["instance"] instance = self.settings["mastodon"]["instance"]
instance = instance.replace("https://", "") instance = instance.replace("https://", "")
user = self.settings["mastodon"]["user_name"] user = self.settings["mastodon"]["user_name"]
return "Mastodon: {}@{}".format(user, instance) return "{}@{} ({})".format(user, instance, self.name)
def start_streaming(self): def start_streaming(self):
if self.settings["general"]["disable_streaming"]: if self.settings["general"]["disable_streaming"]: