mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-28 07:17:15 -05:00
Don't auto-stop the share if a download is still in progress
This commit is contained in:
parent
6ad2737d08
commit
3b52f584a1
@ -384,24 +384,17 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
Check for messages communicated from the web app, and update the GUI accordingly.
|
Check for messages communicated from the web app, and update the GUI accordingly.
|
||||||
"""
|
"""
|
||||||
self.update()
|
self.update()
|
||||||
|
global download_in_progress
|
||||||
# If the auto-shutdown timer has stopped, stop the server
|
try:
|
||||||
if self.server_status.status == self.server_status.STATUS_STARTED:
|
download_in_progress
|
||||||
if self.app.shutdown_timer and self.server_status.timer_enabled:
|
except NameError:
|
||||||
if self.timeout > 0:
|
download_in_progress = False
|
||||||
if not self.app.shutdown_timer.is_alive():
|
|
||||||
self.server_status.stop_server()
|
|
||||||
self.status_bar.showMessage(strings._('close_on_timeout',True))
|
|
||||||
self.server_status.shutdown_timeout_reset()
|
|
||||||
|
|
||||||
# scroll to the bottom of the dl progress bar log pane
|
# scroll to the bottom of the dl progress bar log pane
|
||||||
# if a new download has been added
|
# if a new download has been added
|
||||||
if self.new_download:
|
if self.new_download:
|
||||||
self.vbar.setValue(self.vbar.maximum())
|
self.vbar.setValue(self.vbar.maximum())
|
||||||
self.new_download = False
|
self.new_download = False
|
||||||
# only check for requests if the server is running
|
|
||||||
if self.server_status.status != self.server_status.STATUS_STARTED:
|
|
||||||
return
|
|
||||||
|
|
||||||
events = []
|
events = []
|
||||||
|
|
||||||
@ -430,9 +423,11 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
elif event["type"] == web.REQUEST_PROGRESS:
|
elif event["type"] == web.REQUEST_PROGRESS:
|
||||||
self.downloads.update_download(event["data"]["id"], event["data"]["bytes"])
|
self.downloads.update_download(event["data"]["id"], event["data"]["bytes"])
|
||||||
|
download_in_progress = True
|
||||||
|
|
||||||
# is the download complete?
|
# is the download complete?
|
||||||
if event["data"]["bytes"] == web.zip_filesize:
|
if event["data"]["bytes"] == web.zip_filesize:
|
||||||
|
download_in_progress = False
|
||||||
if self.systemTray.supportsMessages() and self.settings.get('systray_notifications'):
|
if self.systemTray.supportsMessages() and self.settings.get('systray_notifications'):
|
||||||
self.systemTray.showMessage(strings._('systray_download_completed_title', True), strings._('systray_download_completed_message', True))
|
self.systemTray.showMessage(strings._('systray_download_completed_title', True), strings._('systray_download_completed_message', True))
|
||||||
# close on finish?
|
# close on finish?
|
||||||
@ -441,6 +436,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
self.server_status.shutdown_timeout_reset()
|
self.server_status.shutdown_timeout_reset()
|
||||||
|
|
||||||
elif event["type"] == web.REQUEST_CANCELED:
|
elif event["type"] == web.REQUEST_CANCELED:
|
||||||
|
download_in_progress = False
|
||||||
self.downloads.cancel_download(event["data"]["id"])
|
self.downloads.cancel_download(event["data"]["id"])
|
||||||
if self.systemTray.supportsMessages() and self.settings.get('systray_notifications'):
|
if self.systemTray.supportsMessages() and self.settings.get('systray_notifications'):
|
||||||
self.systemTray.showMessage(strings._('systray_download_canceled_title', True), strings._('systray_download_canceled_message', True))
|
self.systemTray.showMessage(strings._('systray_download_canceled_title', True), strings._('systray_download_canceled_message', True))
|
||||||
@ -448,6 +444,18 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
elif event["path"] != '/favicon.ico':
|
elif event["path"] != '/favicon.ico':
|
||||||
self.status_bar.showMessage('[#{0:d}] {1:s}: {2:s}'.format(web.error404_count, strings._('other_page_loaded', True), event["path"]))
|
self.status_bar.showMessage('[#{0:d}] {1:s}: {2:s}'.format(web.error404_count, strings._('other_page_loaded', True), event["path"]))
|
||||||
|
|
||||||
|
# If the auto-shutdown timer has stopped, stop the server
|
||||||
|
if self.server_status.status == self.server_status.STATUS_STARTED:
|
||||||
|
if self.app.shutdown_timer and self.server_status.timer_enabled:
|
||||||
|
if self.timeout > 0:
|
||||||
|
if not self.app.shutdown_timer.is_alive():
|
||||||
|
if not download_in_progress:
|
||||||
|
self.server_status.stop_server()
|
||||||
|
self.status_bar.showMessage(strings._('close_on_timeout',True))
|
||||||
|
self.server_status.shutdown_timeout_reset()
|
||||||
|
else:
|
||||||
|
self.status_bar.showMessage(strings._('timeout_download_still_running', True))
|
||||||
|
|
||||||
def copy_url(self):
|
def copy_url(self):
|
||||||
"""
|
"""
|
||||||
When the URL gets copied to the clipboard, display this in the status bar.
|
When the URL gets copied to the clipboard, display this in the status bar.
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
"other_page_loaded": "URL loaded",
|
"other_page_loaded": "URL loaded",
|
||||||
"close_on_timeout": "Closing automatically because timeout was reached",
|
"close_on_timeout": "Closing automatically because timeout was reached",
|
||||||
"closing_automatically": "Closing automatically because download finished",
|
"closing_automatically": "Closing automatically because download finished",
|
||||||
|
"timeout_download_still_running": "Waiting for download to complete before auto-stopping",
|
||||||
"large_filesize": "Warning: Sending large files could take hours",
|
"large_filesize": "Warning: Sending large files could take hours",
|
||||||
"error_tails_invalid_port": "Invalid value, port must be an integer",
|
"error_tails_invalid_port": "Invalid value, port must be an integer",
|
||||||
"error_tails_unknown_root": "Unknown error with Tails root process",
|
"error_tails_unknown_root": "Unknown error with Tails root process",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user