From 45e49848b1b9a9092b0715581daeeaf24fceec27 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Sat, 12 Aug 2023 00:01:04 +0200 Subject: [PATCH] Fix rpc console in http mode. --- basicswap/http_server.py | 5 ++++- basicswap/templates/rpc.html | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/basicswap/http_server.py b/basicswap/http_server.py index e036069..7a95c71 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -308,7 +308,10 @@ class HttpHandler(BaseHTTPRequestHandler): else: if call_type == 'http': method, params = parse_cmd(cmd, type_map) - result = cmd + '\n' + swap_client.ci(coin_type).rpc_callback(method, params) + rv = swap_client.ci(coin_type).rpc_callback(method, params) + if not isinstance(rv, str): + rv = json.dumps(rv, indent=4) + result = cmd + '\n' + rv else: result = cmd + '\n' + swap_client.callcoincli(coin_type, cmd) except Exception as ex: diff --git a/basicswap/templates/rpc.html b/basicswap/templates/rpc.html index 5d5ecae..2d5c861 100644 --- a/basicswap/templates/rpc.html +++ b/basicswap/templates/rpc.html @@ -98,7 +98,7 @@ - + @@ -176,4 +176,4 @@ {% include 'footer.html' %} - \ No newline at end of file +