From aa2c2c0e9dd616bb9c9fbf746d5089ae4193d6a6 Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 22 Mar 2023 13:16:32 +0900 Subject: [PATCH] Adding route failover info --- README.md | 7 ++++++- renderer.py | 5 +++++ templates/machines_card.html | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1085e11..f6009f4 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,13 @@ * Enable / disable routes and exit nodes * Add and delete machine tags 7. Basic and OIDC Authentication - * OIDC Authentication tested with Authelia + * OIDC Authentication tested with Authelia and Keycloak 8. Change your color theme! See MaterializeCSS Documentation for Colors for examples. +9. Search your machines and users. + * Machines have tags you can use to filter search: + * `tag:tagname` Searches only for specific tags + * `machine:machine-name` Searches only for specific machines + * `user:user-name` Searches only for specific users --- diff --git a/renderer.py b/renderer.py index b5c5ca9..c79046f 100644 --- a/renderer.py +++ b/renderer.py @@ -255,6 +255,8 @@ def thread_machine_content(machine, machine_content, idx): if len(pulled_routes["routes"]) > 0: advertised_and_enabled = False advertised_route = False + failover_route = False + # First, check if there are any routes that are both enabled and advertised for route in pulled_routes["routes"]: if route ["advertised"] and route["enabled"]: @@ -270,6 +272,7 @@ def thread_machine_content(machine, machine_content, idx): """ for route in pulled_routes["routes"]: app.logger.debug("Route: ["+str(route['machine']['name'])+"] id: "+str(route['id'])+" / prefix: "+str(route['prefix'])+" enabled?: "+str(route['enabled'])) + app.logger.debug("Route Dump: "+str(route)) # Check if the route is enabled: route_enabled = "red" route_tooltip = 'enable' @@ -375,6 +378,7 @@ def thread_machine_content(machine, machine_content, idx): user_badge = ""+machine["user"]["name"]+"" exit_node_badge = "" if not exit_node else "Exit Node" expiration_badge = "" if not expiring_soon else "Expiring!" + failover_badge = "" if not failover_route else "HA Route" machine_content[idx] = (str(render_template( 'machines_card.html', @@ -391,6 +395,7 @@ def thread_machine_content(machine, machine_content, idx): exit_node_badge = Markup(exit_node_badge), status_badge = Markup(status_badge), user_badge = Markup(user_badge), + failover_badge = Markup(failover_badge), last_update_time = str(last_update_time), last_seen_time = str(last_seen_time), created_time = str(created_time), diff --git a/templates/machines_card.html b/templates/machines_card.html index db83027..9bd0c27 100644 --- a/templates/machines_card.html +++ b/templates/machines_card.html @@ -16,6 +16,7 @@ {{ user_badge }} {{ exit_node_badge }} {{ expiration_badge }} + {{ failover_badge }}