* Fixed duplicate plugin events
parent
71aadb7767
commit
47ee28f74f
|
@ -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'
|
|
@ -1,4 +1,4 @@
|
|||
# Onionr Block Spec v1.0.0
|
||||
# Onionr Block Spec v1.1.0
|
||||
|
||||
# Block Description
|
||||
|
||||
|
|
|
@ -104,6 +104,9 @@ def show_peers(o_inst):
|
|||
if not type(peers) is None:
|
||||
if peers not in ('', 'failure', None):
|
||||
if peers != False:
|
||||
if peers == 'none':
|
||||
print('No current outgoing connections.')
|
||||
else:
|
||||
print(peers)
|
||||
else:
|
||||
print('Daemon probably not running. Unable to list connected peers.')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,9 +17,8 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
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:
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
<p>Onionr is a decentralized peer-to-peer data storage system.</p>
|
||||
|
||||
<p>To learn more about Onionr, see the website at <a href="https://onionr.voidnet.tech/">https://Onionr.VoidNet.tech/</a></p>
|
||||
<p>To learn more about Onionr, see the website at <a href="https://onionr.net/">https://Onionr.net/</a></p>
|
||||
|
|
Loading…
Reference in New Issue