mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-07 22:32:58 -04:00
Fix conflict from receiver-mode-gui branch
This commit is contained in:
commit
b0d2183a3e
8 changed files with 91 additions and 16 deletions
|
@ -322,7 +322,7 @@ class Common(object):
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}""",
|
}""",
|
||||||
|
|
||||||
# Recieve mode and child widget styles
|
# Receive mode and child widget styles
|
||||||
'receive_file': """
|
'receive_file': """
|
||||||
QWidget {
|
QWidget {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
|
|
|
@ -356,7 +356,7 @@ class Web(object):
|
||||||
print(strings._('error_downloads_dir_not_writable').format(self.common.settings.get('downloads_dir')))
|
print(strings._('error_downloads_dir_not_writable').format(self.common.settings.get('downloads_dir')))
|
||||||
valid = False
|
valid = False
|
||||||
if not valid:
|
if not valid:
|
||||||
flash('Error uploading, please inform the OnionShare user')
|
flash('Error uploading, please inform the OnionShare user', 'error')
|
||||||
if self.common.settings.get('public_mode'):
|
if self.common.settings.get('public_mode'):
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
else:
|
else:
|
||||||
|
@ -415,10 +415,10 @@ class Web(object):
|
||||||
# Note that flash strings are on English, and not translated, on purpose,
|
# Note that flash strings are on English, and not translated, on purpose,
|
||||||
# to avoid leaking the locale of the OnionShare user
|
# to avoid leaking the locale of the OnionShare user
|
||||||
if len(filenames) == 0:
|
if len(filenames) == 0:
|
||||||
flash('No files uploaded')
|
flash('No files uploaded', 'info')
|
||||||
else:
|
else:
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
flash('Uploaded {}'.format(filename))
|
flash('Sent {}'.format(filename), 'info')
|
||||||
|
|
||||||
if self.common.settings.get('public_mode'):
|
if self.common.settings.get('public_mode'):
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
|
|
|
@ -147,7 +147,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
self.receive_mode.server_status.url_copied.connect(self.copy_url)
|
self.receive_mode.server_status.url_copied.connect(self.copy_url)
|
||||||
self.receive_mode.server_status.hidservauth_copied.connect(self.copy_hidservauth)
|
self.receive_mode.server_status.hidservauth_copied.connect(self.copy_hidservauth)
|
||||||
self.receive_mode.set_server_active.connect(self.set_server_active)
|
self.receive_mode.set_server_active.connect(self.set_server_active)
|
||||||
self.receive_mode.set_server_active.connect(self.set_server_active)
|
|
||||||
|
|
||||||
self.update_mode_switcher()
|
self.update_mode_switcher()
|
||||||
self.update_server_status_indicator()
|
self.update_server_status_indicator()
|
||||||
|
@ -168,7 +167,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
self.setCentralWidget(central_widget)
|
self.setCentralWidget(central_widget)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
# The servers isn't active yet
|
# The server isn't active yet
|
||||||
self.set_server_active(False)
|
self.set_server_active(False)
|
||||||
|
|
||||||
# Create the timer
|
# Create the timer
|
||||||
|
@ -308,6 +307,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
if not self.timer.isActive():
|
if not self.timer.isActive():
|
||||||
self.timer.start(500)
|
self.timer.start(500)
|
||||||
self.share_mode.on_reload_settings()
|
self.share_mode.on_reload_settings()
|
||||||
|
self.receive_mode.on_reload_settings()
|
||||||
self.status_bar.clearMessage()
|
self.status_bar.clearMessage()
|
||||||
|
|
||||||
# If we switched off the shutdown timeout setting, ensure the widget is hidden.
|
# If we switched off the shutdown timeout setting, ensure the widget is hidden.
|
||||||
|
@ -351,6 +351,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
self.system_tray.showMessage(strings._('gui_tor_connection_lost', True), strings._('gui_tor_connection_error_settings', True))
|
self.system_tray.showMessage(strings._('gui_tor_connection_lost', True), strings._('gui_tor_connection_error_settings', True))
|
||||||
|
|
||||||
self.share_mode.handle_tor_broke()
|
self.share_mode.handle_tor_broke()
|
||||||
|
self.receive_mode.handle_tor_broke()
|
||||||
|
|
||||||
# Process events from the web object
|
# Process events from the web object
|
||||||
if self.mode == self.MODE_SHARE:
|
if self.mode == self.MODE_SHARE:
|
||||||
|
|
|
@ -123,6 +123,7 @@ class ReceiveMode(Mode):
|
||||||
"""
|
"""
|
||||||
Connection to Tor broke.
|
Connection to Tor broke.
|
||||||
"""
|
"""
|
||||||
|
self.primary_action.hide()
|
||||||
self.info_widget.hide()
|
self.info_widget.hide()
|
||||||
|
|
||||||
def handle_request_load(self, event):
|
def handle_request_load(self, event):
|
||||||
|
@ -166,6 +167,13 @@ class ReceiveMode(Mode):
|
||||||
"""
|
"""
|
||||||
self.uploads.finished(event["data"]["id"])
|
self.uploads.finished(event["data"]["id"])
|
||||||
|
|
||||||
|
def on_reload_settings(self):
|
||||||
|
"""
|
||||||
|
We should be ok to re-enable the 'Start Receive Mode' button now.
|
||||||
|
"""
|
||||||
|
self.primary_action.show()
|
||||||
|
self.info_widget.show()
|
||||||
|
|
||||||
def reset_info_counters(self):
|
def reset_info_counters(self):
|
||||||
"""
|
"""
|
||||||
Set the info counters back to zero.
|
Set the info counters back to zero.
|
||||||
|
|
|
@ -142,3 +142,53 @@ ul.flashes li {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
li.error {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #c90c0c;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.info {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: #000000;
|
||||||
|
background-color: #a9e26c;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closed-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closed {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closed img {
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closed .closed-header {
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #666666;
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closed .closed-description {
|
||||||
|
color: #666666;
|
||||||
|
margin: 0 0 20px 0;
|
||||||
|
}
|
||||||
|
|
|
@ -3,8 +3,20 @@
|
||||||
<head>
|
<head>
|
||||||
<title>OnionShare is closed</title>
|
<title>OnionShare is closed</title>
|
||||||
<link href="/static/img/favicon.ico" rel="icon" type="image/x-icon" />
|
<link href="/static/img/favicon.ico" rel="icon" type="image/x-icon" />
|
||||||
|
<link href="/static/css/style.css" rel="stylesheet" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>Thank you for using OnionShare</p>
|
<header class="clearfix">
|
||||||
|
<img class="logo" src="/static/img/logo.png" title="OnionShare">
|
||||||
|
<h1>OnionShare</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="closed-wrapper">
|
||||||
|
<div class="closed">
|
||||||
|
<p><img class="logo" src="/static/img/logo_large.png" title="OnionShare"></p>
|
||||||
|
<p class="closed-header">Thank you for using OnionShare</p>
|
||||||
|
<p class="closed-description">You may now close this window.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
<p><input type="file" name="file[]" multiple /></p>
|
<p><input type="file" name="file[]" multiple /></p>
|
||||||
<p><input type="submit" class="button" value="Send Files" /></p>
|
<p><input type="submit" class="button" value="Send Files" /></p>
|
||||||
<div>
|
<div>
|
||||||
{% with messages = get_flashed_messages() %}
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
<ul class=flashes>
|
<ul class=flashes>
|
||||||
{% for message in messages %}
|
{% for category, message in messages %}
|
||||||
<li>{{ message }}</li>
|
<li class="{{ category }}">{{ message }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -35,9 +35,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if receive_allow_receiver_shutdown %}
|
{% if receive_allow_receiver_shutdown %}
|
||||||
|
{% with messages = get_flashed_messages() %}
|
||||||
|
{% if messages %}
|
||||||
<form method="post" action="{{ close_action }}">
|
<form method="post" action="{{ close_action }}">
|
||||||
<input type="submit" class="close-button" value="I'm Finished Uploading" />
|
<input type="submit" class="close-button" value="I'm Finished Sending" />
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -38,11 +38,11 @@ DEFAULT_ZW_FILENAME_REGEX = re.compile(r'^onionshare_[a-z2-7]{6}.zip$')
|
||||||
RANDOM_STR_REGEX = re.compile(r'^[a-z2-7]+$')
|
RANDOM_STR_REGEX = re.compile(r'^[a-z2-7]+$')
|
||||||
|
|
||||||
|
|
||||||
def web_obj(common_obj, recieve_mode, num_files=0):
|
def web_obj(common_obj, receive_mode, num_files=0):
|
||||||
""" Creates a Web object, in either share mode or receive mode, ready for testing """
|
""" Creates a Web object, in either share mode or receive mode, ready for testing """
|
||||||
common_obj.load_settings()
|
common_obj.load_settings()
|
||||||
|
|
||||||
web = Web(common_obj, False, recieve_mode)
|
web = Web(common_obj, False, receive_mode)
|
||||||
web.generate_slug()
|
web.generate_slug()
|
||||||
web.stay_open = True
|
web.stay_open = True
|
||||||
web.running = True
|
web.running = True
|
||||||
|
@ -50,7 +50,7 @@ def web_obj(common_obj, recieve_mode, num_files=0):
|
||||||
web.app.testing = True
|
web.app.testing = True
|
||||||
|
|
||||||
# Share mode
|
# Share mode
|
||||||
if not recieve_mode:
|
if not receive_mode:
|
||||||
# Add files
|
# Add files
|
||||||
files = []
|
files = []
|
||||||
for i in range(num_files):
|
for i in range(num_files):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue