mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 10:42:58 -03:00
warns about sending large files in GUI (#123)
This commit is contained in:
parent
5b9176c9d4
commit
4f6cff6503
6 changed files with 19 additions and 6 deletions
|
@ -239,9 +239,9 @@ def main():
|
||||||
app.cleanup_filenames.append(web.zip_filename)
|
app.cleanup_filenames.append(web.zip_filename)
|
||||||
|
|
||||||
# warn about sending large files over Tor
|
# warn about sending large files over Tor
|
||||||
if web.zip_filesize >= 209715200: # 200mb
|
if web.zip_filesize >= 157286400: # 150mb
|
||||||
print ''
|
print ''
|
||||||
print strings._("large_filesize").format(helpers.human_readable_filesize(web.zip_filesize))
|
print strings._("large_filesize")
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
# start onionshare service in new thread
|
# start onionshare service in new thread
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"close_on_finish": "Stop server automatically",
|
"close_on_finish": "Stop server automatically",
|
||||||
"choose_file": "Choose a file to share",
|
"choose_file": "Choose a file to share",
|
||||||
"closing_automatically": "Closing automatically because download finished",
|
"closing_automatically": "Closing automatically because download finished",
|
||||||
"large_filesize": "You are sending a total of {0}. Transferring large files using OnionShare might 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",
|
||||||
"help_tails_port": "Tails only: port for opening firewall, starting hidden service",
|
"help_tails_port": "Tails only: port for opening firewall, starting hidden service",
|
||||||
|
|
|
@ -25,7 +25,6 @@ from onionshare import strings, helpers
|
||||||
class Downloads(QtGui.QVBoxLayout):
|
class Downloads(QtGui.QVBoxLayout):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Downloads, self).__init__()
|
super(Downloads, self).__init__()
|
||||||
self.addSpacing(10)
|
|
||||||
|
|
||||||
self.progress_bars = {}
|
self.progress_bars = {}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ class Application(QtGui.QApplication):
|
||||||
class OnionShareGui(QtGui.QWidget):
|
class OnionShareGui(QtGui.QWidget):
|
||||||
start_server_finished = QtCore.pyqtSignal()
|
start_server_finished = QtCore.pyqtSignal()
|
||||||
stop_server_finished = QtCore.pyqtSignal()
|
stop_server_finished = QtCore.pyqtSignal()
|
||||||
|
server_starting = QtCore.pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, qtapp, app):
|
def __init__(self, qtapp, app):
|
||||||
super(OnionShareGui, self).__init__()
|
super(OnionShareGui, self).__init__()
|
||||||
|
@ -73,6 +74,12 @@ class OnionShareGui(QtGui.QWidget):
|
||||||
self.file_selection.file_list.files_updated.connect(self.server_status.update)
|
self.file_selection.file_list.files_updated.connect(self.server_status.update)
|
||||||
self.server_status.url_copied.connect(self.copy_url)
|
self.server_status.url_copied.connect(self.copy_url)
|
||||||
|
|
||||||
|
# filesize warning
|
||||||
|
self.filesize_warning = QtGui.QLabel()
|
||||||
|
self.filesize_warning.setStyleSheet('padding: 10px 0; font-weight: bold; color: #333333;')
|
||||||
|
self.filesize_warning.hide()
|
||||||
|
self.server_starting.connect(self.server_start_update)
|
||||||
|
|
||||||
# downloads
|
# downloads
|
||||||
self.downloads = Downloads()
|
self.downloads = Downloads()
|
||||||
|
|
||||||
|
@ -87,6 +94,7 @@ class OnionShareGui(QtGui.QWidget):
|
||||||
self.layout = QtGui.QVBoxLayout()
|
self.layout = QtGui.QVBoxLayout()
|
||||||
self.layout.addLayout(self.file_selection)
|
self.layout.addLayout(self.file_selection)
|
||||||
self.layout.addLayout(self.server_status)
|
self.layout.addLayout(self.server_status)
|
||||||
|
self.layout.addWidget(self.filesize_warning)
|
||||||
self.layout.addLayout(self.downloads)
|
self.layout.addLayout(self.downloads)
|
||||||
self.layout.addLayout(self.options)
|
self.layout.addLayout(self.options)
|
||||||
self.layout.addWidget(self.status_bar)
|
self.layout.addWidget(self.status_bar)
|
||||||
|
@ -98,6 +106,12 @@ class OnionShareGui(QtGui.QWidget):
|
||||||
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.check_for_requests)
|
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.check_for_requests)
|
||||||
self.timer.start(500)
|
self.timer.start(500)
|
||||||
|
|
||||||
|
def server_start_update(self):
|
||||||
|
# warn about sending large files over Tor
|
||||||
|
if web.zip_filesize >= 157286400: # 150mb
|
||||||
|
self.filesize_warning.setText(strings._("large_filesize", True))
|
||||||
|
self.filesize_warning.show()
|
||||||
|
|
||||||
def start_server(self):
|
def start_server(self):
|
||||||
# start the hidden service
|
# start the hidden service
|
||||||
self.status_bar.showMessage(strings._('gui_starting_server', True).format(self.app.port))
|
self.status_bar.showMessage(strings._('gui_starting_server', True).format(self.app.port))
|
||||||
|
@ -126,6 +140,7 @@ class OnionShareGui(QtGui.QWidget):
|
||||||
# prepare files to share
|
# prepare files to share
|
||||||
web.set_file_info(self.file_selection.file_list.filenames)
|
web.set_file_info(self.file_selection.file_list.filenames)
|
||||||
self.app.cleanup_filenames.append(web.zip_filename)
|
self.app.cleanup_filenames.append(web.zip_filename)
|
||||||
|
self.server_starting.emit()
|
||||||
|
|
||||||
# wait for hs
|
# wait for hs
|
||||||
self.app.wait_for_hs()
|
self.app.wait_for_hs()
|
||||||
|
@ -141,6 +156,7 @@ class OnionShareGui(QtGui.QWidget):
|
||||||
if self.server_status.status == self.server_status.STATUS_STARTED:
|
if self.server_status.status == self.server_status.STATUS_STARTED:
|
||||||
web.stop(self.app.port)
|
web.stop(self.app.port)
|
||||||
self.app.cleanup()
|
self.app.cleanup()
|
||||||
|
self.filesize_warning.hide()
|
||||||
self.stop_server_finished.emit()
|
self.stop_server_finished.emit()
|
||||||
|
|
||||||
def check_for_requests(self):
|
def check_for_requests(self):
|
||||||
|
|
|
@ -25,7 +25,6 @@ from onionshare import strings, helpers
|
||||||
class Options(QtGui.QHBoxLayout):
|
class Options(QtGui.QHBoxLayout):
|
||||||
def __init__(self, web):
|
def __init__(self, web):
|
||||||
super(Options, self).__init__()
|
super(Options, self).__init__()
|
||||||
self.addSpacing(10)
|
|
||||||
|
|
||||||
self.web = web
|
self.web = web
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ class ServerStatus(QtGui.QVBoxLayout):
|
||||||
def __init__(self, qtapp, app, web, file_selection):
|
def __init__(self, qtapp, app, web, file_selection):
|
||||||
super(ServerStatus, self).__init__()
|
super(ServerStatus, self).__init__()
|
||||||
self.status = self.STATUS_STOPPED
|
self.status = self.STATUS_STOPPED
|
||||||
self.addSpacing(10)
|
|
||||||
|
|
||||||
self.qtapp = qtapp
|
self.qtapp = qtapp
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
Loading…
Add table
Reference in a new issue