mirror of
https://github.com/onionshare/onionshare.git
synced 2025-07-24 15:15:35 -04:00
Check for updates to OnionShare after connecting to Tor via the AutoConnectTab
This commit is contained in:
parent
890c24b0b3
commit
54775ba7b2
2 changed files with 23 additions and 21 deletions
|
@ -27,9 +27,10 @@ from PySide2 import QtCore, QtWidgets, QtGui
|
||||||
from onionshare_cli.settings import Settings
|
from onionshare_cli.settings import Settings
|
||||||
|
|
||||||
from . import strings
|
from . import strings
|
||||||
from .threads import CensorshipCircumventionThread
|
|
||||||
from .gui_common import GuiCommon, ToggleCheckbox
|
from .gui_common import GuiCommon, ToggleCheckbox
|
||||||
|
from .threads import CensorshipCircumventionThread
|
||||||
from .tor_connection import TorConnectionWidget
|
from .tor_connection import TorConnectionWidget
|
||||||
|
from .update_checker import UpdateThread
|
||||||
from .widgets import Alert
|
from .widgets import Alert
|
||||||
|
|
||||||
class AutoConnectTab(QtWidgets.QWidget):
|
class AutoConnectTab(QtWidgets.QWidget):
|
||||||
|
@ -220,6 +221,25 @@ class AutoConnectTab(QtWidgets.QWidget):
|
||||||
self.use_bridge_widget.hide()
|
self.use_bridge_widget.hide()
|
||||||
self.first_launch_widget.show()
|
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):
|
def tor_con_success(self):
|
||||||
"""
|
"""
|
||||||
Finished testing tor connection.
|
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():
|
if self.common.gui.onion.is_authenticated() and not self.tor_con.wasCanceled():
|
||||||
# Tell the tabs that Tor is connected
|
# Tell the tabs that Tor is connected
|
||||||
self.tor_is_connected.emit()
|
self.tor_is_connected.emit()
|
||||||
|
# After connecting to Tor, check for updates
|
||||||
|
self.check_for_updates()
|
||||||
# Close the tab
|
# Close the tab
|
||||||
self.close_this_tab.emit()
|
self.close_this_tab.emit()
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ from PySide2 import QtCore, QtWidgets, QtGui
|
||||||
from . import strings
|
from . import strings
|
||||||
from .widgets import Alert
|
from .widgets import Alert
|
||||||
from .connection_tab import AutoConnectTab
|
from .connection_tab import AutoConnectTab
|
||||||
from .update_checker import UpdateThread
|
|
||||||
from .tab_widget import TabWidget
|
from .tab_widget import TabWidget
|
||||||
from .settings_tab import SettingsTab
|
from .settings_tab import SettingsTab
|
||||||
from .gui_common import GuiCommon
|
from .gui_common import GuiCommon
|
||||||
|
@ -267,25 +266,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
tab = self.tabs.widget(index)
|
tab = self.tabs.widget(index)
|
||||||
tab.settings_have_changed()
|
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):
|
def bring_to_front(self):
|
||||||
self.common.log("MainWindow", "bring_to_front")
|
self.common.log("MainWindow", "bring_to_front")
|
||||||
self.raise_()
|
self.raise_()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue