Add more information to relay API return

This commit is contained in:
Mark Veidemanis 2022-08-13 23:36:39 +01:00
parent 2a3c9f80a3
commit a82355b660
3 changed files with 9 additions and 1 deletions

View File

@ -325,11 +325,13 @@ class API(object):
to_append["nick"] = main.IRCPool[name].nickname to_append["nick"] = main.IRCPool[name].nickname
to_append["conn"] = main.IRCPool[name].isconnected to_append["conn"] = main.IRCPool[name].isconnected
to_append["limit"] = main.IRCPool[name].chanlimit to_append["limit"] = main.IRCPool[name].chanlimit
to_append["auth"] = main.IRCPool[name].authenticated
else: else:
to_append["chans"] = 0 to_append["chans"] = 0
to_append["nick"] = None to_append["nick"] = None
to_append["conn"] = False to_append["conn"] = False
to_append["limit"] = None to_append["limit"] = None
to_append["auth"] = None
relays.append(to_append) relays.append(to_append)
return dumps({"relays": relays}) return dumps({"relays": relays})

View File

@ -32,7 +32,12 @@ def getActiveRelays(net):
for i in enabledRelays: for i in enabledRelays:
name = net + str(i) name = net + str(i)
if name in main.IRCPool.keys(): 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: if main.IRCPool[name].authenticated and main.IRCPool[name].isconnected:
activeRelays.append(i) activeRelays.append(i)
debug(f"getActiveRelays() {net}: {activeRelays}") debug(f"getActiveRelays() {net}: {activeRelays}")

View File

@ -2,6 +2,7 @@ import main
from modules import chankeep from modules import chankeep
from utils.logging.debug import debug from utils.logging.debug import debug
def get_first_relay(net): def get_first_relay(net):
""" """
Get the first relay in the network. Get the first relay in the network.