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) diff --git a/cli/onionshare_cli/resources/static/css/style.css b/cli/onionshare_cli/resources/static/css/style.css index 88d9cb79..57b23fdb 100644 --- a/cli/onionshare_cli/resources/static/css/style.css +++ b/cli/onionshare_cli/resources/static/css/style.css @@ -285,6 +285,13 @@ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited { margin: 0 0 20px 0; } +.upload-wrapper textarea { + max-width: 95%; + width: 600px; + height: 150px; + padding: 10px; +} + div#uploads { width: 800px; max-width: 90%; diff --git a/cli/onionshare_cli/resources/static/js/receive.js b/cli/onionshare_cli/resources/static/js/receive.js index eac67412..f4bdedec 100644 --- a/cli/onionshare_cli/resources/static/js/receive.js +++ b/cli/onionshare_cli/resources/static/js/receive.js @@ -1,24 +1,35 @@ -$(function(){ +$(function () { // Add a flash message - var flash = function(category, message) { + var flash = function (category, message) { $('#flashes').append($('
Send Files
-Select the files you want to send, then click "Send Files"...
+Submit Files or Messages
+You can submit files, a message, or both
+ {% endif %} + {% if not disable_text and disable_files %} +Submit Messages
+You can submit a message
+ {% endif %} + {% if disable_text and not disable_files %} +Submit Files
+You can submit files
+ {% endif %} - + +