2021-03-08 16:49:10 +00:00
|
|
|
""" manage federated servers """
|
2021-01-30 00:02:59 +00:00
|
|
|
from django.contrib.auth.decorators import login_required, permission_required
|
|
|
|
from django.template.response import TemplateResponse
|
|
|
|
from django.utils.decorators import method_decorator
|
|
|
|
from django.views import View
|
|
|
|
|
|
|
|
from bookwyrm import models
|
|
|
|
|
|
|
|
|
|
|
|
# pylint: disable= no-self-use
|
2021-03-08 16:49:10 +00:00
|
|
|
@method_decorator(login_required, name="dispatch")
|
2021-01-30 00:02:59 +00:00
|
|
|
@method_decorator(
|
2021-03-08 16:49:10 +00:00
|
|
|
permission_required("bookwyrm.control_federation", raise_exception=True),
|
|
|
|
name="dispatch",
|
|
|
|
)
|
2021-01-30 00:02:59 +00:00
|
|
|
class Federation(View):
|
2021-03-08 16:49:10 +00:00
|
|
|
""" what servers do we federate with """
|
|
|
|
|
2021-01-30 00:02:59 +00:00
|
|
|
def get(self, request):
|
2021-03-08 16:49:10 +00:00
|
|
|
""" edit form """
|
2021-01-30 00:02:59 +00:00
|
|
|
servers = models.FederatedServer.objects.all()
|
2021-03-08 16:49:10 +00:00
|
|
|
data = {"servers": servers}
|
|
|
|
return TemplateResponse(request, "settings/federation.html", data)
|