From fa841f394412454ff489e6b035afe0083c8127d3 Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 22 Feb 2023 22:26:06 +0900 Subject: [PATCH] test --- renderer.py | 11 ++++++----- templates/machines_card.html | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/renderer.py b/renderer.py index f834170..7e4af56 100644 --- a/renderer.py +++ b/renderer.py @@ -350,10 +350,10 @@ def thread_machine_content(machine, machine_content, idx): expiry_delta = expiry_local - local_time expiry_print = helper.pretty_print_duration(expiry_delta, "expiry") if str(expiry_local.strftime('%Y')) == "0001" or "9999" or "0000": - expiry_time = "No expiration date." + expiry_time = "No expiration date." else: - expiry_time = str(expiry_local.strftime('%A %m/%d/%Y, %H:%M:%S'))+" "+str(timezone)+" ("+str(expiry_print)+")" - + expiry_time = str(expiry_local.strftime('%A %m/%d/%Y, %H:%M:%S'))+" "+str(timezone)+" ("+str(expiry_print)+")" + expiring_soon = True if expiry_delta.days < 200 else False # Get the first 10 characters of the PreAuth Key: if machine["preAuthKey"]: preauth_key = str(machine["preAuthKey"]["key"])[0:10] @@ -366,9 +366,9 @@ def thread_machine_content(machine, machine_content, idx): # Generate the various badges: status_badge = "fiber_manual_record" - user_badge = ""+machine["user"]["name"]+"" + user_badge = ""+machine["user"]["name"]+"" exit_node_badge = "" if not exit_node else "Exit Node" - + expiration_badge = "" if not expiring_soon else "Expiring!" machine_content[idx] = (str(render_template( 'machines_card.html', @@ -390,6 +390,7 @@ def thread_machine_content(machine, machine_content, idx): created_time = str(created_time), expiry_time = str(expiry_time), preauth_key = str(preauth_key), + expiration_badge = Markup(expiration_badge), machine_tags = Markup(tags), ))) LOG.warning("Finished thread for machine "+machine["givenName"]+" index "+str(idx)) diff --git a/templates/machines_card.html b/templates/machines_card.html index 769a372..f7eab90 100644 --- a/templates/machines_card.html +++ b/templates/machines_card.html @@ -9,8 +9,9 @@
- {{ user_badge }} - {{ exit_node_badge }} + {{ user_badge }} + {{ exit_node_badge }} + {{ expiration_badge }}