diff --git a/docs/http-api.md b/docs/http-api.md index 2fe1728d..241320ae 100755 --- a/docs/http-api.md +++ b/docs/http-api.md @@ -105,3 +105,11 @@ v0 These are constant endpoints available on direct connection servers. Plugin endpoints for direct connections are not documented here. +* /ping + - Methods: GET + - Returns 200 with 'pong!' + +* /close + - Methods: GET + - Kills the direct connection server, destroying the onion address. + - Returns 200 with 'goodbye' \ No newline at end of file diff --git a/docs/specs/block-spec.md b/docs/specs/block-spec.md index 348cedae..26867e42 100644 --- a/docs/specs/block-spec.md +++ b/docs/specs/block-spec.md @@ -1,4 +1,4 @@ -# Onionr Block Spec v1.0.0 +# Onionr Block Spec v1.1.0 # Block Description @@ -60,4 +60,4 @@ Pow is a field for placing the nonce found to make a block meet a target proof o ## encryptType -encryptType is a field to specify the mode of encryption for a block. The values supported by Onionr are 'asym' and 'sym'. +encryptType is a field to specify the mode of encryption for a block. The values supported by Onionr are 'asym' and 'sym'. \ No newline at end of file diff --git a/onionr/onionrcommands/onionrstatistics.py b/onionr/onionrcommands/onionrstatistics.py index 04264655..8430a524 100644 --- a/onionr/onionrcommands/onionrstatistics.py +++ b/onionr/onionrcommands/onionrstatistics.py @@ -104,7 +104,10 @@ def show_peers(o_inst): if not type(peers) is None: if peers not in ('', 'failure', None): if peers != False: - print(peers) + if peers == 'none': + print('No current outgoing connections.') + else: + print(peers) else: print('Daemon probably not running. Unable to list connected peers.') break \ No newline at end of file diff --git a/onionr/onionrevents.py b/onionr/onionrevents.py index 3301a3ac..c6ebcc40 100755 --- a/onionr/onionrevents.py +++ b/onionr/onionrevents.py @@ -67,6 +67,7 @@ def call(plugin, event_name, data = None, pluginapi = None): return True except Exception as e: + logger.error(str(e)) return False else: return True diff --git a/onionr/onionrplugins.py b/onionr/onionrplugins.py index 1a7c18d8..c334ea09 100755 --- a/onionr/onionrplugins.py +++ b/onionr/onionrplugins.py @@ -17,9 +17,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' - -import os, re, importlib, config, logger -import onionrevents as events +import os, re, importlib +import onionrevents as events, config, logger # set data dir dataDir = os.environ.get('ONIONR_HOME', os.environ.get('DATA_DIR', 'data/')) @@ -71,7 +70,7 @@ def enable(name, onionr = None, start_event = True): events.call(get_plugin(name), 'enable', onionr) except ImportError: # Was getting import error on Gitlab CI test "data" # NOTE: If you are experiencing issues with plugins not being enabled, it might be this resulting from an error in the module - # can happen inconsistenly (especially between versions) + # can happen inconsistently (especially between versions) return False else: enabled_plugins.append(name) @@ -170,6 +169,7 @@ def import_module_from_file(full_path_to_module): module_dir, module_file = os.path.split(full_path_to_module) module_name, module_ext = os.path.splitext(module_file) + module_name = module_dir # Module name must be unique otherwise it will get written in other imports # Get module "spec" from filename spec = importlib.util.spec_from_file_location(module_name,full_path_to_module) @@ -187,7 +187,7 @@ def get_plugin(name): if str(name).lower() in _instances: return _instances[str(name).lower()] else: - _instances[str(name).lower()] = import_module_from_file(get_plugins_folder(name, False) + 'main.py') + _instances[str(name).lower()] = import_module_from_file(get_plugins_folder(str(name).lower(), False) + 'main.py') return get_plugin(name) def get_plugins(): @@ -233,6 +233,7 @@ def get_plugins_folder(name = None, absolute = True): path = _pluginsfolder else: # only allow alphanumeric characters + #path = _pluginsfolder + str(name.lower()) path = _pluginsfolder + re.sub('[^0-9a-zA-Z_]+', '', str(name).lower()) if absolute is True: diff --git a/onionr/onionrservices/connectionserver.py b/onionr/onionrservices/connectionserver.py index 27a0b55f..31e429f8 100644 --- a/onionr/onionrservices/connectionserver.py +++ b/onionr/onionrservices/connectionserver.py @@ -51,7 +51,7 @@ class ConnectionServer: def get_ping(): return "pong!" - @service_app.route('/shutdown') + @service_app.route('/close') def shutdown_server(): core_inst.onionrInst.communicatorInst.service_greenlets.remove(http_server) http_server.stop() diff --git a/onionr/static-data/default-plugins/encrypt/main.py b/onionr/static-data/default-plugins/encrypt/main.py index f917d72a..15697ac2 100755 --- a/onionr/static-data/default-plugins/encrypt/main.py +++ b/onionr/static-data/default-plugins/encrypt/main.py @@ -24,6 +24,7 @@ from onionrblockapi import Block import onionrexceptions, onionrusers import locale locale.setlocale(locale.LC_ALL, '') +plugin_name = 'encrypt' class PlainEncryption: def __init__(self, api): diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index 363c1259..2a4c15a5 100755 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -307,7 +307,6 @@ def on_insertblock(api, data={}): meta = json.loads(data['meta']) sentboxTools.addToSent(data['hash'], data['peer'], data['content'], meta['subject']) - def on_init(api, data = None): ''' This event is called after Onionr is initialized, but before the command diff --git a/onionr/static-data/index.html b/onionr/static-data/index.html index 916bfe9c..d4dd7f75 100755 --- a/onionr/static-data/index.html +++ b/onionr/static-data/index.html @@ -4,4 +4,4 @@

Onionr is a decentralized peer-to-peer data storage system.

-

To learn more about Onionr, see the website at https://Onionr.VoidNet.tech/

+

To learn more about Onionr, see the website at https://Onionr.net/