From 9da907aa1ecc858eddc074e2b705db3e12b52c1e Mon Sep 17 00:00:00 2001 From: tecnovert Date: Mon, 24 Oct 2022 21:31:58 +0200 Subject: [PATCH] ui: Add expired flag to offers. --- basicswap/__init__.py | 2 +- basicswap/templates/404.html | 65 +--------------- .../templates/automation_strategies.html | 65 +--------------- basicswap/templates/automation_strategy.html | 65 +--------------- .../templates/automation_strategy_new.html | 65 +--------------- basicswap/templates/bid.html | 65 +--------------- basicswap/templates/bid_xmr.html | 65 +--------------- basicswap/templates/debug.html | 65 +--------------- basicswap/templates/explorers.html | 65 +--------------- basicswap/templates/identity.html | 65 +--------------- basicswap/templates/inc_messages.html | 64 ++++++++++++++++ basicswap/templates/offer.html | 65 +--------------- basicswap/templates/offer_confirm.html | 65 +--------------- basicswap/templates/offer_new_1.html | 67 +---------------- basicswap/templates/offer_new_2.html | 65 +--------------- basicswap/templates/offers.html | 73 ++---------------- basicswap/templates/rpc.html | 65 +--------------- basicswap/templates/settings.html | 65 +--------------- basicswap/templates/smsgaddresses.html | 65 +--------------- basicswap/templates/tor.html | 65 +--------------- basicswap/templates/wallet.html | 75 ++----------------- basicswap/templates/wallets.html | 65 +--------------- basicswap/ui/page_offers.py | 11 ++- 23 files changed, 104 insertions(+), 1293 deletions(-) create mode 100644 basicswap/templates/inc_messages.html diff --git a/basicswap/__init__.py b/basicswap/__init__.py index f2434a3..cf687f7 100644 --- a/basicswap/__init__.py +++ b/basicswap/__init__.py @@ -1,3 +1,3 @@ name = "basicswap" -__version__ = "0.11.41" +__version__ = "0.11.42" diff --git a/basicswap/templates/404.html b/basicswap/templates/404.html index b1ecfaa..ccc699c 100644 --- a/basicswap/templates/404.html +++ b/basicswap/templates/404.html @@ -26,70 +26,7 @@ - {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/automation_strategies.html b/basicswap/templates/automation_strategies.html index c93fc8a..d9e39da 100644 --- a/basicswap/templates/automation_strategies.html +++ b/basicswap/templates/automation_strategies.html @@ -44,70 +44,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/automation_strategy.html b/basicswap/templates/automation_strategy.html index b3ca255..b67d32b 100644 --- a/basicswap/templates/automation_strategy.html +++ b/basicswap/templates/automation_strategy.html @@ -41,70 +41,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/automation_strategy_new.html b/basicswap/templates/automation_strategy_new.html index f7a6347..a5123ec 100644 --- a/basicswap/templates/automation_strategy_new.html +++ b/basicswap/templates/automation_strategy_new.html @@ -41,70 +41,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/bid.html b/basicswap/templates/bid.html index 6c4441f..3932174 100644 --- a/basicswap/templates/bid.html +++ b/basicswap/templates/bid.html @@ -54,70 +54,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/bid_xmr.html b/basicswap/templates/bid_xmr.html index a82246a..a50a3f4 100644 --- a/basicswap/templates/bid_xmr.html +++ b/basicswap/templates/bid_xmr.html @@ -54,70 +54,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/debug.html b/basicswap/templates/debug.html index 6328115..c65565a 100644 --- a/basicswap/templates/debug.html +++ b/basicswap/templates/debug.html @@ -42,71 +42,8 @@
- {% for m in messages %} +{% include 'inc_messages.html' %} - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} -
diff --git a/basicswap/templates/explorers.html b/basicswap/templates/explorers.html index 143c67a..5546d8a 100644 --- a/basicswap/templates/explorers.html +++ b/basicswap/templates/explorers.html @@ -41,70 +41,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/identity.html b/basicswap/templates/identity.html index 282e8b6..4cd59af 100644 --- a/basicswap/templates/identity.html +++ b/basicswap/templates/identity.html @@ -43,70 +43,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/inc_messages.html b/basicswap/templates/inc_messages.html new file mode 100644 index 0000000..db35f19 --- /dev/null +++ b/basicswap/templates/inc_messages.html @@ -0,0 +1,64 @@ +{% for m in messages %} + + + +{% endfor %} + +{% for m in err_messages %} + + + +{% endfor %} diff --git a/basicswap/templates/offer.html b/basicswap/templates/offer.html index 5d3d447..e2a3c16 100644 --- a/basicswap/templates/offer.html +++ b/basicswap/templates/offer.html @@ -50,70 +50,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %} {% if sent_bid_id %}
diff --git a/basicswap/templates/offer_confirm.html b/basicswap/templates/offer_confirm.html index 55b806c..76c3cd4 100644 --- a/basicswap/templates/offer_confirm.html +++ b/basicswap/templates/offer_confirm.html @@ -54,70 +54,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/offer_new_1.html b/basicswap/templates/offer_new_1.html index cad64be..96538a0 100644 --- a/basicswap/templates/offer_new_1.html +++ b/basicswap/templates/offer_new_1.html @@ -47,70 +47,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
@@ -267,7 +204,7 @@
-

