diff --git a/plinth/modules/cockpit/__init__.py b/plinth/modules/cockpit/__init__.py index a37547ae4..e303f7761 100644 --- a/plinth/modules/cockpit/__init__.py +++ b/plinth/modules/cockpit/__init__.py @@ -44,6 +44,8 @@ managed_packages = ['cockpit'] name = _('Cockpit') +icon_filename = 'cockpit' + short_description = _('Server Administration') description = [ diff --git a/plinth/modules/cockpit/templates/cockpit.html b/plinth/modules/cockpit/templates/cockpit.html new file mode 100644 index 000000000..1274721f1 --- /dev/null +++ b/plinth/modules/cockpit/templates/cockpit.html @@ -0,0 +1,39 @@ +{% extends "app.html" %} +{% comment %} +# +# This file is part of FreedomBox. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +{% endcomment %} +{% load bootstrap %} +{% load i18n %} + +{% block status %} + {{ block.super }} + +

{% trans "Access" %}

+ +

+ {% blocktrans trimmed %} + Cockpit will only work when accessed using the following URLs. + {% endblocktrans %} +

+ +
    + {% for url_ in urls %} +
  1. {{ url_ }}
  2. + {% endfor %} +
+{% endblock %} diff --git a/plinth/modules/cockpit/urls.py b/plinth/modules/cockpit/urls.py index 2abb14456..78ef23fae 100644 --- a/plinth/modules/cockpit/urls.py +++ b/plinth/modules/cockpit/urls.py @@ -20,15 +20,8 @@ URLs for Cockpit module. from django.conf.urls import url -from plinth.modules import cockpit -from plinth.views import AppView +from plinth.modules.cockpit.views import CockpitAppView urlpatterns = [ - url( - r'^sys/cockpit/$', - AppView.as_view(app_id='cockpit', name=cockpit.name, - diagnostics_module_name='cockpit', - description=cockpit.description, - show_status_block=True, clients=cockpit.clients, - manual_page=cockpit.manual_page), name='index'), + url(r'^sys/cockpit/$', CockpitAppView.as_view(), name='index'), ] diff --git a/plinth/modules/cockpit/views.py b/plinth/modules/cockpit/views.py new file mode 100644 index 000000000..a7e7b0d2e --- /dev/null +++ b/plinth/modules/cockpit/views.py @@ -0,0 +1,46 @@ +# +# This file is part of FreedomBox. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +""" +Views for the Cockpit module +""" +from plinth.views import AppView +from plinth.modules.cockpit import ( + name, + description, + clients, + manual_page, + icon_filename, +) +from plinth.modules.cockpit.utils import get_origin_domains, load_augeas + + +class CockpitAppView(AppView): + app_id = 'cockpit' + name = name + description = description + diagnostics_module_name = 'cockpit' + show_status_block = True + clients = clients + manual_page = manual_page + template_name = 'cockpit.html' + icon_filename = icon_filename + + def get_context_data(self, *args, **kwargs): + context = super().get_context_data(**kwargs) + context['urls'] = get_origin_domains(load_augeas()) + + return context