Twitter: Stop supporting Twitter sessions starting on february 9

This commit is contained in:
2023-02-03 10:29:21 -06:00
parent a8c5fc8589
commit f69af7aaa1
4 changed files with 20 additions and 3 deletions

View File

@@ -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'

View File

@@ -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"))

View File

@@ -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()