mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
yapf and isort fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
b6987b8f3d
commit
dfb4ad3260
@ -20,16 +20,13 @@ FreedomBox app to configure Cockpit.
|
|||||||
|
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from plinth.utils import format_lazy
|
|
||||||
|
|
||||||
from plinth import actions
|
from plinth import action_utils, actions, cfg, frontpage
|
||||||
from plinth import action_utils
|
|
||||||
from plinth import cfg
|
|
||||||
from plinth import frontpage
|
|
||||||
from plinth import service as service_module
|
from plinth import service as service_module
|
||||||
from plinth.menu import main_menu
|
from plinth.menu import main_menu
|
||||||
from plinth.modules import names
|
from plinth.modules import names
|
||||||
from plinth.signals import domain_added, domain_removed, domainname_change
|
from plinth.signals import domain_added, domain_removed, domainname_change
|
||||||
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
@ -53,8 +50,8 @@ description = [
|
|||||||
'/_cockpit/</a> path on the web server. It can be accessed by '
|
'/_cockpit/</a> path on the web server. It can be accessed by '
|
||||||
'<a href="{users_url}">any user</a> with a {box_name} login. '
|
'<a href="{users_url}">any user</a> with a {box_name} login. '
|
||||||
'Sensitive information and system altering abilities are limited to '
|
'Sensitive information and system altering abilities are limited to '
|
||||||
'users belonging to admin group.'),
|
'users belonging to admin group.'), box_name=_(cfg.box_name),
|
||||||
box_name=_(cfg.box_name), users_url=reverse_lazy('users:index')),
|
users_url=reverse_lazy('users:index')),
|
||||||
_('Currently only limited functionality is available.'),
|
_('Currently only limited functionality is available.'),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -70,10 +67,10 @@ def init():
|
|||||||
global service
|
global service
|
||||||
setup_helper = globals()['setup_helper']
|
setup_helper = globals()['setup_helper']
|
||||||
if setup_helper.get_state() != 'needs-setup':
|
if setup_helper.get_state() != 'needs-setup':
|
||||||
service = service_module.Service(
|
service = service_module.Service(managed_services[0], name, ports=[
|
||||||
managed_services[0], name, ports=['http', 'https'],
|
'http', 'https'
|
||||||
is_external=True,
|
], is_external=True, is_enabled=is_enabled, enable=enable,
|
||||||
is_enabled=is_enabled, enable=enable, disable=disable)
|
disable=disable)
|
||||||
|
|
||||||
if is_enabled():
|
if is_enabled():
|
||||||
add_shortcut()
|
add_shortcut()
|
||||||
@ -86,16 +83,17 @@ def init():
|
|||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
domains = [domain
|
domains = [
|
||||||
for domains_of_a_type in names.domains.values()
|
domain for domains_of_a_type in names.domains.values()
|
||||||
for domain in domains_of_a_type]
|
for domain in domains_of_a_type
|
||||||
|
]
|
||||||
helper.call('post', actions.superuser_run, 'cockpit', ['setup'] + domains)
|
helper.call('post', actions.superuser_run, 'cockpit', ['setup'] + domains)
|
||||||
global service
|
global service
|
||||||
if service is None:
|
if service is None:
|
||||||
service = service_module.Service(
|
service = service_module.Service(managed_services[0], name, ports=[
|
||||||
managed_services[0], name, ports=['http', 'https'],
|
'http', 'https'
|
||||||
is_external=True,
|
], is_external=True, is_enabled=is_enabled, enable=enable,
|
||||||
is_enabled=is_enabled, enable=enable, disable=disable)
|
disable=disable)
|
||||||
helper.call('post', service.notify_enabled, None, True)
|
helper.call('post', service.notify_enabled, None, True)
|
||||||
helper.call('post', add_shortcut)
|
helper.call('post', add_shortcut)
|
||||||
|
|
||||||
@ -104,14 +102,13 @@ def add_shortcut():
|
|||||||
"""Add a shortcut the frontpage."""
|
"""Add a shortcut the frontpage."""
|
||||||
frontpage.add_shortcut('cockpit', name,
|
frontpage.add_shortcut('cockpit', name,
|
||||||
short_description=short_description,
|
short_description=short_description,
|
||||||
url='/_cockpit/',
|
url='/_cockpit/', login_required=True)
|
||||||
login_required=True)
|
|
||||||
|
|
||||||
|
|
||||||
def is_enabled():
|
def is_enabled():
|
||||||
"""Return whether the module is enabled."""
|
"""Return whether the module is enabled."""
|
||||||
return (action_utils.webserver_is_enabled('cockpit-freedombox') and
|
return (action_utils.webserver_is_enabled('cockpit-freedombox')
|
||||||
action_utils.service_is_running('cockpit.socket'))
|
and action_utils.service_is_running('cockpit.socket'))
|
||||||
|
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
|
|||||||
@ -24,8 +24,8 @@ import socket
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import service as service_module
|
|
||||||
from plinth import action_utils, actions, cfg, frontpage
|
from plinth import action_utils, actions, cfg, frontpage
|
||||||
|
from plinth import service as service_module
|
||||||
from plinth.menu import main_menu
|
from plinth.menu import main_menu
|
||||||
from plinth.signals import (domainname_change, post_hostname_change,
|
from plinth.signals import (domainname_change, post_hostname_change,
|
||||||
pre_hostname_change)
|
pre_hostname_change)
|
||||||
@ -51,10 +51,9 @@ description = [
|
|||||||
'web client</a> or any other <a href=\'https://xmpp.org/'
|
'web client</a> or any other <a href=\'https://xmpp.org/'
|
||||||
'software/clients\' target=\'_blank\'>XMPP client</a>. '
|
'software/clients\' target=\'_blank\'>XMPP client</a>. '
|
||||||
'When enabled, ejabberd can be accessed by any <a href="{users_url}">'
|
'When enabled, ejabberd can be accessed by any <a href="{users_url}">'
|
||||||
'user with a {box_name} login</a>.'),
|
'user with a {box_name} login</a>.'), box_name=_(cfg.box_name),
|
||||||
box_name=_(cfg.box_name), users_url=reverse_lazy('users:index'),
|
users_url=reverse_lazy('users:index'),
|
||||||
jsxc_url=reverse_lazy('jsxc:index')
|
jsxc_url=reverse_lazy('jsxc:index'))
|
||||||
)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
clients = clients
|
clients = clients
|
||||||
@ -77,10 +76,11 @@ def init():
|
|||||||
global service
|
global service
|
||||||
setup_helper = globals()['setup_helper']
|
setup_helper = globals()['setup_helper']
|
||||||
if setup_helper.get_state() != 'needs-setup':
|
if setup_helper.get_state() != 'needs-setup':
|
||||||
service = service_module.Service('ejabberd', name, ports=[
|
service = service_module.Service(
|
||||||
'xmpp-client', 'xmpp-server', 'xmpp-bosh'
|
'ejabberd', name,
|
||||||
], is_external=True, is_enabled=is_enabled, enable=enable,
|
ports=['xmpp-client', 'xmpp-server',
|
||||||
disable=disable)
|
'xmpp-bosh'], is_external=True, is_enabled=is_enabled,
|
||||||
|
enable=enable, disable=disable)
|
||||||
if is_enabled():
|
if is_enabled():
|
||||||
add_shortcut()
|
add_shortcut()
|
||||||
pre_hostname_change.connect(on_pre_hostname_change)
|
pre_hostname_change.connect(on_pre_hostname_change)
|
||||||
@ -99,10 +99,11 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', actions.superuser_run, 'ejabberd', ['setup'])
|
helper.call('post', actions.superuser_run, 'ejabberd', ['setup'])
|
||||||
global service
|
global service
|
||||||
if service is None:
|
if service is None:
|
||||||
service = service_module.Service('ejabberd', name, ports=[
|
service = service_module.Service(
|
||||||
'xmpp-client', 'xmpp-server', 'xmpp-bosh'
|
'ejabberd', name,
|
||||||
], is_external=True, is_enabled=is_enabled, enable=enable,
|
ports=['xmpp-client', 'xmpp-server',
|
||||||
disable=disable)
|
'xmpp-bosh'], is_external=True, is_enabled=is_enabled,
|
||||||
|
enable=enable, disable=disable)
|
||||||
helper.call('post', service.notify_enabled, None, True)
|
helper.call('post', service.notify_enabled, None, True)
|
||||||
helper.call('post', add_shortcut)
|
helper.call('post', add_shortcut)
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,8 @@ FreedomBox app to configure ikiwiki.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import service as service_module
|
|
||||||
from plinth import action_utils, actions, cfg, frontpage
|
from plinth import action_utils, actions, cfg, frontpage
|
||||||
|
from plinth import service as service_module
|
||||||
from plinth.menu import main_menu
|
from plinth.menu import main_menu
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
@ -54,7 +54,7 @@ description = [
|
|||||||
'group can <i>edit</i> existing ones. In the <a href="{users_url}">'
|
'group can <i>edit</i> existing ones. In the <a href="{users_url}">'
|
||||||
'User Configuration</a> you can change these '
|
'User Configuration</a> you can change these '
|
||||||
'permissions or add new users.'), box_name=_(cfg.box_name),
|
'permissions or add new users.'), box_name=_(cfg.box_name),
|
||||||
users_url = reverse_lazy('users:index'))
|
users_url=reverse_lazy('users:index'))
|
||||||
]
|
]
|
||||||
|
|
||||||
clients = clients
|
clients = clients
|
||||||
|
|||||||
@ -21,8 +21,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from plinth.clients import validate
|
from plinth.clients import validate
|
||||||
|
|
||||||
clients = validate([{
|
clients = validate([{
|
||||||
'name':
|
'name': _('JSXC'),
|
||||||
_('JSXC'),
|
|
||||||
'platforms': [{
|
'platforms': [{
|
||||||
'type': 'web',
|
'type': 'web',
|
||||||
'url': reverse_lazy('jsxc:jsxc')
|
'url': reverse_lazy('jsxc:jsxc')
|
||||||
|
|||||||
@ -21,8 +21,8 @@ FreedomBox app to configure Tiny Tiny RSS.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import service as service_module
|
|
||||||
from plinth import action_utils, actions, cfg, frontpage
|
from plinth import action_utils, actions, cfg, frontpage
|
||||||
|
from plinth import service as service_module
|
||||||
from plinth.menu import main_menu
|
from plinth.menu import main_menu
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user