merged plugin related py files into one folder/module

This commit is contained in:
Kevin Froman 2019-09-21 17:45:46 -05:00
parent 22836f068e
commit e49f311192
17 changed files with 50 additions and 18 deletions

View File

@ -49,7 +49,7 @@ from utils import createdirs
createdirs.create_dirs()
from onionrcommands import parser
import onionrevents as events
from onionrplugins import onionrevents as events
setup.setup_config()
setup.setup_default_plugins()

View File

@ -20,7 +20,9 @@
'''
import sys, os, time
import config, logger
import onionrexceptions, onionrpeers, onionrevents as events, onionrplugins as plugins, onionrblockapi as block
import onionrexceptions, onionrpeers, onionrblockapi as block
from onionrplugins import onionrevents as events
import onionrplugins as plugins
from . import onlinepeers, uploadqueue
from communicatorutils import servicecreator, onionrcommunicatortimers
from communicatorutils import downloadblocks, lookupblocks, lookupadders

View File

@ -18,7 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import logger
import onionrevents as events
from onionrplugins import onionrevents as events
from onionrutils import localcommand
from coredb import daemonqueue
import filepaths

View File

@ -19,7 +19,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import sqlite3, os
import onionrevents as events
from onionrplugins import onionrevents as events
from onionrutils import localcommand, epoch
from .. import dbfiles
import dbcreator

View File

@ -18,7 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import sqlite3
import onionrevents as events
from onionrplugins import onionrevents as events
from onionrutils import stringvalidators
from . import listkeys
from utils import gettransports

View File

@ -18,7 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import sqlite3
import onionrevents as events
from onionrplugins import onionrevents as events
from onionrutils import stringvalidators
from .. import dbfiles
def remove_address(address):

View File

@ -2,7 +2,7 @@ from typing import Union
import json
from onionrutils import bytesconverter, epoch
import storagecounter, filepaths, onionrstorage
import onionrevents as events
from onionrplugins import onionrevents as events
from etc import powchoice, onionrvalues
import config, onionrcrypto as crypto, subprocesspow, onionrexceptions
from onionrusers import onionrusers

View File

@ -4,6 +4,8 @@ This module contains handlers/functions for Onionr cli interface commands.
## Files
parser/: Registers and handles Onionr CLI commands
__init__.py: stores the command references (aside from plugins) and help info.
banblocks.py: command handler for manually removing blocks from one's node

View File

@ -24,7 +24,7 @@ from threading import Thread
import toomanyobjs
import config, apiservers, logger, communicator
import onionrevents as events
from onionrplugins import onionrevents as events
from netcontroller import NetController
from onionrutils import localcommand
import filepaths

View File

@ -21,12 +21,12 @@ import sys
from etc import onionrvalues
import logger, onionrexceptions
import onionrplugins
import onionrpluginapi
from onionrplugins import onionrpluginapi
from . import arguments, recommend
plugin_command = lambda cmd: 'on_%s_cmd' % (cmd,)
def register_plugin_commands(cmd):
def register_plugin_commands(cmd)->bool:
plugin_cmd = plugin_command(cmd)
for pl in onionrplugins.get_enabled_plugins():
pl = onionrplugins.get_plugin(pl)

View File

@ -29,7 +29,8 @@ from .. import softreset # command to delete onionr blocks
from .. import restartonionr # command to restart Onionr
import onionrexceptions
from onionrutils import importnewblocks # func to import new blocks
import onionrevents as events
from onionrplugins import onionrevents as events
def get_arguments()->dict:
"""This is a function because we need to be able to dynamically modify them with plugins"""
args = {

View File

@ -23,7 +23,7 @@ import shutil
from onionrutils import localcommand
from coredb import dbfiles
import filepaths
import onionrevents
from onionrplugins import onionrevents
import logger
def _ignore_not_found_delete(path):

View File

@ -18,7 +18,9 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import os, re, importlib
import onionrevents as events, config, logger
from . import onionrevents as events
import config, logger
from utils import identifyhome
# set data dir

View File

@ -17,10 +17,13 @@
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 config, logger, onionrplugins as plugins, onionrpluginapi as pluginapi
from threading import Thread
import config, logger
import onionrplugins as plugins
from . import onionrpluginapi as pluginapi
def get_pluginapi(data):
return pluginapi.SharedAPI(data)

View File

@ -1,5 +1,27 @@
"""
Onionr - Private P2P Communication
Installs default plugins
"""
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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, shutil
import onionrplugins as plugins, logger
import onionrplugins as plugins
import logger
def setup_default_plugins():
# Copy default plugins into plugins folder
if not os.path.exists(plugins.get_plugins_folder()):
@ -18,4 +40,4 @@ def setup_default_plugins():
os.mkdir(plugins.get_plugin_data_folder(name))
except Exception as e:
#logger.warn('Error enabling plugin: ' + str(e), terminal=True)
plugins.disable(name, stop_event = False)
plugins.disable(name, stop_event = False)

View File

@ -23,7 +23,7 @@ import onionrblockapi
from .. import epoch, bytesconverter
from coredb import blockmetadb
import logger
import onionrevents
from onionrplugins import onionrevents
import onionrexceptions
from onionrusers import onionrusers