Implement API endpoint to add next relay
This commit is contained in:
parent
c950bcbd43
commit
96d189290b
10
api/views.py
10
api/views.py
|
@ -309,6 +309,16 @@ class API(object):
|
||||||
main.saveConf("network")
|
main.saveConf("network")
|
||||||
return dumps({"success": True, "id": id, "alias": alias})
|
return dumps({"success": True, "id": id, "alias": alias})
|
||||||
|
|
||||||
|
@app.route("/irc/network/<net>/", methods=["PUT"])
|
||||||
|
@login_required
|
||||||
|
def irc_network_relay_add_next(self, request, net):
|
||||||
|
if net not in main.network.keys():
|
||||||
|
return dumps({"success": False, "reason": "no such net."})
|
||||||
|
net_inst = main.network[net]
|
||||||
|
id, alias = net_inst.add_relay()
|
||||||
|
main.saveConf("network")
|
||||||
|
return dumps({"success": True, "id": id, "alias": alias})
|
||||||
|
|
||||||
@app.route("/irc/network/<net>/<num>/", methods=["DELETE"])
|
@app.route("/irc/network/<net>/<num>/", methods=["DELETE"])
|
||||||
@login_required
|
@login_required
|
||||||
def irc_network_relay_del(self, request, net, num):
|
def irc_network_relay_del(self, request, net, num):
|
||||||
|
|
Loading…
Reference in New Issue