From 989692c6acc422ba9e28a9eeaa9894c2ffb75e14 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 16 Oct 2020 06:30:59 +0000 Subject: [PATCH] add disable-plugin-list, --store-plaintext and --dev-mode run arguments fixes #6 --- run-onionr-node.py | 24 +++++++++++++++++++++++ static-data/www/shared/sidebar/sidebar.js | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/run-onionr-node.py b/run-onionr-node.py index 49d14bb6..8250b8c5 100755 --- a/run-onionr-node.py +++ b/run-onionr-node.py @@ -85,6 +85,21 @@ parser.add_argument( parser.add_argument( '--use-upload-mixing', help='Re-upload blocks uploaded to us. Slow but more secure', type=int, default=0) +parser.add_argument( + '--dev-mode', + help='Developer mode makes restarting and testing Onionr less tedious during development', + type=int, default=0) +parser.add_argument( + '--disable-plugin-list', + help='plugins to disable by name, separate with commas', + type=str, default='chat' +) +parser.add_argument( + '--store-plaintext', + help='store plaintext blocks or not. note that encrypted blocks may not really be encrypted, but we cannot detect that', + type=int, default=1 +) + args = parser.parse_args() p = Popen([sub_script, 'version'], stdout=DEVNULL) @@ -105,6 +120,15 @@ if args.private_key: f.write(',' + pub.decode() + ',' + priv) config['general']['public_key'] = pub +config['plugins']['disabled'] = args.disable_plugin_list.split(',') +config['general']['dev_mode'] = False + +config['general']['store_plaintext_blocks'] = True + +if not args.store_plaintext: + config['general']['store_plaintext_blocks'] = False +if args.dev_mode: + config['general']['dev_mode'] = True if not args.onboarding: config['onboarding']['done'] = True if not args.random_localhost_ip: diff --git a/static-data/www/shared/sidebar/sidebar.js b/static-data/www/shared/sidebar/sidebar.js index 054c7f68..ac00dadf 100644 --- a/static-data/www/shared/sidebar/sidebar.js +++ b/static-data/www/shared/sidebar/sidebar.js @@ -27,11 +27,12 @@ function sidebarAddPeerRegister(){ if (! resp.ok){ if (resp.status == 409){ PNotify.notice({text: "Peer already added"}) - return + throw new Error("Could not add peer " + newPeer + " already added") } PNotify.error({text: "Could not add peer. Is your input valid?"}) throw new Error("Could not add peer " + newPeer) } + return resp }) .then((resp) => resp.text()) .then(function(data) {