From 01f86daf8f047095aab9c35fb913d55161863301 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Wed, 14 Mar 2018 08:16:09 -0700 Subject: [PATCH] In receive mode, allow uploader to close the server when they are done --- onionshare/web.py | 8 ++++++-- share/static/css/style.css | 14 ++++++++++++++ share/templates/receive.html | 27 ++++++++++++++++----------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/onionshare/web.py b/onionshare/web.py index 495e1364..f0c76db7 100644 --- a/onionshare/web.py +++ b/onionshare/web.py @@ -305,9 +305,7 @@ class Web(object): valid = True 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('') f.save(local_path) # Note that flash strings are on English, and not translated, on purpose, @@ -319,6 +317,12 @@ class Web(object): return redirect('/{}'.format(slug_candidate)) + @self.app.route("//close", methods=['POST']) + def close(slug_candidate): + self.check_slug_candidate(slug_candidate) + self.force_shutdown() + return "" + def common_routes(self): """ Common web app routes between sending and receiving diff --git a/share/static/css/style.css b/share/static/css/style.css index c65c11f7..6b372f22 100644 --- a/share/static/css/style.css +++ b/share/static/css/style.css @@ -56,6 +56,20 @@ header .right ul li { 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 { width: 100%; margin: 0 auto; diff --git a/share/templates/receive.html b/share/templates/receive.html index 1ced74da..4bcf27ad 100644 --- a/share/templates/receive.html +++ b/share/templates/receive.html @@ -12,16 +12,6 @@

OnionShare

- {% with messages = get_flashed_messages() %} - {% if messages %} - - {% endif %} - {% endwith %} -

@@ -29,10 +19,25 @@

Select the files you want to send, then click "Send Files"...

-

+

+
+ {% with messages = get_flashed_messages() %} + {% if messages %} +
    + {% for message in messages %} +
  • {{ message }}
  • + {% endfor %} +
+ {% endif %} + {% endwith %} +
+
+ +
+