From 8fce3adeb563a858e07c59ef73cf4906071ab45d Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 26 Jun 2014 14:31:29 -0400 Subject: [PATCH] made --stay-open work in GUI (#58) --- onionshare_gui/onionshare_gui.py | 1 + onionshare_gui/static/onionshare.js | 4 ++++ onionshare_gui/webapp.py | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 8369fba9..f078b224 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -130,6 +130,7 @@ def main(): webapp.onion_host = local_host webapp.qtapp = app webapp.clipboard = app.clipboard() + webapp.stay_open = bool(stay_open) # run the web app in a new thread webapp_port = onionshare.choose_port() diff --git a/onionshare_gui/static/onionshare.js b/onionshare_gui/static/onionshare.js index 6c7b7fa0..c2a39f71 100644 --- a/onionshare_gui/static/onionshare.js +++ b/onionshare_gui/static/onionshare.js @@ -86,6 +86,10 @@ $(function(){ $('#filehash .label').html(onionshare.strings['sha1_checksum']+':'); $('#close-on-finish-wrapper label').html(onionshare.strings['close_on_finish']); $('#loading .calculating').html(onionshare.strings['calculating_sha1']); + + if(onionshare.stay_open) { + $('#close-on-finish').removeAttr('checked'); + } // after getting the initial info, start the onionshare server $.ajax({ diff --git a/onionshare_gui/webapp.py b/onionshare_gui/webapp.py index 80f2c3f8..42057da4 100644 --- a/onionshare_gui/webapp.py +++ b/onionshare_gui/webapp.py @@ -7,6 +7,7 @@ filename = None onion_host = None qtapp = None clipboard = None +stay_open = None url = None @@ -35,12 +36,13 @@ def index(): @app.route("/init_info") def init_info(): - global onionshare, filename + global onionshare, filename, stay_open basename = os.path.basename(filename) return json.dumps({ 'strings': onionshare.strings, - 'basename': basename + 'basename': basename, + 'stay_open': stay_open }) @app.route("/start_onionshare")