diff --git a/aprsd/client.py b/aprsd/client.py index 81152ec..6dea8e5 100644 --- a/aprsd/client.py +++ b/aprsd/client.py @@ -18,6 +18,7 @@ class Client: config = None connected = False + server_string = None def __new__(cls, *args, **kwargs): """This magic turns this into a singleton.""" @@ -153,7 +154,15 @@ class Aprsdis(aprslib.IS): self.logger.debug("Server: %s", test) - _, _, callsign, status, _ = test.split(" ", 4) + a, b, callsign, status, e = test.split(" ", 4) + s = e.split(",") + if len(s): + server_string = s[0].replace("server ", "") + else: + server_string = e.replace("server ", "") + + self.logger.info("Connected to {}".format(server_string)) + self.server_string = server_string if callsign == "": raise LoginError("Server responded with empty callsign???") diff --git a/aprsd/flask.py b/aprsd/flask.py index 1b5db92..dca018b 100644 --- a/aprsd/flask.py +++ b/aprsd/flask.py @@ -4,7 +4,7 @@ import logging import tracemalloc import aprsd -from aprsd import messaging, plugin, stats +from aprsd import client, messaging, plugin, stats import flask import flask_classful from flask_httpauth import HTTPBasicAuth @@ -75,9 +75,12 @@ class APRSDFlask(flask_classful.FlaskView): track = messaging.MsgTrack() now = datetime.datetime.now() current, peak = tracemalloc.get_traced_memory() + cl = client.Client() + server_string = cl.client.server_string result = { "version": aprsd.__version__, + "aprsis_server": server_string, "uptime": stats_obj.uptime, "size_tracker": len(track), "stats": stats_obj.stats(), diff --git a/aprsd/web/templates/index.html b/aprsd/web/templates/index.html index 96d851a..20191ad 100644 --- a/aprsd/web/templates/index.html +++ b/aprsd/web/templates/index.html @@ -140,6 +140,7 @@ function update_stats( data ) { $("#version").text( data["version"] ); + $("#aprsis").text( "APRS-IS Server: " + data["aprsis_server"] ); $("#uptime").text( "uptime: " + data["uptime"] ); const html_pretty = Prism.highlight(JSON.stringify(data, null, '\t'), Prism.languages.json, 'json'); $("#jsonstats").html(html_pretty); @@ -240,7 +241,7 @@ #title { font-size: 4em; } - #uptime: { + #uptime, #arpsis: { font-size: 4px; } @@ -251,6 +252,7 @@
APRSD version
+