mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-17 11:10:23 +00:00
cockpit: add list of valid urls to access the app.
Closes #1649 Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
656988cc54
commit
4805e01929
@ -44,6 +44,8 @@ managed_packages = ['cockpit']
|
||||
|
||||
name = _('Cockpit')
|
||||
|
||||
icon_filename = 'cockpit'
|
||||
|
||||
short_description = _('Server Administration')
|
||||
|
||||
description = [
|
||||
|
||||
39
plinth/modules/cockpit/templates/cockpit.html
Normal file
39
plinth/modules/cockpit/templates/cockpit.html
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
{% endcomment %}
|
||||
{% load bootstrap %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block status %}
|
||||
{{ block.super }}
|
||||
|
||||
<h3>{% trans "Access" %}</h3>
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
Cockpit will only work when accessed using the following URLs.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
{% for url_ in urls %}
|
||||
<li>{{ url_ }}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endblock %}
|
||||
@ -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'),
|
||||
]
|
||||
|
||||
46
plinth/modules/cockpit/views.py
Normal file
46
plinth/modules/cockpit/views.py
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
"""
|
||||
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
|
||||
Loading…
x
Reference in New Issue
Block a user