mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
Add/remove domain name in names module when domain name is configured in dynamicdns module
Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
This commit is contained in:
parent
d8849114ba
commit
1e19508b95
@ -23,8 +23,10 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from plinth import cfg
|
from plinth import cfg
|
||||||
from plinth.menu import main_menu
|
from plinth.menu import main_menu
|
||||||
|
from plinth.signals import domain_added
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
|
from . import dynamicdns
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
@ -56,6 +58,11 @@ def init():
|
|||||||
"""Initialize the module."""
|
"""Initialize the module."""
|
||||||
menu = main_menu.get('system')
|
menu = main_menu.get('system')
|
||||||
menu.add_urlname(title, 'glyphicon-refresh', 'dynamicdns:index')
|
menu.add_urlname(title, 'glyphicon-refresh', 'dynamicdns:index')
|
||||||
|
current_status = dynamicdns.get_status()
|
||||||
|
if current_status['enabled']:
|
||||||
|
domain_added.send_robust(
|
||||||
|
sender='dynamicdns', domain_type='dynamicdnsservice',
|
||||||
|
name=current_status['dynamicdns_domain'], description=_('Dynamic DNS Service'))
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import logging
|
|||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth import cfg
|
from plinth import cfg
|
||||||
from plinth.modules import dynamicdns
|
from plinth.modules import dynamicdns
|
||||||
|
from plinth.signals import domain_added, domain_removed
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -356,9 +357,16 @@ def _apply_changes(request, old_status, new_status):
|
|||||||
input=new_status['dynamicdns_secret'].encode())
|
input=new_status['dynamicdns_secret'].encode())
|
||||||
|
|
||||||
if old_status['enabled']:
|
if old_status['enabled']:
|
||||||
|
domain_removed.send_robust(
|
||||||
|
sender='dynamicdns', domain_type='dynamicdnsservice',
|
||||||
|
name = old_status['dynamicdns_domain']
|
||||||
|
)
|
||||||
_run(['stop'])
|
_run(['stop'])
|
||||||
|
|
||||||
if new_status['enabled']:
|
if new_status['enabled']:
|
||||||
|
domain_added.send_robust(
|
||||||
|
sender='dynamicdns', domain_type='dynamicdnsservice',
|
||||||
|
name=new_status['dynamicdns_domain'], description=_('Dynamic DNS Service'))
|
||||||
_run(['start'])
|
_run(['start'])
|
||||||
|
|
||||||
messages.success(request, _('Configuration updated'))
|
messages.success(request, _('Configuration updated'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user