diff --git a/doc/changelog.md b/doc/changelog.md index 10d06d09..f66567be 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -2,7 +2,7 @@ TWBlue Changelog ## changes in this version -In this version, TWBlue will no longer support Twitter sessions starting on February 9, due to Twitter's policies prohibiting third-party clients, in addition to the shutdown of the free access to the Twitter API. All Twitter sessions that are active on TWBlue will stop working as of February 9, when the free API access will finally be shut down. From the TWBlue team, we will continue working to improve our support for Mastodon instances and add other social networks in the near future. If you want to keep in touch with the project, you can follow us in our mastodon account, at [@twblue@maaw.social.](https://maaw.social/@twblue) +In this version, TWBlue will no longer support Twitter sessions starting on February 9, due to Twitter's policies prohibiting third-party clients, in addition to the shutdown of the free access to the Twitter API. All Twitter sessions that are active on TWBlue will stop working as of February 9, when the free API access will finally be shut down. It will not be possible to display or add Twitter sessions from the Session manager. From the TWBlue team, we will continue working to improve our support for Mastodon instances and add other social networks in the near future. If you want to keep in touch with the project, you can follow us in our mastodon account, at [@twblue@maaw.social.](https://maaw.social/@twblue) * In the graphical interface, TWBlue will update menu items, in the menu bar, depending on whether you are focusing a Twitter or Mastodon session. This makes it possible for TWBlue to display the correct terms in each social network. Take into account that there might be unavailable items for the currently active session. * in the keystroke editor for the invisible interface, TWBlue displays the available shortcuts for the currently active session. Descriptions of those keystrokes are also different for Twitter and mastodon sessions to use correct terms for both networks. diff --git a/src/application.py b/src/application.py index ae645e5d..b5338a10 100644 --- a/src/application.py +++ b/src/application.py @@ -1,4 +1,12 @@ # -*- coding: utf-8 -*- +import datetime + +# Make date check for feb 9. +now = datetime.datetime.now() +end_of_twitter = datetime.datetime(2023, 2, 9) +twitter_support_enabled = True +if now >= end_of_twitter: + twitter_support_enabled = False name = 'TWBlue' short_name='twblue' update_url = 'https://twblue.es/updates/updates.php' diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index 05ac80d0..ff4e105c 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -10,6 +10,7 @@ import output import paths import config_utils import config +import application from pubsub import pub from tweepy.errors import TweepyException from controller import settings @@ -66,6 +67,8 @@ class sessionManagerController(object): os.exception("Exception thrown while removing malformed session") continue if config_test.get("twitter") != None: + if application.twitter_support_enabled == False: + continue name = _("{account_name} (Twitter)").format(account_name=config_test["twitter"]["user_name"]) if config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != "": sessionsList.append(name) @@ -99,6 +102,8 @@ class sessionManagerController(object): continue # Create the session object based in session type. if i.get("type") == "twitter": + if application.twitter_support_enabled == False: + continue s = TwitterSession.Session(i.get("id")) elif i.get("type") == "mastodon": s = MastodonSession.Session(i.get("id")) diff --git a/src/sessionmanager/wxUI.py b/src/sessionmanager/wxUI.py index 9b636259..e4f6a4ce 100644 --- a/src/sessionmanager/wxUI.py +++ b/src/sessionmanager/wxUI.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- """ Base GUI (Wx) class for the Session manager module.""" import wx +import application from pubsub import pub from multiplatform_widgets import widgets @@ -50,9 +51,10 @@ class sessionManagerWindow(wx.Dialog): def on_new_account(self, *args, **kwargs): menu = wx.Menu() - twitter = menu.Append(wx.ID_ANY, _("Twitter")) + if application.twitter_support_enabled: + twitter = menu.Append(wx.ID_ANY, _("Twitter")) + menu.Bind(wx.EVT_MENU, self.on_new_twitter_account, twitter) mastodon = menu.Append(wx.ID_ANY, _("Mastodon")) - menu.Bind(wx.EVT_MENU, self.on_new_twitter_account, twitter) menu.Bind(wx.EVT_MENU, self.on_new_mastodon_account, mastodon) self.PopupMenu(menu, self.new.GetPosition()) @@ -64,6 +66,8 @@ class sessionManagerWindow(wx.Dialog): pub.sendMessage("sessionmanager.new_account", type="mastodon") def on_new_twitter_account(self, *args, **kwargs): + if application.twitter_support_enabled == False: + return dlg = wx.MessageDialog(self, _(u"The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?"), _(u"Authorization"), wx.YES_NO) response = dlg.ShowModal() dlg.Destroy()