mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
privoxy: Remove get-enabled from actions
This commit is contained in:
parent
cedec9b624
commit
4906384b39
@ -37,8 +37,6 @@ def parse_arguments():
|
|||||||
|
|
||||||
subparsers.add_parser('setup',
|
subparsers.add_parser('setup',
|
||||||
help='Perform Privoxy configuration setup')
|
help='Perform Privoxy configuration setup')
|
||||||
subparsers.add_parser('get-enabled',
|
|
||||||
help='Get whether Privoxy service is enabled')
|
|
||||||
subparsers.add_parser('enable', help='Enable Privoxy service')
|
subparsers.add_parser('enable', help='Enable Privoxy service')
|
||||||
subparsers.add_parser('disable', help='Disable Privoxy service')
|
subparsers.add_parser('disable', help='Disable Privoxy service')
|
||||||
|
|
||||||
@ -65,12 +63,6 @@ def subcommand_setup(_):
|
|||||||
action_utils.service_restart('privoxy')
|
action_utils.service_restart('privoxy')
|
||||||
|
|
||||||
|
|
||||||
def subcommand_get_enabled(_):
|
|
||||||
"""Get whether service is enabled."""
|
|
||||||
is_enabled = action_utils.service_is_enabled('privoxy')
|
|
||||||
print('yes' if is_enabled else 'no')
|
|
||||||
|
|
||||||
|
|
||||||
def subcommand_enable(_):
|
def subcommand_enable(_):
|
||||||
"""Start service."""
|
"""Start service."""
|
||||||
action_utils.service_enable('privoxy')
|
action_utils.service_enable('privoxy')
|
||||||
|
|||||||
@ -22,6 +22,7 @@ Plinth module to configure Privoxy.
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
|
from plinth import action_utils
|
||||||
from plinth import cfg
|
from plinth import cfg
|
||||||
from plinth import service as service_module
|
from plinth import service as service_module
|
||||||
|
|
||||||
@ -37,10 +38,17 @@ def init():
|
|||||||
menu.add_urlname(_('Web Proxy (Privoxy)'), 'glyphicon-cloud-upload',
|
menu.add_urlname(_('Web Proxy (Privoxy)'), 'glyphicon-cloud-upload',
|
||||||
'privoxy:index', 50)
|
'privoxy:index', 50)
|
||||||
|
|
||||||
output = actions.run('privoxy', ['get-enabled'])
|
|
||||||
enabled = (output.strip() == 'yes')
|
|
||||||
|
|
||||||
global service
|
global service
|
||||||
service = service_module.Service(
|
service = service_module.Service(
|
||||||
'privoxy', _('Privoxy Web Proxy'),
|
'privoxy', _('Privoxy Web Proxy'),
|
||||||
is_external=False, enabled=enabled)
|
is_external=False, enabled=is_enabled())
|
||||||
|
|
||||||
|
|
||||||
|
def is_enabled():
|
||||||
|
"""Return whether the module is enabled."""
|
||||||
|
return action_utils.service_is_enabled('privoxy')
|
||||||
|
|
||||||
|
|
||||||
|
def is_running():
|
||||||
|
"""Return whether the service is running."""
|
||||||
|
return action_utils.service_is_running('privoxy')
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import logging
|
|||||||
|
|
||||||
from .forms import PrivoxyForm
|
from .forms import PrivoxyForm
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth import action_utils
|
|
||||||
from plinth import package
|
from plinth import package
|
||||||
from plinth.modules import privoxy
|
from plinth.modules import privoxy
|
||||||
|
|
||||||
@ -63,11 +62,8 @@ def index(request):
|
|||||||
|
|
||||||
def get_status():
|
def get_status():
|
||||||
"""Get the current settings from server."""
|
"""Get the current settings from server."""
|
||||||
output = actions.run('privoxy', ['get-enabled'])
|
status = {'enabled': privoxy.is_enabled(),
|
||||||
enabled = (output.strip() == 'yes')
|
'is_running': privoxy.is_running()}
|
||||||
|
|
||||||
status = {'enabled': enabled,
|
|
||||||
'is_running': action_utils.service_is_running('privoxy')}
|
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user