Refactor onionrpluginapi
This commit is contained in:
parent
e50659753a
commit
3c8cbd2291
@ -18,7 +18,7 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import onionrplugins, logger
|
import onionrplugins, core as onionrcore, logger
|
||||||
|
|
||||||
class DaemonAPI:
|
class DaemonAPI:
|
||||||
def __init__(self, pluginapi):
|
def __init__(self, pluginapi):
|
||||||
@ -136,6 +136,10 @@ class pluginapi:
|
|||||||
def __init__(self, onionr, data):
|
def __init__(self, onionr, data):
|
||||||
self.onionr = onionr
|
self.onionr = onionr
|
||||||
self.data = data
|
self.data = data
|
||||||
|
if self.onionr is None:
|
||||||
|
self.core = onionrcore.Core()
|
||||||
|
else:
|
||||||
|
self.core = self.onionr.onionrCore
|
||||||
|
|
||||||
self.daemon = DaemonAPI(self)
|
self.daemon = DaemonAPI(self)
|
||||||
self.plugins = PluginAPI(self)
|
self.plugins = PluginAPI(self)
|
||||||
@ -148,10 +152,10 @@ class pluginapi:
|
|||||||
return self.data
|
return self.data
|
||||||
|
|
||||||
def get_core(self):
|
def get_core(self):
|
||||||
return self.get_onionr().onionrCore
|
return self.core
|
||||||
|
|
||||||
def get_utils(self):
|
def get_utils(self):
|
||||||
return self.get_onionr().onionrUtils
|
return self.get_core()._utils
|
||||||
|
|
||||||
def get_crypto(self):
|
def get_crypto(self):
|
||||||
return self.get_core()._crypto
|
return self.get_core()._crypto
|
||||||
|
Loading…
Reference in New Issue
Block a user