mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
avahi: Use new setup mechanism
This commit is contained in:
parent
83a56bba93
commit
ad8fea5eb2
@ -24,24 +24,45 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from plinth import action_utils
|
||||
from plinth import cfg
|
||||
from plinth import service as service_module
|
||||
from plinth.utils import format_lazy
|
||||
|
||||
# pylint: disable=C0103
|
||||
|
||||
version = 1
|
||||
|
||||
is_essential = True
|
||||
|
||||
depends = ['system']
|
||||
|
||||
title = _('Service Discovery')
|
||||
|
||||
description = [
|
||||
format_lazy(
|
||||
_('Service discovery allows other devices on the network to '
|
||||
'discover your {{ box_name }} and services running on it. It '
|
||||
'also allows {{ box_name }} to discover other devices and '
|
||||
'services running on your local network. Service discovery is '
|
||||
'not essential and works only on internal networks. It may be '
|
||||
'disabled to improve security especially when connecting to a '
|
||||
'hostile local network.'), box_name=_(cfg.box_name))
|
||||
]
|
||||
|
||||
service = None
|
||||
|
||||
|
||||
def init():
|
||||
"""Intialize the service discovery module."""
|
||||
menu = cfg.main_menu.get('system:index')
|
||||
menu.add_urlname(_('Service Discovery'), 'glyphicon-lamp',
|
||||
'avahi:index', 950)
|
||||
menu.add_urlname(title, 'glyphicon-lamp', 'avahi:index', 950)
|
||||
|
||||
global service # pylint: disable=W0603
|
||||
service = service_module.Service(
|
||||
'avahi', _('Service Discovery'), ['mdns'],
|
||||
is_external=False, enabled=is_enabled())
|
||||
'avahi', title, ['mdns'], is_external=False, enabled=is_enabled())
|
||||
|
||||
|
||||
def setup(helper, old_version=False):
|
||||
"""Install and configure the module."""
|
||||
helper.install(['avahi-daemon'])
|
||||
|
||||
|
||||
def is_enabled():
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "app.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
@ -21,21 +21,7 @@
|
||||
{% load bootstrap %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>{% trans "Service Discovery" %}</h2>
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
Service discovery allows other devices on the network to
|
||||
discover your {{ box_name }} and services running on it. It
|
||||
also allows {{ box_name }} to discover other devices and
|
||||
services running on your local network. Service discovery is
|
||||
not essential and works only on internal networks. It may be
|
||||
disabled to improve security especially when connecting to a
|
||||
hostile local network.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% block configuration %}
|
||||
|
||||
<h3>{% trans "Status" %}</h3>
|
||||
|
||||
|
||||
@ -26,14 +26,12 @@ import logging
|
||||
|
||||
from .forms import ServiceDiscoveryForm
|
||||
from plinth import actions
|
||||
from plinth import package
|
||||
from plinth.modules import avahi
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__) # pylint: disable=C0103
|
||||
|
||||
|
||||
@package.required(['avahi-daemon'])
|
||||
def index(request):
|
||||
"""Serve configuration page."""
|
||||
status = get_status()
|
||||
@ -50,7 +48,8 @@ def index(request):
|
||||
form = ServiceDiscoveryForm(initial=status, prefix='avahi')
|
||||
|
||||
return TemplateResponse(request, 'avahi.html',
|
||||
{'title': _('Service Discovery'),
|
||||
{'title': avahi.title,
|
||||
'description': avahi.description,
|
||||
'status': status,
|
||||
'form': form})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user