Implement getting LIST information from API
This commit is contained in:
14
api/views.py
14
api/views.py
@@ -198,7 +198,6 @@ class API(object):
|
||||
def irc_network(self, request, net):
|
||||
if net not in main.network.keys():
|
||||
return dumps({"success": False, "reason": "no such net."})
|
||||
first_relay = helpers.get_first_relay(net)
|
||||
inst = main.network[net]
|
||||
network = {}
|
||||
network["net"] = inst.net
|
||||
@@ -210,9 +209,6 @@ class API(object):
|
||||
network["relays"] = len(inst.relays)
|
||||
network["channels"] = userinfo.getTotalChanNum(net)
|
||||
network["records"] = userinfo.getNumWhoEntries(net)
|
||||
if first_relay:
|
||||
network["chanlimit_live"] = first_relay.chanlimit
|
||||
network["chanlimit_conf"] = inst.chanlimit
|
||||
return dumps(network)
|
||||
|
||||
@app.route("/irc/network/<net>/", methods=["DELETE"])
|
||||
@@ -483,6 +479,15 @@ class API(object):
|
||||
first_relay.list()
|
||||
return dumps({"success": True, "message": f"requested list with instance {first_relay.num} of {net}"})
|
||||
|
||||
@app.route("/irc/list/<net>/", methods=["GET"])
|
||||
@login_required
|
||||
def get_irc_list_info(self, request, net):
|
||||
if net not in main.network.keys():
|
||||
return dumps({"success": False, "reason": "no such net."})
|
||||
listinfo = chankeep.getListInfo(net)
|
||||
return dumps({"success": True, "listinfo": listinfo})
|
||||
|
||||
|
||||
@app.route("/irc/msg/<net>/<num>/<channel>/", methods=["PUT"])
|
||||
@login_required
|
||||
def irc_send_message(self, request, net, num, channel):
|
||||
@@ -527,3 +532,4 @@ class API(object):
|
||||
if name not in main.IRCPool.keys():
|
||||
return dumps({"success": False, "reason": f"relay {num} not on {net}"})
|
||||
return dumps({"nickname": main.IRCPool[name].nickname})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user