You Get

+

You Get

diff --git a/basicswap/templates/offer_new_2.html b/basicswap/templates/offer_new_2.html index 88931c5..d2796d4 100644 --- a/basicswap/templates/offer_new_2.html +++ b/basicswap/templates/offer_new_2.html @@ -48,70 +48,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/offers.html b/basicswap/templates/offers.html index 21e684e..bd9b04b 100644 --- a/basicswap/templates/offers.html +++ b/basicswap/templates/offers.html @@ -43,70 +43,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
@@ -155,7 +92,7 @@ - {% for c in coins %} {% endfor %} @@ -273,7 +210,7 @@ {% for o in offers %} - + @@ -281,9 +218,9 @@
-
{{ o[0] }}
+
{{ o[0] }}
- + diff --git a/basicswap/templates/rpc.html b/basicswap/templates/rpc.html index d8605a3..f2305c0 100644 --- a/basicswap/templates/rpc.html +++ b/basicswap/templates/rpc.html @@ -42,70 +42,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/settings.html b/basicswap/templates/settings.html index fefcf06..37d5efb 100644 --- a/basicswap/templates/settings.html +++ b/basicswap/templates/settings.html @@ -40,70 +40,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %} diff --git a/basicswap/templates/smsgaddresses.html b/basicswap/templates/smsgaddresses.html index 5ed9337..0bc4648 100644 --- a/basicswap/templates/smsgaddresses.html +++ b/basicswap/templates/smsgaddresses.html @@ -42,71 +42,8 @@ - {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - +{% include 'inc_messages.html' %} - {% endfor %} -
diff --git a/basicswap/templates/tor.html b/basicswap/templates/tor.html index 0eb1ca4..9c747bc 100644 --- a/basicswap/templates/tor.html +++ b/basicswap/templates/tor.html @@ -45,70 +45,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %}
diff --git a/basicswap/templates/wallet.html b/basicswap/templates/wallet.html index afb7ec2..9e59f66 100644 --- a/basicswap/templates/wallet.html +++ b/basicswap/templates/wallet.html @@ -50,70 +50,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} +{% include 'inc_messages.html' %} {% if w.updating %} @@ -144,7 +81,7 @@ {% endif %} -{% if w.havedata %} {% if w.error %} +{% if w.havedata %} {% if w.error %}
@@ -178,7 +115,7 @@ {% else %} -
+
@@ -234,8 +171,8 @@ Expected Seed: {{ w.expected_seed }} - {% if w.expected_seed != true %} - + {% if w.expected_seed != true %} +
@@ -244,7 +181,7 @@
-
+
diff --git a/basicswap/templates/wallets.html b/basicswap/templates/wallets.html index 198ce4a..1a879c0 100644 --- a/basicswap/templates/wallets.html +++ b/basicswap/templates/wallets.html @@ -46,70 +46,7 @@
- {% for m in messages %} - - - - {% endfor %} - - {% for m in err_messages %} - - - - {% endfor %} + {% include 'inc_messages.html' %}
diff --git a/basicswap/ui/page_offers.py b/basicswap/ui/page_offers.py index c3e0945..62273c8 100644 --- a/basicswap/ui/page_offers.py +++ b/basicswap/ui/page_offers.py @@ -4,6 +4,7 @@ # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. +import time import traceback from urllib import parse @@ -471,6 +472,7 @@ def page_offer(self, url_split, post_string): err_messages.append('Send bid failed: ' + str(ex)) show_bid_form = True + now = int(time.time()) data = { 'tla_from': ci_from.ticker(), 'tla_to': ci_to.ticker(), @@ -498,6 +500,7 @@ def page_offer(self, url_split, post_string): 'bid_rate': bid_rate, 'debug_ui': swap_client.debug_ui, 'automation_strat_id': -1, + 'is_expired': offer.expire_at <= now } data.update(extend_data) @@ -599,22 +602,26 @@ def page_offers(self, url_split, post_string, sent=False): sent = False offers = swap_client.listOffers(sent, filters, with_bid_info=True) + now = int(time.time()) formatted_offers = [] for row in offers: o, completed_amount = row ci_from = swap_client.ci(Coins(o.coin_from)) ci_to = swap_client.ci(Coins(o.coin_to)) + is_expired = o.expire_at <= now formatted_offers.append(( format_timestamp(o.created_at), o.offer_id.hex(), - ci_from.coin_name(), ci_to.coin_name(), + ci_from.coin_name(), + ci_to.coin_name(), ci_from.format_amount(o.amount_from), ci_to.format_amount((o.amount_from * o.rate) // ci_from.COIN()), ci_to.format_amount(o.rate), 'Public' if o.addr_to == swap_client.network_addr else o.addr_to, o.addr_from, o.was_sent, - ci_from.format_amount(completed_amount))) + ci_from.format_amount(completed_amount), + is_expired)) coins_from, coins_to = listAvailableCoins(swap_client, split_from=True)