mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Mastodon: Implemented setting to disable Streaming API endpoints on sessions
This commit is contained in:
parent
ef2e63e195
commit
24e91235f3
@ -31,6 +31,7 @@ class accountSettingsController(globalSettingsController):
|
|||||||
self.dialog.create_general_account()
|
self.dialog.create_general_account()
|
||||||
# widgetUtils.connect_event(self.dialog.general.userAutocompletionScan, widgetUtils.BUTTON_PRESSED, self.on_autocompletion_scan)
|
# widgetUtils.connect_event(self.dialog.general.userAutocompletionScan, widgetUtils.BUTTON_PRESSED, self.on_autocompletion_scan)
|
||||||
# widgetUtils.connect_event(self.dialog.general.userAutocompletionManage, widgetUtils.BUTTON_PRESSED, self.on_autocompletion_manage)
|
# widgetUtils.connect_event(self.dialog.general.userAutocompletionManage, widgetUtils.BUTTON_PRESSED, self.on_autocompletion_manage)
|
||||||
|
self.dialog.set_value("general", "disable_streaming", self.config["general"]["disable_streaming"])
|
||||||
self.dialog.set_value("general", "relative_time", self.config["general"]["relative_times"])
|
self.dialog.set_value("general", "relative_time", self.config["general"]["relative_times"])
|
||||||
self.dialog.set_value("general", "read_preferences_from_instance", self.config["general"]["read_preferences_from_instance"])
|
self.dialog.set_value("general", "read_preferences_from_instance", self.config["general"]["read_preferences_from_instance"])
|
||||||
self.dialog.set_value("general", "show_screen_names", self.config["general"]["show_screen_names"])
|
self.dialog.set_value("general", "show_screen_names", self.config["general"]["show_screen_names"])
|
||||||
@ -112,6 +113,10 @@ class accountSettingsController(globalSettingsController):
|
|||||||
self.needs_restart = True
|
self.needs_restart = True
|
||||||
log.debug("Triggered app restart due to change in relative times.")
|
log.debug("Triggered app restart due to change in relative times.")
|
||||||
self.config["general"]["relative_times"] = self.dialog.get_value("general", "relative_time")
|
self.config["general"]["relative_times"] = self.dialog.get_value("general", "relative_time")
|
||||||
|
if self.config["general"]["disable_streaming"] != self.dialog.get_value("general", "disable_streaming"):
|
||||||
|
self.needs_restart = True
|
||||||
|
log.debug("Triggered app restart due to change in streaming settings.")
|
||||||
|
self.config["general"]["disable_streaming"] = self.dialog.get_value("general", "disable_streaming")
|
||||||
self.config["general"]["read_preferences_from_instance"] = self.dialog.get_value("general", "read_preferences_from_instance")
|
self.config["general"]["read_preferences_from_instance"] = self.dialog.get_value("general", "read_preferences_from_instance")
|
||||||
self.config["general"]["show_screen_names"] = self.dialog.get_value("general", "show_screen_names")
|
self.config["general"]["show_screen_names"] = self.dialog.get_value("general", "show_screen_names")
|
||||||
self.config["general"]["hide_emojis"] = self.dialog.get_value("general", "hide_emojis")
|
self.config["general"]["hide_emojis"] = self.dialog.get_value("general", "hide_emojis")
|
||||||
|
@ -15,6 +15,7 @@ show_screen_names = boolean(default=False)
|
|||||||
hide_emojis = boolean(default=False)
|
hide_emojis = boolean(default=False)
|
||||||
buffer_order = list(default=list('home', 'local', 'mentions', 'direct_messages', 'sent', 'favorites', 'bookmarks', 'followers', 'following', 'blocked', 'muted', 'notifications'))
|
buffer_order = list(default=list('home', 'local', 'mentions', 'direct_messages', 'sent', 'favorites', 'bookmarks', 'followers', 'following', 'blocked', 'muted', 'notifications'))
|
||||||
boost_mode = string(default="ask")
|
boost_mode = string(default="ask")
|
||||||
|
disable_streaming = boolean(default=False)
|
||||||
|
|
||||||
[sound]
|
[sound]
|
||||||
volume = float(default=1.0)
|
volume = float(default=1.0)
|
||||||
|
@ -223,7 +223,8 @@ class Session(base.baseSession):
|
|||||||
return "Mastodon: {}@{}".format(user, instance)
|
return "Mastodon: {}@{}".format(user, instance)
|
||||||
|
|
||||||
def start_streaming(self):
|
def start_streaming(self):
|
||||||
if config.app["app-settings"]["no_streaming"]:
|
if self.settings["general"]["disable_streaming"]:
|
||||||
|
log.info("Streaming is disabled for session {}. Skipping...".format(self.get_name()))
|
||||||
return
|
return
|
||||||
listener = streaming.StreamListener(session_name=self.get_name(), user_id=self.db["user_id"])
|
listener = streaming.StreamListener(session_name=self.get_name(), user_id=self.db["user_id"])
|
||||||
try:
|
try:
|
||||||
|
@ -20,6 +20,8 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
|
|||||||
autocompletionSizer.Add(self.userAutocompletionScan, 0, wx.ALL, 5)
|
autocompletionSizer.Add(self.userAutocompletionScan, 0, wx.ALL, 5)
|
||||||
autocompletionSizer.Add(self.userAutocompletionManage, 0, wx.ALL, 5)
|
autocompletionSizer.Add(self.userAutocompletionManage, 0, wx.ALL, 5)
|
||||||
sizer.Add(autocompletionSizer, 0, wx.ALL, 5)
|
sizer.Add(autocompletionSizer, 0, wx.ALL, 5)
|
||||||
|
self.disable_streaming = wx.CheckBox(self, wx.ID_ANY, _("Disable Streaming API endpoints"))
|
||||||
|
sizer.Add(self.disable_streaming, 0, wx.ALL, 5)
|
||||||
self.relative_time = wx.CheckBox(self, wx.ID_ANY, _("Relative timestamps"))
|
self.relative_time = wx.CheckBox(self, wx.ID_ANY, _("Relative timestamps"))
|
||||||
sizer.Add(self.relative_time, 0, wx.ALL, 5)
|
sizer.Add(self.relative_time, 0, wx.ALL, 5)
|
||||||
self.read_preferences_from_instance = wx.CheckBox(self, wx.ID_ANY, _("Read preferences from instance (default visibility when publishing and displaying sensitive content)"))
|
self.read_preferences_from_instance = wx.CheckBox(self, wx.ID_ANY, _("Read preferences from instance (default visibility when publishing and displaying sensitive content)"))
|
||||||
|
Loading…
Reference in New Issue
Block a user