From 15523bed96a3ea51b2082134df75e0fa2381c9e8 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 13 Aug 2022 23:36:39 +0100 Subject: [PATCH] Add more information to relay API return --- api/views.py | 2 ++ modules/chankeep.py | 7 ++++++- modules/helpers.py | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/api/views.py b/api/views.py index d7b5805..0ef1f5a 100644 --- a/api/views.py +++ b/api/views.py @@ -325,11 +325,13 @@ class API(object): to_append["nick"] = main.IRCPool[name].nickname to_append["conn"] = main.IRCPool[name].isconnected to_append["limit"] = main.IRCPool[name].chanlimit + to_append["auth"] = main.IRCPool[name].authenticated else: to_append["chans"] = 0 to_append["nick"] = None to_append["conn"] = False to_append["limit"] = None + to_append["auth"] = None relays.append(to_append) return dumps({"relays": relays}) diff --git a/modules/chankeep.py b/modules/chankeep.py index 6c61466..68eab78 100644 --- a/modules/chankeep.py +++ b/modules/chankeep.py @@ -32,7 +32,12 @@ def getActiveRelays(net): for i in enabledRelays: name = net + str(i) if name in main.IRCPool.keys(): - debug(f"getActiveRelays() {net}: {i} auth:{main.IRCPool[name].authenticated} conn:{main.IRCPool[name].isconnected}") + debug( + ( + f"getActiveRelays() {net}: {i} auth:{main.IRCPool[name].authenticated} " + f"conn:{main.IRCPool[name].isconnected}" + ) + ) if main.IRCPool[name].authenticated and main.IRCPool[name].isconnected: activeRelays.append(i) debug(f"getActiveRelays() {net}: {activeRelays}") diff --git a/modules/helpers.py b/modules/helpers.py index daff826..33b484f 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -2,6 +2,7 @@ import main from modules import chankeep from utils.logging.debug import debug + def get_first_relay(net): """ Get the first relay in the network.