Add sinst fetch and fix message send logic

This commit is contained in:
Mark Veidemanis 2022-08-15 19:15:12 +01:00
parent ed3c8497bc
commit a65098c222
1 changed files with 11 additions and 1 deletions

View File

@ -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/<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})