tor: Fix issue with promoting/demoting menu item

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2019-05-07 15:19:29 -07:00
parent c0bb1282b8
commit 8ebde0dc90
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 29 additions and 0 deletions

View File

@ -137,6 +137,30 @@ def setup(helper, old_version=None):
helper.call('post', bridge_service.notify_enabled, None, True)
helper.call('post', update_hidden_service_domain)
menu = main_menu.get('apps')
helper.call('post', menu.promote_item, 'tor:index')
def enable():
"""Enable the app.
XXX: Currently performs only partial activities while the rest happens
elsewhere.
"""
menu = main_menu.get('apps')
menu.promote_item('tor:index')
def disable():
"""Enable the app.
XXX: Currently performs only partial activities while the rest happens
elsewhere.
"""
menu = main_menu.get('apps')
menu.demote_item('tor:index')
def update_hidden_service_domain(status=None):

View File

@ -124,6 +124,11 @@ def __apply_changes(request, old_status, new_status):
if old_status['enabled'] != new_status['enabled']:
arg_value = 'enable' if new_status['enabled'] else 'disable'
arguments.extend(['--service', arg_value])
if new_status['enabled']:
tor.enable()
else:
tor.disable()
config_process = actions.superuser_run(
'tor', ['configure'] + arguments, run_in_background=True)
return