From 96de70aaf25a4838a7cb7bfc2898dec1e283fe18 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 15 Aug 2022 19:15:12 +0100 Subject: [PATCH] Add sinst fetch and fix message send logic --- api/views.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/views.py b/api/views.py index 588120d..0ad5f0b 100644 --- a/api/views.py +++ b/api/views.py @@ -617,7 +617,7 @@ class API(object): nick = None if channel == main.IRCPool[name].nickname: in_query = True - if nick: + if not nick: return dumps({"success": False, "reason": "no nick specified to query"}) else: main.IRCPool[name].sendmsg(nick, msg, in_query=in_query) @@ -687,3 +687,13 @@ class API(object): return dumps({"success": False, "reason": f"no relay {num} on {net}"}) regproc.enableAuthentication(net, num, jump=False, run_now=True) return dumps({"success": True}) + + @app.route("/irc/sinst//", methods=["GET"]) + @login_required + def irc_get_authentity(self, request, net): + if net not in main.network.keys(): + return dumps({"success": False, "reason": "no such net."}) + auth = regproc.selectInst(net) + if not auth: + return dumps({"success": False, "reason": "error getting results."}) + return dumps({"success": True, "sinst": auth})