Fix RPC plugin server binding incorrectly to TCP and doubling up JSON encoding

This commit is contained in:
Kevin F 2022-12-02 21:40:33 +00:00
parent 180116a55d
commit 446662cc60
1 changed files with 2 additions and 3 deletions

View File

@ -58,7 +58,6 @@ plugin_apis['rpc.add_module_to_api'] = add_module_to_api
class OnionrRPC(object): class OnionrRPC(object):
@cherrypy.expose @cherrypy.expose
@cherrypy.tools.json_out()
def rpc(self): def rpc(self):
# Dispatcher is dictionary {<method_name>: callable} # Dispatcher is dictionary {<method_name>: callable}
data = cherrypy.request.body.read().decode('utf-8') data = cherrypy.request.body.read().decode('utf-8')
@ -75,9 +74,9 @@ def rpc_client(*args, **kwargs):
*args, **kwargs) *args, **kwargs)
else: else:
return requests.post( return requests.post(
f'http://{config.get("rpc.bind_host")}/rpc:{config.get("rpc.bind_port")}', f'http://{config.get("rpc.bind_host")}:{config.get("rpc.bind_port")}/rpc',
*args, **kwargs) *args, **kwargs)
def on_beforecmdparsing(api, data=None): def on_beforecmdparsing(api, data=None):
plugin_apis['rpc.rpc_client'] = rpc_client plugin_apis['rpc.rpc_client'] = rpc_client