forked from mirrors/bookwyrm
list of federated servers for admin panel
This commit is contained in:
parent
9db327a69e
commit
d1ee26e282
5 changed files with 52 additions and 1 deletions
|
@ -14,6 +14,10 @@
|
|||
{% url 'settings-invites' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>Invites</a>
|
||||
</li>
|
||||
<li>
|
||||
{% url 'settings-federation' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>Federated Servers</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if perms.bookwyrm.edit_instance_settings %}
|
||||
|
|
21
bookwyrm/templates/settings/federation.html
Normal file
21
bookwyrm/templates/settings/federation.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends 'settings/admin_layout.html' %}
|
||||
{% block header %}Federated Servers{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
|
||||
<table class="table is-striped">
|
||||
<tr>
|
||||
<th>Server name</th>
|
||||
<th>Software</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
{% for server in servers %}
|
||||
<tr>
|
||||
<td>{{ server.server_name }}</td>
|
||||
<td>{{ server.application_type }} ({{ server.application_version }})</td>
|
||||
<td>{{ server.status }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
|
@ -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<code>[A-Za-z0-9]+)/?$', views.Invite.as_view()),
|
||||
|
|
|
@ -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
|
||||
|
|
24
bookwyrm/views/federation.py
Normal file
24
bookwyrm/views/federation.py
Normal file
|
@ -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)
|
Loading…
Reference in a new issue