Browse Source

Fix rpc console in http mode.

nav
tecnovert 10 months ago
parent
commit
45e49848b1
No known key found for this signature in database GPG Key ID: 8ED6D8750C4E3F93
  1. 5
      basicswap/http_server.py
  2. 4
      basicswap/templates/rpc.html

5
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:

4
basicswap/templates/rpc.html

@ -98,7 +98,7 @@
</div>
</td>
<td class="py-3 px-6">
<input class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" name="type_map">
<input class="hover:border-blue-500 bg-gray-50 text-gray-900 appearance-none pr-10 dark:bg-gray-500 dark:text-white border border-gray-300 dark:border-gray-400 dark:text-gray-50 dark:placeholder-gray-50 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 focus:ring-0" type="text" name="type_map" title="Convert inputs when using http. Example: 'sibj' 1st parameter is a string, 2nd is converted to an int then boolean and json object or array">
</td>
</table>
</div>
@ -176,4 +176,4 @@
</div>
{% include 'footer.html' %}
</body>
</html>
</html>

Loading…
Cancel
Save