diff --git a/onionshare/__init__.py b/onionshare/__init__.py index fe7f72dd..f1252f12 100644 --- a/onionshare/__init__.py +++ b/onionshare/__init__.py @@ -67,6 +67,10 @@ def main(cwd=None): print(strings._('no_filenames')) sys.exit() + # Tell web if receive mode is enabled + if receive: + web.set_receive_mode() + # Debug mode? if debug: common.set_debug(debug) @@ -100,7 +104,7 @@ def main(cwd=None): # Start the onionshare app try: - app = OnionShare(onion, receive, local_only, stay_open, shutdown_timeout) + app = OnionShare(onion, local_only, stay_open, shutdown_timeout) app.set_stealth(stealth) app.start_onion_service() except KeyboardInterrupt: diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index a8f2ceb0..85bfaf22 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -27,7 +27,7 @@ class OnionShare(object): OnionShare is the main application class. Pass in options and run start_onion_service and it will do the magic. """ - def __init__(self, onion, receive, local_only=False, stay_open=False, shutdown_timeout=0): + def __init__(self, onion, local_only=False, stay_open=False, shutdown_timeout=0): common.log('OnionShare', '__init__') # The Onion object @@ -37,9 +37,6 @@ class OnionShare(object): self.onion_host = None self.stealth = None - # Receiver mode - self.receive = receive - # files and dirs to delete on shutdown self.cleanup_filenames = [] diff --git a/onionshare/web.py b/onionshare/web.py index d16ca251..c7d3fae6 100644 --- a/onionshare/web.py +++ b/onionshare/web.py @@ -175,6 +175,19 @@ def set_gui_mode(): gui_mode = True +# Are we using receive mode? +receive_mode = False + + +def set_receive_mode(): + """ + Tell the web service that we're running in GUI mode + """ + global receive_mode + receive_mode = True + print('receive mode enabled') + + def debug_mode(): """ Turn on debugging mode, which will log flask errors to a debug file. diff --git a/onionshare_gui/__init__.py b/onionshare_gui/__init__.py index 945487fc..24e627bb 100644 --- a/onionshare_gui/__init__.py +++ b/onionshare_gui/__init__.py @@ -105,7 +105,7 @@ def main(): # Start the OnionShare app web.set_stay_open(stay_open) - app = OnionShare(onion, False, local_only, stay_open, shutdown_timeout) + app = OnionShare(onion, local_only, stay_open, shutdown_timeout) # Launch the gui gui = OnionShareGui(onion, qtapp, app, filenames, config)