dynamicdns: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 14:54:57 +05:30
parent 28a889c54b
commit 1842db42da
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 41 additions and 43 deletions

View File

@ -19,9 +19,42 @@
Plinth module to configure ez-ipupdate client
"""
from . import dynamicdns
from .dynamicdns import init
from django.utils.translation import ugettext_lazy as _
__all__ = ['dynamicdns', 'init']
from plinth import cfg
from plinth.utils import format_lazy
version = 1
depends = ['apps']
title = _('Dynamic DNS Client')
description = [
format_lazy(
_('If your internet provider changes your IP address periodic '
'(i.e. every 24h) it may be hard for others to find you in the '
'WEB. And for this reason nobody may find the services which are '
'provided by {box_name}, such as ownCloud.'),
box_name=_(cfg.box_name)),
_('The solution is to assign a DNS name to your IP address and '
'update the DNS name every time your IP is changed by your '
'Internet provider. Dynamic DNS allows you to push your current '
'public IP address to an '
'<a href=\'http://gnudip2.sourceforge.net/\' target=\'_blank\'> '
'gnudip </a> server. Afterwards the Server will assign your DNS name '
'with the new IP and if someone from the Internet asks for your DNS '
'name he will get your current IP answered.')
]
def init():
"""Initialize the module."""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(title, 'glyphicon-refresh', 'dynamicdns:index', 500)
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(['ez-ipupdate'])

View File

@ -25,7 +25,7 @@ import logging
from plinth import actions
from plinth import cfg
from plinth import package
from plinth.modules import dynamicdns
from plinth.utils import format_lazy
logger = logging.getLogger(__name__)
@ -39,19 +39,11 @@ subsubmenu = [{'url': reverse_lazy('dynamicdns:index'),
'text': ugettext_lazy('Status')}]
def init():
"""Initialize the dynamicdns module"""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(ugettext_lazy('Dynamic DNS'), 'glyphicon-refresh',
'dynamicdns:index', 500)
@package.required(['ez-ipupdate'])
def index(request):
"""Serve Dynamic DNS page."""
return TemplateResponse(request, 'dynamicdns.html',
{'title': _('Dynamic DNS'),
{'title': dynamicdns.title,
'description': dynamicdns.description,
'subsubmenu': subsubmenu})
@ -198,7 +190,6 @@ class ConfigureForm(forms.Form):
raise forms.ValidationError(_('Please provide a password'))
@package.required(['ez-ipupdate'])
def configure(request):
"""Serve the configuration form."""
status = get_status()
@ -219,7 +210,6 @@ def configure(request):
'subsubmenu': subsubmenu})
@package.required(['ez-ipupdate'])
def statuspage(request):
"""Serve the status page."""
check_nat = actions.run('dynamicdns', ['get-nat'])

View File

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "app.html" %}
{% comment %}
#
# This file is part of Plinth.
@ -20,32 +20,7 @@
{% load i18n %}
{% block content %}
<h2>{% trans "Dynamic DNS Client" %}</h2>
<p>
{% blocktrans trimmed %}
If your internet provider changes your IP address periodic
(i.e. every 24h) it may be hard for others to find you in the
WEB. And for this reason nobody may find the services which are
provided by {{ box_name }}, such as ownCloud.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
The solution is to assign a DNS name to your IP address and
update the DNS name every time your IP is changed by your
Internet provider. Dynamic DNS allows you to push your current
public IP address to an
<a href='http://gnudip2.sourceforge.net/' target='_blank'> gnudip </a>
server. Afterwards the Server will assign your DNS name with the
new IP and if someone from the Internet asks for your DNS name
he will get your current IP answered.
{% endblocktrans %}
</p>
{% block configuration %}
<p>
{% blocktrans trimmed %}
If you are looking for a free dynamic DNS account, you may find