From 996df24646803fde0b21bf0b32646141bf2c5c2d Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 29 Apr 2018 15:34:11 -0700 Subject: [PATCH] Make receive_allow_receiver_shutdown setting work --- onionshare/web.py | 13 +++++++++---- share/templates/receive.html | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/onionshare/web.py b/onionshare/web.py index 79c49e39..762e2342 100644 --- a/onionshare/web.py +++ b/onionshare/web.py @@ -266,7 +266,8 @@ class Web(object): r = make_response(render_template( 'receive.html', - slug=self.slug)) + slug=self.slug, + receive_allow_receiver_shutdown=self.common.settings.get('receive_allow_receiver_shutdown'))) return self.add_security_headers(r) @self.app.route("//upload", methods=['POST']) @@ -326,9 +327,13 @@ class Web(object): @self.app.route("//close", methods=['POST']) def close(slug_candidate): self.check_slug_candidate(slug_candidate) - self.force_shutdown() - r = make_response(render_template('closed.html')) - return self.add_security_headers(r) + + if self.common.settings.get('receive_allow_receiver_shutdown'): + self.force_shutdown() + r = make_response(render_template('closed.html')) + return self.add_security_headers(r) + else: + return redirect('/{}'.format(slug_candidate)) def common_routes(self): """ diff --git a/share/templates/receive.html b/share/templates/receive.html index d1ec3b3a..7cc4319f 100644 --- a/share/templates/receive.html +++ b/share/templates/receive.html @@ -34,10 +34,10 @@ - + {% if receive_allow_receiver_shutdown %}
- + {% endif %}