Fix authed variable and switch join/part API to use JSON
This commit is contained in:
parent
81708ef490
commit
69b4cb8865
|
@ -36,6 +36,7 @@ from core.views.manage.threshold.irc import (
|
|||
ThresholdIRCNetworkActionsAuto,
|
||||
ThresholdIRCNetworkActionsRelay,
|
||||
ThresholdIRCNetworkChannels,
|
||||
ThresholdIRCNetworkChannelsAPI,
|
||||
ThresholdIRCNetworkDel,
|
||||
ThresholdIRCNetworkInfo,
|
||||
ThresholdIRCNetworkInfoEdit,
|
||||
|
@ -48,7 +49,6 @@ from core.views.manage.threshold.irc import (
|
|||
ThresholdIRCOverviewAlerts,
|
||||
ThresholdIRCSendMessage,
|
||||
ThresholdIRCStats,
|
||||
ThresholdIRCNetworkChannelsAPI,
|
||||
)
|
||||
|
||||
# Management stuff
|
||||
|
|
|
@ -75,9 +75,8 @@ def part_channel(net, channel):
|
|||
|
||||
|
||||
def join_channel(net, channel):
|
||||
channel = urllib.parse.quote(channel, safe="")
|
||||
url = f"irc/network/{net}/channel/{channel}"
|
||||
payload = {}
|
||||
url = f"irc/network/{net}/channel"
|
||||
payload = {"channel": channel}
|
||||
joined = threshold_request(url, payload, method="PUT")
|
||||
if not joined:
|
||||
return {}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if relay.authenticated %}
|
||||
{% if relay.authed %}
|
||||
<span class="icon has-text-success">
|
||||
<i class="fa-solid fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.shortcuts import render
|
||||
from django.views import View
|
||||
from rest_framework.parsers import FormParser, JSONParser
|
||||
from rest_framework.parsers import FormParser
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from core.lib.manage import threshold
|
||||
|
@ -208,6 +208,7 @@ class ThresholdIRCNetworkRelayStatus(SuperUserRequiredMixin, APIView):
|
|||
}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class ThresholdIRCNetworkChannelsAPI(SuperUserRequiredMixin, APIView):
|
||||
template_name = "manage/threshold/irc/network/channels.html"
|
||||
parser_classes = [FormParser]
|
||||
|
@ -219,7 +220,6 @@ class ThresholdIRCNetworkChannelsAPI(SuperUserRequiredMixin, APIView):
|
|||
:param channel: channel name
|
||||
"""
|
||||
channel = request.data["channel"]
|
||||
print("DELETE CHANNEL", channel)
|
||||
parted = threshold.part_channel(net, channel)
|
||||
if parted["success"]:
|
||||
message = f"Requested part on relays: {', '.join(parted['relays'])}"
|
||||
|
@ -264,6 +264,7 @@ class ThresholdIRCNetworkChannelsAPI(SuperUserRequiredMixin, APIView):
|
|||
}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class ThresholdIRCNetworkChannels(SuperUserRequiredMixin, APIView):
|
||||
"""
|
||||
List the channels a network is on.
|
||||
|
|
Loading…
Reference in New Issue