From 14a956d207eb224f9e6da75cd496222f6bd064e4 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Wed, 22 May 2024 16:28:06 -0600 Subject: [PATCH] Change: Change the way sessions are named to put the account first, then the social network. --- doc/changelog.md | 2 ++ src/sessions/gotosocial/session.py | 2 ++ src/sessions/mastodon/session.py | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/changelog.md b/doc/changelog.md index dc9b3cdf..ad07f598 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -2,6 +2,8 @@ TWBlue Changelog ## 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: * 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. diff --git a/src/sessions/gotosocial/session.py b/src/sessions/gotosocial/session.py index efc5e97c..f9228853 100644 --- a/src/sessions/gotosocial/session.py +++ b/src/sessions/gotosocial/session.py @@ -3,9 +3,11 @@ from sessions.mastodon import session class Session(session.Session): # disable version check so Mastodon.py won't throw exceptions. version_check_mode = "none" + name = "GoToSocial" def get_lists(self): """ Gets the lists that the user is subscribed to and stores them in the database. Returns None.""" self.db["lists"] = [] + def get_muted_users(self): self.db["muted_users"] = [] diff --git a/src/sessions/mastodon/session.py b/src/sessions/mastodon/session.py index 86cb6780..d2b6821a 100644 --- a/src/sessions/mastodon/session.py +++ b/src/sessions/mastodon/session.py @@ -23,6 +23,7 @@ MASTODON_VERSION = "4.0.1" class Session(base.baseSession): version_check_mode = "created" + name = "Mastodon" def __init__(self, *args, **kwargs): super(Session, self).__init__(*args, **kwargs) @@ -52,7 +53,7 @@ class Session(base.baseSession): log.debug("Logged.") self.counter = 0 except MastodonError: - log.exception("The login attempt failed.") + log.exception(f"The login attempt failed on instance {self.settings['mastodon']['instance']}.") self.logged = False else: self.logged = False @@ -241,7 +242,7 @@ class Session(base.baseSession): instance = self.settings["mastodon"]["instance"] instance = instance.replace("https://", "") user = self.settings["mastodon"]["user_name"] - return "Mastodon: {}@{}".format(user, instance) + return "{}@{} ({})".format(user, instance, self.name) def start_streaming(self): if self.settings["general"]["disable_streaming"]: