From 5d4db2c1dff29dfe5165dc51627df87825d5db26 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Mon, 14 Nov 2022 22:56:30 +0200 Subject: [PATCH] ui: Fix shutdown link. --- basicswap/http_server.py | 11 +++++------ tests/basicswap/test_partblind_xmr.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/basicswap/http_server.py b/basicswap/http_server.py index 9240d61..75dc2b9 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -131,7 +131,6 @@ class HttpHandler(BaseHTTPRequestHandler): if swap_client._show_notifications: args_dict['notifications'] = swap_client.getNotifications() - # TODO: Remove _withids if 'messages' in args_dict: messages_with_ids = [] for msg in args_dict['messages']: @@ -145,6 +144,10 @@ class HttpHandler(BaseHTTPRequestHandler): self.server.msg_id_counter += 1 args_dict['err_messages'] = err_messages_with_ids + shutdown_token = os.urandom(8).hex() + self.server.session_tokens['shutdown'] = shutdown_token + args_dict['shutdown_token'] = shutdown_token + if self.server.msg_id_counter >= 0x7FFFFFFF: self.server.msg_id_counter = 0 @@ -486,16 +489,12 @@ class HttpHandler(BaseHTTPRequestHandler): swap_client.checkSystemStatus() summary = swap_client.getSummary() - shutdown_token = os.urandom(8).hex() - self.server.session_tokens['shutdown'] = shutdown_token - template = env.get_template('index.html') return self.render_template(template, { 'refresh': 30, 'version': __version__, 'summary': summary, - 'use_tor_proxy': swap_client.use_tor_proxy, - 'shutdown_token': shutdown_token + 'use_tor_proxy': swap_client.use_tor_proxy }) def page_404(self, url_split): diff --git a/tests/basicswap/test_partblind_xmr.py b/tests/basicswap/test_partblind_xmr.py index 1a1a83a..39d379c 100644 --- a/tests/basicswap/test_partblind_xmr.py +++ b/tests/basicswap/test_partblind_xmr.py @@ -162,7 +162,7 @@ class Test(BaseTest): rate_swap = make_int(random.uniform(0.2, 20.0), scale=12, r=1) offer_id = swap_clients[0].postOffer( Coins.PART_BLIND, Coins.XMR, amt_swap, rate_swap, amt_swap, SwapTypes.XMR_SWAP, - lock_type=TxLockTypes.SEQUENCE_LOCK_BLOCKS, lock_value=12) + lock_type=TxLockTypes.SEQUENCE_LOCK_BLOCKS, lock_value=32) wait_for_offer(test_delay_event, swap_clients[1], offer_id) offer = swap_clients[1].getOffer(offer_id)