mirror of
https://github.com/basicswap/basicswap.git
synced 2025-03-03 07:14:54 +00:00
api: Fix identities command not able to modify data.
This commit is contained in:
parent
691e3f1b82
commit
9eacd35319
2 changed files with 7 additions and 52 deletions
basicswap
|
@ -1861,8 +1861,8 @@ class BasicSwap(BaseApp):
|
||||||
rv = []
|
rv = []
|
||||||
for row in q:
|
for row in q:
|
||||||
identity = {
|
identity = {
|
||||||
"address": row[0],
|
"address": row[0] if row[0] is not None else "",
|
||||||
"label": row[1],
|
"label": row[1] if row[1] is not None else "",
|
||||||
"num_sent_bids_successful": zeroIfNone(row[2]),
|
"num_sent_bids_successful": zeroIfNone(row[2]),
|
||||||
"num_recv_bids_successful": zeroIfNone(row[3]),
|
"num_recv_bids_successful": zeroIfNone(row[3]),
|
||||||
"num_sent_bids_rejected": zeroIfNone(row[4]),
|
"num_sent_bids_rejected": zeroIfNone(row[4]),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (c) 2020-2024 tecnovert
|
# Copyright (c) 2020-2024 tecnovert
|
||||||
|
# Copyright (c) 2024-2025 The Basicswap developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -657,56 +658,6 @@ def js_identities(self, url_split, post_string: str, is_json: bool) -> bytes:
|
||||||
swap_client = self.server.swap_client
|
swap_client = self.server.swap_client
|
||||||
swap_client.checkSystemStatus()
|
swap_client.checkSystemStatus()
|
||||||
|
|
||||||
if len(url_split) > 3:
|
|
||||||
address = url_split[3]
|
|
||||||
identity = swap_client.getIdentity(address)
|
|
||||||
if identity:
|
|
||||||
return bytes(
|
|
||||||
json.dumps(
|
|
||||||
{
|
|
||||||
"label": identity.label if identity.label is not None else "",
|
|
||||||
"note": identity.note if identity.note is not None else "",
|
|
||||||
"automation_override": (
|
|
||||||
identity.automation_override
|
|
||||||
if identity.automation_override is not None
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
"num_sent_bids_successful": (
|
|
||||||
identity.num_sent_bids_successful
|
|
||||||
if identity.num_sent_bids_successful is not None
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
"num_recv_bids_successful": (
|
|
||||||
identity.num_recv_bids_successful
|
|
||||||
if identity.num_recv_bids_successful is not None
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
"num_sent_bids_rejected": (
|
|
||||||
identity.num_sent_bids_rejected
|
|
||||||
if identity.num_sent_bids_rejected is not None
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
"num_recv_bids_rejected": (
|
|
||||||
identity.num_recv_bids_rejected
|
|
||||||
if identity.num_recv_bids_rejected is not None
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
"num_sent_bids_failed": (
|
|
||||||
identity.num_sent_bids_failed
|
|
||||||
if identity.num_sent_bids_failed is not None
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
"num_recv_bids_failed": (
|
|
||||||
identity.num_recv_bids_failed
|
|
||||||
if identity.num_recv_bids_failed is not None
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
"UTF-8",
|
|
||||||
)
|
|
||||||
return bytes(json.dumps({}), "UTF-8")
|
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
"page_no": 1,
|
"page_no": 1,
|
||||||
"limit": PAGE_LIMIT,
|
"limit": PAGE_LIMIT,
|
||||||
|
@ -714,6 +665,10 @@ def js_identities(self, url_split, post_string: str, is_json: bool) -> bytes:
|
||||||
"sort_dir": "desc",
|
"sort_dir": "desc",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(url_split) > 3:
|
||||||
|
address = url_split[3]
|
||||||
|
filters["address"] = address
|
||||||
|
|
||||||
if post_string != "":
|
if post_string != "":
|
||||||
post_data = getFormData(post_string, is_json)
|
post_data = getFormData(post_string, is_json)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue