diff options
author | Micah Lee <micah@micahflee.com> | 2021-04-25 20:46:03 -0400 |
---|---|---|
committer | Micah Lee <micah@micahflee.com> | 2021-04-25 20:46:06 -0400 |
commit | 2acdea52298695549dfe25260ed59df88b6c3a2c (patch) | |
tree | 6f8342bfb8d6af2a1b2a912beae78ff74857cf34 /cli/onionshare_cli/__init__.py | |
parent | 470fb2bda3a04c856256191ceee267ce94515eef (diff) | |
download | onionshare-2acdea52298695549dfe25260ed59df88b6c3a2c.tar.gz onionshare-2acdea52298695549dfe25260ed59df88b6c3a2c.zip |
Allow sending messages as well as uploading files in receive mode
Diffstat (limited to 'cli/onionshare_cli/__init__.py')
-rw-r--r-- | cli/onionshare_cli/__init__.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/onionshare_cli/__init__.py b/cli/onionshare_cli/__init__.py index 42ec9673..0a7a1d3c 100644 --- a/cli/onionshare_cli/__init__.py +++ b/cli/onionshare_cli/__init__.py @@ -199,6 +199,18 @@ def main(cwd=None): default=None, help="Receive files: URL to receive webhook notifications", ) + parser.add_argument( + "--disable-text", + action="store_true", + dest="disable_text", + help="Receive files: Disable receiving text messages", + ) + parser.add_argument( + "--disable-files", + action="store_true", + dest="disable_files", + help="Receive files: Disable receiving files", + ) # Website args parser.add_argument( "--disable_csp", @@ -242,6 +254,8 @@ def main(cwd=None): autostop_sharing = not bool(args.no_autostop_sharing) data_dir = args.data_dir webhook_url = args.webhook_url + disable_text = args.disable_text + disable_files = args.disable_files disable_csp = bool(args.disable_csp) verbose = bool(args.verbose) @@ -292,6 +306,8 @@ def main(cwd=None): mode_settings.set("receive", "data_dir", data_dir) if webhook_url: mode_settings.set("receive", "webhook_url", webhook_url) + mode_settings.set("receive", "disable_text", disable_text) + mode_settings.set("receive", "disable_files", disable_files) if mode == "website": mode_settings.set("website", "disable_csp", disable_csp) else: @@ -334,6 +350,11 @@ def main(cwd=None): if persistent_filename: mode_settings.set(mode, "filenames", filenames) + # In receive mode, you must allows either text, files, or both + if mode == "receive" and disable_text and disable_files: + print(f"You cannot disable both text and files") + sys.exit() + # Create the Web object web = Web(common, False, mode_settings, mode) |