mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-23 05:01:24 -05:00
Check for updates to OnionShare after connecting to Tor via the AutoConnectTab
This commit is contained in:
parent
12b725e821
commit
1fd43b316b
@ -27,9 +27,10 @@ from PySide2 import QtCore, QtWidgets, QtGui
|
||||
from onionshare_cli.settings import Settings
|
||||
|
||||
from . import strings
|
||||
from .threads import CensorshipCircumventionThread
|
||||
from .gui_common import GuiCommon, ToggleCheckbox
|
||||
from .threads import CensorshipCircumventionThread
|
||||
from .tor_connection import TorConnectionWidget
|
||||
from .update_checker import UpdateThread
|
||||
from .widgets import Alert
|
||||
|
||||
class AutoConnectTab(QtWidgets.QWidget):
|
||||
@ -220,6 +221,25 @@ class AutoConnectTab(QtWidgets.QWidget):
|
||||
self.use_bridge_widget.hide()
|
||||
self.first_launch_widget.show()
|
||||
|
||||
def check_for_updates(self):
|
||||
"""
|
||||
Check for OnionShare updates in a new thread, if enabled.
|
||||
"""
|
||||
if self.common.platform == "Windows" or self.common.platform == "Darwin":
|
||||
if self.common.settings.get("use_autoupdate"):
|
||||
|
||||
def update_available(update_url, installed_version, latest_version):
|
||||
Alert(
|
||||
self.common,
|
||||
strings._("update_available").format(
|
||||
update_url, installed_version, latest_version
|
||||
),
|
||||
)
|
||||
|
||||
self.update_thread = UpdateThread(self.common, self.common.gui.onion)
|
||||
self.update_thread.update_available.connect(update_available)
|
||||
self.update_thread.start()
|
||||
|
||||
def tor_con_success(self):
|
||||
"""
|
||||
Finished testing tor connection.
|
||||
@ -231,6 +251,8 @@ class AutoConnectTab(QtWidgets.QWidget):
|
||||
if self.common.gui.onion.is_authenticated() and not self.tor_con.wasCanceled():
|
||||
# Tell the tabs that Tor is connected
|
||||
self.tor_is_connected.emit()
|
||||
# After connecting to Tor, check for updates
|
||||
self.check_for_updates()
|
||||
# Close the tab
|
||||
self.close_this_tab.emit()
|
||||
|
||||
|
@ -25,7 +25,6 @@ from PySide2 import QtCore, QtWidgets, QtGui
|
||||
from . import strings
|
||||
from .widgets import Alert
|
||||
from .connection_tab import AutoConnectTab
|
||||
from .update_checker import UpdateThread
|
||||
from .tab_widget import TabWidget
|
||||
from .settings_tab import SettingsTab
|
||||
from .gui_common import GuiCommon
|
||||
@ -267,25 +266,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
tab = self.tabs.widget(index)
|
||||
tab.settings_have_changed()
|
||||
|
||||
def check_for_updates(self):
|
||||
"""
|
||||
Check for updates in a new thread, if enabled.
|
||||
"""
|
||||
if self.common.platform == "Windows" or self.common.platform == "Darwin":
|
||||
if self.common.settings.get("use_autoupdate"):
|
||||
|
||||
def update_available(update_url, installed_version, latest_version):
|
||||
Alert(
|
||||
self.common,
|
||||
strings._("update_available").format(
|
||||
update_url, installed_version, latest_version
|
||||
),
|
||||
)
|
||||
|
||||
self.update_thread = UpdateThread(self.common, self.common.gui.onion)
|
||||
self.update_thread.update_available.connect(update_available)
|
||||
self.update_thread.start()
|
||||
|
||||
def bring_to_front(self):
|
||||
self.common.log("MainWindow", "bring_to_front")
|
||||
self.raise_()
|
||||
|
Loading…
Reference in New Issue
Block a user