From 888330bcb940cb3daa2b3e01528bd083fa838585 Mon Sep 17 00:00:00 2001
From: iFargle
Date: Wed, 22 Mar 2023 18:52:48 +0900
Subject: [PATCH] Remove exit routse from numeric display. Put both in "EXIT
ROUTE"
---
renderer.py | 43 +++++++++++++------------------------------
1 file changed, 13 insertions(+), 30 deletions(-)
diff --git a/renderer.py b/renderer.py
index 91a416f..99a1548 100644
--- a/renderer.py
+++ b/renderer.py
@@ -278,7 +278,6 @@ def thread_machine_content(machine, machine_content, idx, all_routes):
exit_enabled_color = "red"
exit_tooltip = "enable"
exit_enabled = False
- exit_id = machine["id"]+"-exit"
for route in pulled_routes["routes"]:
if route["prefix"] == "0.0.0.0/0" or route["prefix"] == "::/0":
@@ -296,26 +295,21 @@ def thread_machine_content(machine, machine_content, idx, all_routes):
+ id='"""+machine["id"]+"""-exit'
+ onclick="toggle_exit("""+exit_routes[0]+""", """+exit_routes[1]+""", '"""+machine["id"]+"""-exit', '"""+str(exit_enabled)+"""')">
Exit Route
"""
+ # Get the remaining routes
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']))
- # Check if the route is enabled:
- route_enabled = "red"
- route_tooltip = 'enable'
- route_exit = False
-
- if route["enabled"]:
- route_enabled = "green"
- route_tooltip = 'disable'
- if (route["prefix"] == "0.0.0.0/0" or route["prefix"] == "::/0") and str(route["enabled"]) == "True" and exit_node is False:
- exit_node = True
- route_exit = True
- if route_exit is True and exit_node is True: # This will only trigger once if there are two routes: 0.0.0.0/0 and ::/0
+ if route["prefix"] != "0.0.0.0/0" and route["prefix"] != "::/0":
+ app.logger.debug("Route: ["+str(route['machine']['name'])+"] id: "+str(route['id'])+" / prefix: "+str(route['prefix'])+" enabled?: "+str(route['enabled']))
+ route_enabled = "red"
+ route_tooltip = 'enable'
+ if route["enabled"]:
+ route_enabled = "green"
+ route_tooltip = 'disable'
routes = routes+"""
"""
- else:
- routes = routes+"""
-
- """+route['prefix']+"""
-
- """
- routes = routes+"
"
+ routes = routes+""
# Get machine tags
tag_array = ""
@@ -413,15 +397,14 @@ def thread_machine_content(machine, machine_content, idx, all_routes):
preauth_key = str(machine["preAuthKey"]["key"])[0:10]
else: preauth_key = "None"
- # Set the status badge color:
+ # Set the status and user badge color:
text_color = helper.text_color_duration(last_seen_delta)
- # Set the user badge color:
user_color = helper.get_color(int(machine["user"]["id"]))
# Generate the various badges:
status_badge = "fiber_manual_record"
user_badge = ""+machine["user"]["name"]+""
- exit_node_badge = "" if not exit_node else "Exit Node"
+ exit_node_badge = "" if not exit_enabled else "Exit Node"
expiration_badge = "" if not expiring_soon else "Expiring!"
machine_content[idx] = (str(render_template(