mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
avahi: Minor fixes
- PEP8 fixes. - Don't need to disable .socket and .service. Disabling .service will take care of disabling both. - Update the introduction message. - Add prefix to form so that it can potentially be mixed with other forms.
This commit is contained in:
parent
e6f7e6020f
commit
94cdd19070
@ -17,7 +17,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Configuration helper for service discovery
|
Configuration helper for service discovery.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@ -38,14 +38,12 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_enable(_):
|
def subcommand_enable(_):
|
||||||
"""Start service."""
|
"""Start service."""
|
||||||
action_utils.service_enable('avahi-daemon.socket')
|
action_utils.service_enable('avahi-daemon')
|
||||||
action_utils.service_enable('avahi-daemon.service')
|
|
||||||
|
|
||||||
|
|
||||||
def subcommand_disable(_):
|
def subcommand_disable(_):
|
||||||
"""Stop service."""
|
"""Stop service."""
|
||||||
action_utils.service_disable('avahi-daemon.service')
|
action_utils.service_disable('avahi-daemon')
|
||||||
action_utils.service_disable('avahi-daemon.socket')
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Plinth module for service discovery
|
Plinth module for service discovery.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
@ -40,7 +40,7 @@ def init():
|
|||||||
menu.add_urlname(_('Service Discovery'), 'glyphicon-lamp',
|
menu.add_urlname(_('Service Discovery'), 'glyphicon-lamp',
|
||||||
'avahi:index', 950)
|
'avahi:index', 950)
|
||||||
|
|
||||||
global service # pylint: disable=W0603
|
global service # pylint: disable=W0603
|
||||||
service = service_module.Service(
|
service = service_module.Service(
|
||||||
'avahi', _('Service Discovery'), ['mdns'],
|
'avahi', _('Service Discovery'), ['mdns'],
|
||||||
is_external=False, enabled=is_enabled())
|
is_external=False, enabled=is_enabled())
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Plinth module for service discovery forms
|
Plinth module for service discovery forms.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|||||||
@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
<h2>Service Discovery</h2>
|
<h2>Service Discovery</h2>
|
||||||
|
|
||||||
<p>Service discovery is a program that can discover other machines and services
|
<p>Service discovery allows other machines on the network to discover
|
||||||
running on your local network. It can also helps those other machines find your
|
your FreedomBox and services running on it. It also allows
|
||||||
FreedomBox, and the services running on it. Service discovery is not required,
|
FreedomBox to discover other machines and services running on your
|
||||||
though. Some users decide to disable it to minimize the
|
local network. Service discovery is not essential and works only on
|
||||||
<a href="https://en.wikipedia.org/wiki/Attack_surface">attack surface</a>
|
internal networks. It may be disabled to improve security
|
||||||
of their FreedomBox.
|
especially when connecting to a hostile local network.</p>
|
||||||
|
|
||||||
<h3>Status</h3>
|
<h3>Status</h3>
|
||||||
|
|
||||||
|
|||||||
@ -16,12 +16,12 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
URLs for the service discovery module
|
URLs for the service discovery module.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable=C0103
|
urlpatterns = patterns( # pylint: disable=C0103
|
||||||
'plinth.modules.avahi.views',
|
'plinth.modules.avahi.views',
|
||||||
url(r'^sys/avahi/$', 'index', name='index'),
|
url(r'^sys/avahi/$', 'index', name='index'),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Plinth module for service discovery views
|
Plinth module for service discovery views.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
@ -30,7 +30,7 @@ from plinth import package
|
|||||||
from plinth.modules import avahi
|
from plinth.modules import avahi
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__) # pylint: disable=C0103
|
logger = logging.getLogger(__name__) # pylint: disable=C0103
|
||||||
|
|
||||||
|
|
||||||
@package.required(['avahi-daemon'])
|
@package.required(['avahi-daemon'])
|
||||||
@ -41,13 +41,13 @@ def index(request):
|
|||||||
form = None
|
form = None
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = ServiceDiscoveryForm(request.POST)
|
form = ServiceDiscoveryForm(request.POST, prefix='avahi')
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
_apply_changes(request, status, form.cleaned_data)
|
_apply_changes(request, status, form.cleaned_data)
|
||||||
status = get_status()
|
status = get_status()
|
||||||
form = ServiceDiscoveryForm(initial=status)
|
form = ServiceDiscoveryForm(initial=status, prefix='avahi')
|
||||||
else:
|
else:
|
||||||
form = ServiceDiscoveryForm(initial=status)
|
form = ServiceDiscoveryForm(initial=status, prefix='avahi')
|
||||||
|
|
||||||
return TemplateResponse(request, 'avahi.html',
|
return TemplateResponse(request, 'avahi.html',
|
||||||
{'title': _('Service Discovery'),
|
{'title': _('Service Discovery'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user