From 1203bb2b7a5d672dbc06335bb40cdf06165ed6e9 Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 31 Aug 2018 22:29:57 -0500 Subject: [PATCH] * Adjusted connect configuration * work on cli-ui --- onionr/communicator2.py | 3 +- .../static-data/default-plugins/cliui/main.py | 37 ++++++++++++++++++- onionr/static-data/default_config.json | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/onionr/communicator2.py b/onionr/communicator2.py index 2b8667be..f203dd70 100755 --- a/onionr/communicator2.py +++ b/onionr/communicator2.py @@ -408,7 +408,8 @@ class OnionrCommunicatorDaemon: try: self.getPeerProfileInstance(peer).addScore(-10) self.removeOnlinePeer(peer) - self.getOnlinePeers() # Will only add a new peer to pool if needed + if action != 'ping': + self.getOnlinePeers() # Will only add a new peer to pool if needed except ValueError: pass else: diff --git a/onionr/static-data/default-plugins/cliui/main.py b/onionr/static-data/default-plugins/cliui/main.py index 4d4adb3d..dcf370b5 100644 --- a/onionr/static-data/default-plugins/cliui/main.py +++ b/onionr/static-data/default-plugins/cliui/main.py @@ -19,7 +19,7 @@ ''' # Imports some useful libraries -import logger, config, threading, time, uuid +import logger, config, threading, time, uuid, subprocess from onionrblockapi import Block plugin_name = 'cliui' @@ -30,7 +30,42 @@ class OnionrCLIUI: self.api = apiInst self.myCore = apiInst.get_core() return + + def subCommand(self, command): + try: + subprocess.run(["./onionr.py", command]) + except KeyboardInterrupt: + pass + def start(self): + '''Main CLI UI interface menu''' + showMenu = True + while showMenu: + print('''\n1. Flow (Anonymous public chat, use at your own risk) +2. Mail (Secure email-like service) +3. File Sharing +4. User Settings +5. Quit + ''') + try: + choice = input(">").strip().lower() + except KeyboardInterrupt: + choice = "quit" + + if choice in ("flow", "1"): + self.subCommand("flow") + elif choice in ("2", "mail"): + self.subCommand("mail") + elif choice in ("4", "user settings", "settings"): + try: + self.setName() + except (KeyboardInterrupt, EOFError) as e: + pass + elif choice in ("5", "quit"): + showMenu = False + return + + def setName(self): name = input("Enter your name: ") self.myCore.insertBlock("userInfo-" + str(uuid.uuid1()), sign=True, header='userInfo', meta={'name': name}) return diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index 6e35245e..5ebcfa4a 100644 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -59,7 +59,7 @@ "peers":{ "minimumScore": -100, "maxStoredPeers": 5000, - "maxConnect": 5 + "maxConnect": 10 }, "timers":{ "lookupBlocks": 25,