api: Fix identities command not able to modify data.

This commit is contained in:
tecnovert 2025-01-07 18:38:01 +02:00
parent 691e3f1b82
commit 9eacd35319
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
2 changed files with 7 additions and 52 deletions

View file

@ -1861,8 +1861,8 @@ class BasicSwap(BaseApp):
rv = []
for row in q:
identity = {
"address": row[0],
"label": row[1],
"address": row[0] if row[0] is not None else "",
"label": row[1] if row[1] is not None else "",
"num_sent_bids_successful": zeroIfNone(row[2]),
"num_recv_bids_successful": zeroIfNone(row[3]),
"num_sent_bids_rejected": zeroIfNone(row[4]),

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2024 tecnovert
# Copyright (c) 2024-2025 The Basicswap developers
# Distributed under the MIT software license, see the accompanying
# 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.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 = {
"page_no": 1,
"limit": PAGE_LIMIT,
@ -714,6 +665,10 @@ def js_identities(self, url_split, post_string: str, is_json: bool) -> bytes:
"sort_dir": "desc",
}
if len(url_split) > 3:
address = url_split[3]
filters["address"] = address
if post_string != "":
post_data = getFormData(post_string, is_json)