summaryrefslogtreecommitdiff
path: root/onionshare_gui
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2019-03-06 16:49:32 +1100
committerMiguel Jacq <mig@mig5.net>2019-03-06 16:49:32 +1100
commit00a8b88264776f232495849c7366240e372f57cd (patch)
treec867270508bc5cee86f974bac18198690509d95b /onionshare_gui
parent8889d3d5860e5bf35c9dd49bf499f1d3d1399009 (diff)
downloadonionshare-00a8b88264776f232495849c7366240e372f57cd.tar.gz
onionshare-00a8b88264776f232495849c7366240e372f57cd.zip
Prevent a scheduled share from starting after the scheduled time has passed. Add a test for this
Diffstat (limited to 'onionshare_gui')
-rw-r--r--onionshare_gui/server_status.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/onionshare_gui/server_status.py b/onionshare_gui/server_status.py
index 4bd9241b..3ee10f14 100644
--- a/onionshare_gui/server_status.py
+++ b/onionshare_gui/server_status.py
@@ -312,11 +312,16 @@ class ServerStatus(QtWidgets.QWidget):
Toggle starting or stopping the server.
"""
if self.status == self.STATUS_STOPPED:
+ can_start = True
if self.common.settings.get('startup_timer'):
if self.local_only:
self.scheduled_start = self.startup_timer.dateTime().toPyDateTime()
else:
self.scheduled_start = self.startup_timer.dateTime().toPyDateTime().replace(second=0, microsecond=0)
+ # If the timer has actually passed already before the user hit Start, refuse to start the server.
+ if QtCore.QDateTime.currentDateTime().toPyDateTime() > self.scheduled_start:
+ can_start = False
+ Alert(self.common, strings._('gui_server_startup_timer_expired'), QtWidgets.QMessageBox.Warning)
if self.common.settings.get('shutdown_timeout'):
if self.local_only:
self.timeout = self.shutdown_timeout.dateTime().toPyDateTime()
@@ -325,10 +330,9 @@ class ServerStatus(QtWidgets.QWidget):
self.timeout = self.shutdown_timeout.dateTime().toPyDateTime().replace(second=0, microsecond=0)
# If the timeout has actually passed already before the user hit Start, refuse to start the server.
if QtCore.QDateTime.currentDateTime().toPyDateTime() > self.timeout:
+ can_start = False
Alert(self.common, strings._('gui_server_timeout_expired'), QtWidgets.QMessageBox.Warning)
- else:
- self.start_server()
- else:
+ if can_start:
self.start_server()
elif self.status == self.STATUS_STARTED:
self.stop_server()