mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-26 11:13:00 -03:00
In receive mode, allow uploader to close the server when they are done
This commit is contained in:
parent
0b10e71547
commit
01f86daf8f
3 changed files with 36 additions and 13 deletions
|
@ -305,9 +305,7 @@ class Web(object):
|
||||||
valid = True
|
valid = True
|
||||||
|
|
||||||
self.common.log('Web', 'receive_routes', '/upload, uploaded {}, saving to {}'.format(f.filename, local_path))
|
self.common.log('Web', 'receive_routes', '/upload, uploaded {}, saving to {}'.format(f.filename, local_path))
|
||||||
print('')
|
|
||||||
print(strings._('receive_mode_received_file').format(local_path))
|
print(strings._('receive_mode_received_file').format(local_path))
|
||||||
print('')
|
|
||||||
f.save(local_path)
|
f.save(local_path)
|
||||||
|
|
||||||
# Note that flash strings are on English, and not translated, on purpose,
|
# Note that flash strings are on English, and not translated, on purpose,
|
||||||
|
@ -319,6 +317,12 @@ class Web(object):
|
||||||
|
|
||||||
return redirect('/{}'.format(slug_candidate))
|
return redirect('/{}'.format(slug_candidate))
|
||||||
|
|
||||||
|
@self.app.route("/<slug_candidate>/close", methods=['POST'])
|
||||||
|
def close(slug_candidate):
|
||||||
|
self.check_slug_candidate(slug_candidate)
|
||||||
|
self.force_shutdown()
|
||||||
|
return ""
|
||||||
|
|
||||||
def common_routes(self):
|
def common_routes(self):
|
||||||
"""
|
"""
|
||||||
Common web app routes between sending and receiving
|
Common web app routes between sending and receiving
|
||||||
|
|
|
@ -56,6 +56,20 @@ header .right ul li {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.close-button {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #c90c0c;
|
||||||
|
padding: 10px;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-left: 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
table.file-list {
|
table.file-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
|
@ -12,16 +12,6 @@
|
||||||
<h1>OnionShare</h1>
|
<h1>OnionShare</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{% with messages = get_flashed_messages() %}
|
|
||||||
{% if messages %}
|
|
||||||
<ul class=flashes>
|
|
||||||
{% for message in messages %}
|
|
||||||
<li>{{ message }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
|
||||||
|
|
||||||
<div class="upload-wrapper">
|
<div class="upload-wrapper">
|
||||||
<div class="upload">
|
<div class="upload">
|
||||||
<p><img class="logo" src="/static/img/logo_large.png" title="OnionShare"></p>
|
<p><img class="logo" src="/static/img/logo_large.png" title="OnionShare"></p>
|
||||||
|
@ -29,10 +19,25 @@
|
||||||
<p class="upload-description">Select the files you want to send, then click "Send Files"...</p>
|
<p class="upload-description">Select the files you want to send, then click "Send Files"...</p>
|
||||||
<form method="post" enctype="multipart/form-data" action="/{{ slug }}/upload">
|
<form method="post" enctype="multipart/form-data" action="/{{ slug }}/upload">
|
||||||
<p><input type="file" name="file[]" multiple /></p>
|
<p><input type="file" name="file[]" multiple /></p>
|
||||||
<p><input type="submit" class="button" value="Upload Files" /></p>
|
<p><input type="submit" name="upload" class="button" value="Upload Files" /></p>
|
||||||
|
<div>
|
||||||
|
{% with messages = get_flashed_messages() %}
|
||||||
|
{% if messages %}
|
||||||
|
<ul class=flashes>
|
||||||
|
{% for message in messages %}
|
||||||
|
<li>{{ message }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form method="post" action="/{{ slug }}/close">
|
||||||
|
<input type="submit" name="close" class="close-button" value="I'm Finished Uploading" />
|
||||||
|
</form>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue