Add sinst fetch and fix message send logic

This commit is contained in:
Mark Veidemanis 2022-08-15 19:15:12 +01:00
parent f8c1e952bb
commit 96de70aaf2
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 11 additions and 1 deletions

View File

@ -617,7 +617,7 @@ class API(object):
nick = None nick = None
if channel == main.IRCPool[name].nickname: if channel == main.IRCPool[name].nickname:
in_query = True in_query = True
if nick: if not nick:
return dumps({"success": False, "reason": "no nick specified to query"}) return dumps({"success": False, "reason": "no nick specified to query"})
else: else:
main.IRCPool[name].sendmsg(nick, msg, in_query=in_query) 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}"}) return dumps({"success": False, "reason": f"no relay {num} on {net}"})
regproc.enableAuthentication(net, num, jump=False, run_now=True) regproc.enableAuthentication(net, num, jump=False, run_now=True)
return dumps({"success": True}) return dumps({"success": True})
@app.route("/irc/sinst/<net>/", 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})