diff --git a/bookwyrm/templates/settings/admin_layout.html b/bookwyrm/templates/settings/admin_layout.html index f66da658..59cfd1d4 100644 --- a/bookwyrm/templates/settings/admin_layout.html +++ b/bookwyrm/templates/settings/admin_layout.html @@ -14,6 +14,10 @@ {% url 'settings-invites' as url %} Invites +
  • + {% url 'settings-federation' as url %} + Federated Servers +
  • {% endif %} {% if perms.bookwyrm.edit_instance_settings %} diff --git a/bookwyrm/templates/settings/federation.html b/bookwyrm/templates/settings/federation.html new file mode 100644 index 00000000..e3bf23ce --- /dev/null +++ b/bookwyrm/templates/settings/federation.html @@ -0,0 +1,21 @@ +{% extends 'settings/admin_layout.html' %} +{% block header %}Federated Servers{% endblock %} + +{% block panel %} + + + + + + + + {% for server in servers %} + + + + + + {% endfor %} +
    Server nameSoftwareStatus
    {{ server.server_name }}{{ server.application_type }} ({{ server.application_version }}){{ server.status }}
    + +{% endblock %} diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index e79324a3..6387a4cd 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -52,7 +52,8 @@ urlpatterns = [ # admin re_path(r'^settings/site-settings', views.Site.as_view(), name='settings-site'), - # invites + re_path(r'^settings/federation', + views.Federation.as_view(), name='settings-federation'), re_path(r'^settings/invites/?$', views.ManageInvites.as_view(), name='settings-invites'), re_path(r'^invite/(?P[A-Za-z0-9]+)/?$', views.Invite.as_view()), diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py index 62c4110f..0b93f164 100644 --- a/bookwyrm/views/__init__.py +++ b/bookwyrm/views/__init__.py @@ -5,6 +5,7 @@ from .block import Block, unblock from .books import Book, EditBook, Editions from .books import upload_cover, add_description, switch_edition, resolve_book from .error import not_found_page, server_error_page +from .federation import Federation from .feed import DirectMessage, Feed, Replies, Status from .follow import follow, unfollow from .follow import accept_follow_request, delete_follow_request, handle_accept diff --git a/bookwyrm/views/federation.py b/bookwyrm/views/federation.py new file mode 100644 index 00000000..0bd14dab --- /dev/null +++ b/bookwyrm/views/federation.py @@ -0,0 +1,24 @@ +''' manage federated servers ''' +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 +@method_decorator(login_required, name='dispatch') +@method_decorator( + permission_required('bookwyrm.control_federation', raise_exception=True), + name='dispatch') +class Federation(View): + ''' what servers do we federate with ''' + def get(self, request): + ''' edit form ''' + servers = models.FederatedServer.objects.all() + data = { + 'title': 'Federated Servers', + 'servers': servers + } + return TemplateResponse(request, 'settings/federation.html', data)