Reorder API endpoints to prevent clashing
This commit is contained in:
parent
fafcff1427
commit
f004bd47af
38
api/views.py
38
api/views.py
|
@ -194,25 +194,6 @@ class API(object):
|
||||||
}
|
}
|
||||||
return dumps(networks)
|
return dumps(networks)
|
||||||
|
|
||||||
@app.route("/irc/network/<net>/", methods=["POST"])
|
|
||||||
@login_required
|
|
||||||
def irc_network(self, request, net):
|
|
||||||
if net not in main.network.keys():
|
|
||||||
return dumps({"success": False, "reason": "no such net."})
|
|
||||||
inst = main.network[net]
|
|
||||||
network = {}
|
|
||||||
network["net"] = inst.net
|
|
||||||
network["auth"] = inst.auth
|
|
||||||
network["host"] = inst.host
|
|
||||||
network["last"] = inst.last
|
|
||||||
network["port"] = inst.port
|
|
||||||
network["security"] = inst.security
|
|
||||||
network["relays"] = len(inst.relays)
|
|
||||||
network["chanlimit"] = inst.chanlimit
|
|
||||||
network["channels"] = userinfo.getTotalChanNum(net)
|
|
||||||
network["records"] = userinfo.getNumWhoEntries(net)
|
|
||||||
return dumps(network)
|
|
||||||
|
|
||||||
@app.route("/irc/network/auth/", methods=["POST"])
|
@app.route("/irc/network/auth/", methods=["POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def irc_network_recheckauth(self, request):
|
def irc_network_recheckauth(self, request):
|
||||||
|
@ -249,6 +230,25 @@ class API(object):
|
||||||
regproc.registerAccount(conn.net, conn.num)
|
regproc.registerAccount(conn.net, conn.num)
|
||||||
return dumps({"success": True})
|
return dumps({"success": True})
|
||||||
|
|
||||||
|
@app.route("/irc/network/<net>/", methods=["POST"])
|
||||||
|
@login_required
|
||||||
|
def irc_network(self, request, net):
|
||||||
|
if net not in main.network.keys():
|
||||||
|
return dumps({"success": False, "reason": "no such net."})
|
||||||
|
inst = main.network[net]
|
||||||
|
network = {}
|
||||||
|
network["net"] = inst.net
|
||||||
|
network["auth"] = inst.auth
|
||||||
|
network["host"] = inst.host
|
||||||
|
network["last"] = inst.last
|
||||||
|
network["port"] = inst.port
|
||||||
|
network["security"] = inst.security
|
||||||
|
network["relays"] = len(inst.relays)
|
||||||
|
network["chanlimit"] = inst.chanlimit
|
||||||
|
network["channels"] = userinfo.getTotalChanNum(net)
|
||||||
|
network["records"] = userinfo.getNumWhoEntries(net)
|
||||||
|
return dumps(network)
|
||||||
|
|
||||||
@app.route("/irc/network/<net>/", methods=["DELETE"])
|
@app.route("/irc/network/<net>/", methods=["DELETE"])
|
||||||
@login_required
|
@login_required
|
||||||
def irc_network_delete(self, request, net):
|
def irc_network_delete(self, request, net):
|
||||||
|
|
Loading…
Reference in New Issue