mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
framework: Remove module init() functions
Fixes #1906 Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
0df674dc20
commit
d92ca09e19
@ -5,13 +5,14 @@ Discover, load and manage FreedomBox applications.
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import importlib
|
import importlib
|
||||||
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
|
||||||
from plinth import cfg, setup
|
from plinth import app, cfg, setup
|
||||||
from plinth.signals import post_module_loading, pre_module_loading
|
from plinth.signals import post_module_loading, pre_module_loading
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -109,18 +110,24 @@ def _include_module_urls(module_import_path, module_name):
|
|||||||
|
|
||||||
|
|
||||||
def _initialize_module(module_name, module):
|
def _initialize_module(module_name, module):
|
||||||
"""Call initialization method in the module if it exists"""
|
"""Perform module initialization"""
|
||||||
|
|
||||||
# Perform setup related initialization on the module
|
# Perform setup related initialization on the module
|
||||||
setup.init(module_name, module)
|
setup.init(module_name, module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
init = module.init
|
module_classes = inspect.getmembers(module, inspect.isclass)
|
||||||
except AttributeError:
|
app_class = [
|
||||||
logger.debug('No init() for module - %s', module.__name__)
|
cls for cls in module_classes if issubclass(cls[1], app.App)
|
||||||
return
|
]
|
||||||
|
if module_classes and app_class:
|
||||||
|
module.app = app_class[0][1]()
|
||||||
|
|
||||||
try:
|
if module.setup_helper.get_state(
|
||||||
init()
|
) != 'needs-setup' and module.app.is_enabled():
|
||||||
|
module.app.set_enabled(True)
|
||||||
|
|
||||||
|
logger.debug("Initialized %s", module.__name__)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
logger.exception('Exception while running init for %s: %s', module,
|
logger.exception('Exception while running init for %s: %s', module,
|
||||||
exception)
|
exception)
|
||||||
|
|||||||
@ -56,13 +56,6 @@ class ApacheApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initailze firewall module"""
|
|
||||||
global app
|
|
||||||
app = ApacheApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Configure the module."""
|
"""Configure the module."""
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
|
|||||||
@ -76,19 +76,13 @@ class AvahiApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-avahi', managed_services[0])
|
daemon = Daemon('daemon-avahi', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
if self.is_enabled():
|
||||||
|
domain_added.send_robust(sender='avahi',
|
||||||
|
domain_type='domain-type-local',
|
||||||
|
name=get_hostname() + '.local',
|
||||||
|
services='__all__')
|
||||||
|
|
||||||
def init():
|
post_hostname_change.connect(on_post_hostname_change)
|
||||||
"""Initialize the service discovery module."""
|
|
||||||
global app
|
|
||||||
app = AvahiApp()
|
|
||||||
if app.is_enabled():
|
|
||||||
domain_added.send_robust(sender='avahi',
|
|
||||||
domain_type='domain-type-local',
|
|
||||||
name=get_hostname() + '.local',
|
|
||||||
services='__all__')
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
post_hostname_change.connect(on_post_hostname_change)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
|
|||||||
@ -56,16 +56,6 @@ class BackupsApp(app_module.App):
|
|||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = BackupsApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -102,16 +102,6 @@ class BindApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the BIND module."""
|
|
||||||
global app
|
|
||||||
app = BindApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -91,18 +91,8 @@ class CockpitApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-cockpit', managed_services[0])
|
daemon = Daemon('daemon-cockpit', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
domain_added.connect(on_domain_added)
|
||||||
def init():
|
domain_removed.connect(on_domain_removed)
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = CockpitApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
domain_added.connect(on_domain_added)
|
|
||||||
domain_removed.connect(on_domain_removed)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
|
|||||||
@ -62,6 +62,13 @@ class ConfigApp(app_module.App):
|
|||||||
'config:index', can_have_certificate=True)
|
'config:index', can_have_certificate=True)
|
||||||
self.add(domain_type)
|
self.add(domain_type)
|
||||||
|
|
||||||
|
# Register domain with Name Services module.
|
||||||
|
domainname = get_domainname()
|
||||||
|
if domainname:
|
||||||
|
domain_added.send_robust(sender='config',
|
||||||
|
domain_type='domain-type-static',
|
||||||
|
name=domainname, services='__all__')
|
||||||
|
|
||||||
|
|
||||||
def get_domainname():
|
def get_domainname():
|
||||||
"""Return the domainname"""
|
"""Return the domainname"""
|
||||||
@ -142,20 +149,6 @@ def set_advanced_mode(advanced_mode):
|
|||||||
kvstore.set(ADVANCED_MODE_KEY, advanced_mode)
|
kvstore.set(ADVANCED_MODE_KEY, advanced_mode)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module"""
|
|
||||||
global app
|
|
||||||
app = ConfigApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
# Register domain with Name Services module.
|
|
||||||
domainname = get_domainname()
|
|
||||||
if domainname:
|
|
||||||
domain_added.send_robust(sender='config',
|
|
||||||
domain_type='domain-type-static',
|
|
||||||
name=domainname, services='__all__')
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
_migrate_home_page_config()
|
_migrate_home_page_config()
|
||||||
|
|||||||
@ -73,16 +73,6 @@ class CoquelicotApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = CoquelicotApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -99,16 +99,6 @@ class CoturnApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Coturn module."""
|
|
||||||
global app
|
|
||||||
app = CoturnApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -92,15 +92,6 @@ class DateTimeApp(app_module.App):
|
|||||||
return self._is_time_managed()
|
return self._is_time_managed()
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the date/time module."""
|
|
||||||
global app
|
|
||||||
app = DateTimeApp()
|
|
||||||
|
|
||||||
if app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|||||||
@ -88,16 +88,6 @@ class DelugeApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Deluge module."""
|
|
||||||
global app
|
|
||||||
app = DelugeApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -65,13 +65,6 @@ class DiagnosticsApp(app_module.App):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module"""
|
|
||||||
global app
|
|
||||||
app = DiagnosticsApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def start_task():
|
def start_task():
|
||||||
"""Start the run task in a separate thread."""
|
"""Start the run task in a separate thread."""
|
||||||
global running_task
|
global running_task
|
||||||
|
|||||||
@ -112,22 +112,13 @@ class DiasporaApp(app_module.App):
|
|||||||
|
|
||||||
class Shortcut(frontpage.Shortcut):
|
class Shortcut(frontpage.Shortcut):
|
||||||
"""Frontpage shortcut to use configured domain name for URL."""
|
"""Frontpage shortcut to use configured domain name for URL."""
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
"""Set the proper shortcut URL when enabled."""
|
"""Set the proper shortcut URL when enabled."""
|
||||||
super().enable()
|
super().enable()
|
||||||
self.url = 'https://diaspora.{}'.format(get_configured_domain_name())
|
self.url = 'https://diaspora.{}'.format(get_configured_domain_name())
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Diaspora module."""
|
|
||||||
global app
|
|
||||||
app = DiasporaApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.call('pre', actions.superuser_run, 'diaspora', ['pre-install'])
|
helper.call('pre', actions.superuser_run, 'diaspora', ['pre-install'])
|
||||||
|
|||||||
@ -70,18 +70,21 @@ class DynamicDNSApp(app_module.App):
|
|||||||
reserved_usernames=['ez-ipupd'])
|
reserved_usernames=['ez-ipupd'])
|
||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
current_status = get_status()
|
||||||
|
if current_status['enabled']:
|
||||||
|
domain_added.send_robust(sender='dynamicdns',
|
||||||
|
domain_type='domain-type-dynamic',
|
||||||
|
name=current_status['dynamicdns_domain'],
|
||||||
|
services='__all__')
|
||||||
|
self.set_enabled(True)
|
||||||
|
|
||||||
def init():
|
def is_enabled(self):
|
||||||
"""Initialize the module."""
|
"""Return whether all the leader components are enabled.
|
||||||
global app
|
|
||||||
app = DynamicDNSApp()
|
Return True when there are no leader components and DynamicDNS setup
|
||||||
current_status = get_status()
|
is done.
|
||||||
if current_status['enabled']:
|
"""
|
||||||
domain_added.send_robust(sender='dynamicdns',
|
return super().is_enabled() and get_status()['enabled']
|
||||||
domain_type='domain-type-dynamic',
|
|
||||||
name=current_status['dynamicdns_domain'],
|
|
||||||
services='__all__')
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
|
|||||||
@ -113,19 +113,9 @@ class EjabberdApp(app_module.App):
|
|||||||
reserved_usernames=['ejabberd'])
|
reserved_usernames=['ejabberd'])
|
||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
pre_hostname_change.connect(on_pre_hostname_change)
|
||||||
def init():
|
post_hostname_change.connect(on_post_hostname_change)
|
||||||
"""Initialize the ejabberd module"""
|
domain_added.connect(on_domain_added)
|
||||||
global app
|
|
||||||
app = EjabberdApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
pre_hostname_change.connect(on_pre_hostname_change)
|
|
||||||
post_hostname_change.connect(on_post_hostname_change)
|
|
||||||
domain_added.connect(on_domain_added)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
|
|||||||
@ -75,13 +75,6 @@ class FirewallApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initailze firewall module"""
|
|
||||||
global app
|
|
||||||
app = FirewallApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def _run_setup():
|
def _run_setup():
|
||||||
"""Run firewalld setup."""
|
"""Run firewalld setup."""
|
||||||
_run(['setup'], superuser=True)
|
_run(['setup'], superuser=True)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import os
|
|||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from plinth import cfg, module_loader
|
from plinth import app, cfg, module_loader
|
||||||
from plinth.signals import post_setup
|
from plinth.signals import post_setup
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
@ -34,9 +34,15 @@ _all_first_boot_steps = None
|
|||||||
_is_completed = None
|
_is_completed = None
|
||||||
|
|
||||||
|
|
||||||
def init():
|
class FirstBootApp(app.App):
|
||||||
"""Initialize the first boot module."""
|
"""FreedomBox app for First Boot."""
|
||||||
post_setup.connect(_clear_first_boot_steps)
|
|
||||||
|
app_id = 'first_boot'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
"""Create components for the app."""
|
||||||
|
super().__init__()
|
||||||
|
post_setup.connect(_clear_first_boot_steps)
|
||||||
|
|
||||||
|
|
||||||
def _clear_first_boot_steps(sender, module_name, **kwargs):
|
def _clear_first_boot_steps(sender, module_name, **kwargs):
|
||||||
|
|||||||
@ -18,7 +18,7 @@ from plinth.modules.users.components import UsersAndGroups
|
|||||||
|
|
||||||
from .forms import is_repo_url
|
from .forms import is_repo_url
|
||||||
from .manifest import (GIT_REPO_PATH, # noqa, pylint: disable=unused-import
|
from .manifest import (GIT_REPO_PATH, # noqa, pylint: disable=unused-import
|
||||||
backup, clients)
|
backup, clients)
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
@ -88,6 +88,10 @@ class GitwebApp(app_module.App):
|
|||||||
groups=groups)
|
groups=groups)
|
||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
setup_helper = globals()['setup_helper']
|
||||||
|
if setup_helper.get_state() != 'needs-setup':
|
||||||
|
self.update_service_access()
|
||||||
|
|
||||||
def set_shortcut_login_required(self, login_required):
|
def set_shortcut_login_required(self, login_required):
|
||||||
"""Change the login_required property of shortcut."""
|
"""Change the login_required property of shortcut."""
|
||||||
shortcut = self.remove('shortcut-gitweb')
|
shortcut = self.remove('shortcut-gitweb')
|
||||||
@ -164,18 +168,6 @@ class GitwebWebserverAuth(Webserver):
|
|||||||
super().enable()
|
super().enable()
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = GitwebApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup':
|
|
||||||
app.update_service_access()
|
|
||||||
if app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -63,10 +63,3 @@ class HelpApp(app_module.App):
|
|||||||
static_files = web_server.StaticFiles('static-files-help',
|
static_files = web_server.StaticFiles('static-files-help',
|
||||||
directory_map)
|
directory_map)
|
||||||
self.add(static_files)
|
self.add(static_files)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Help module"""
|
|
||||||
global app
|
|
||||||
app = HelpApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|||||||
@ -103,16 +103,6 @@ class I2PApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = I2PApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -101,16 +101,6 @@ class IkiwikiApp(app_module.App):
|
|||||||
return sites
|
return sites
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the ikiwiki module."""
|
|
||||||
global app
|
|
||||||
app = IkiwikiApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -72,16 +72,6 @@ class InfinotedApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the infinoted module."""
|
|
||||||
global app
|
|
||||||
app = InfinotedApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -72,16 +72,6 @@ class JSXCApp(app_module.App):
|
|||||||
self.add(static_files)
|
self.add(static_files)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the JSXC module"""
|
|
||||||
global app
|
|
||||||
app = JSXCApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -73,6 +73,11 @@ class LetsEncryptApp(app_module.App):
|
|||||||
'letsencrypt:index', parent_url_name='system')
|
'letsencrypt:index', parent_url_name='system')
|
||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
domain_added.connect(on_domain_added)
|
||||||
|
domain_removed.connect(on_domain_removed)
|
||||||
|
|
||||||
|
post_module_loading.connect(_certificate_handle_modified)
|
||||||
|
|
||||||
def diagnose(self):
|
def diagnose(self):
|
||||||
"""Run diagnostics and return the results."""
|
"""Run diagnostics and return the results."""
|
||||||
results = super().diagnose()
|
results = super().diagnose()
|
||||||
@ -84,18 +89,6 @@ class LetsEncryptApp(app_module.App):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = LetsEncryptApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
domain_added.connect(on_domain_added)
|
|
||||||
domain_removed.connect(on_domain_removed)
|
|
||||||
|
|
||||||
post_module_loading.connect(_certificate_handle_modified)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -106,16 +106,6 @@ class MatrixSynapseApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the matrix-synapse module."""
|
|
||||||
global app
|
|
||||||
app = MatrixSynapseApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -86,22 +86,13 @@ class MediaWikiApp(app_module.App):
|
|||||||
|
|
||||||
class Shortcut(frontpage.Shortcut):
|
class Shortcut(frontpage.Shortcut):
|
||||||
"""Frontpage shortcut for only logged users when in private mode."""
|
"""Frontpage shortcut for only logged users when in private mode."""
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
"""When enabled, check if MediaWiki is in private mode."""
|
"""When enabled, check if MediaWiki is in private mode."""
|
||||||
super().enable()
|
super().enable()
|
||||||
self.login_required = is_private_mode_enabled()
|
self.login_required = is_private_mode_enabled()
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = MediaWikiApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
@ -125,6 +116,7 @@ def is_private_mode_enabled():
|
|||||||
|
|
||||||
def get_default_skin():
|
def get_default_skin():
|
||||||
"""Return the value of the default skin"""
|
"""Return the value of the default skin"""
|
||||||
|
|
||||||
def _find_skin(config_file):
|
def _find_skin(config_file):
|
||||||
with open(config_file, 'r') as config:
|
with open(config_file, 'r') as config:
|
||||||
for line in config:
|
for line in config:
|
||||||
|
|||||||
@ -92,16 +92,6 @@ class MinetestApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = MinetestApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -81,16 +81,6 @@ class MiniDLNAApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = MiniDLNAApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the package"""
|
"""Install and configure the package"""
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
|
|||||||
@ -89,16 +89,6 @@ class MLDonkeyApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the MLDonkey module."""
|
|
||||||
global app
|
|
||||||
app = MLDonkeyApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.call('pre', actions.superuser_run, 'mldonkey', ['pre-install'])
|
helper.call('pre', actions.superuser_run, 'mldonkey', ['pre-install'])
|
||||||
|
|||||||
@ -61,13 +61,6 @@ class MonkeysphereApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the monkeysphere module."""
|
|
||||||
global app
|
|
||||||
app = MonkeysphereApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -77,16 +77,6 @@ class MumbleApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Mumble module."""
|
|
||||||
global app
|
|
||||||
app = MumbleApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -52,15 +52,8 @@ class NamesApp(app_module.App):
|
|||||||
'names:index', parent_url_name='system')
|
'names:index', parent_url_name='system')
|
||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
domain_added.connect(on_domain_added)
|
||||||
def init():
|
domain_removed.connect(on_domain_removed)
|
||||||
"""Initialize the names module."""
|
|
||||||
global app
|
|
||||||
app = NamesApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
domain_added.connect(on_domain_added)
|
|
||||||
domain_removed.connect(on_domain_removed)
|
|
||||||
|
|
||||||
|
|
||||||
def on_domain_added(sender, domain_type, name='', description='',
|
def on_domain_added(sender, domain_type, name='', description='',
|
||||||
|
|||||||
@ -87,13 +87,6 @@ class NetworksApp(app_module.App):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Networks module."""
|
|
||||||
global app
|
|
||||||
app = NetworksApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -83,16 +83,13 @@ class OpenVPNApp(app_module.App):
|
|||||||
listen_ports=[(1194, 'udp4'), (1194, 'udp6')])
|
listen_ports=[(1194, 'udp4'), (1194, 'udp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
def is_enabled(self):
|
||||||
|
"""Return whether all the leader components are enabled.
|
||||||
|
|
||||||
def init():
|
Return True when there are no leader components and OpenVPN setup
|
||||||
"""Initialize the OpenVPN module."""
|
is done.
|
||||||
global app
|
"""
|
||||||
app = OpenVPNApp()
|
return super().is_enabled() and is_setup()
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled() \
|
|
||||||
and is_setup():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
|
|||||||
@ -80,6 +80,9 @@ class PagekiteApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-pagekite', managed_services[0])
|
daemon = Daemon('daemon-pagekite', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
# Register kite name with Name Services module.
|
||||||
|
utils.update_names_module(is_enabled=self.is_enabled())
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
"""Send domain signals after enabling the app."""
|
"""Send domain signals after enabling the app."""
|
||||||
super().enable()
|
super().enable()
|
||||||
@ -91,19 +94,6 @@ class PagekiteApp(app_module.App):
|
|||||||
super().disable()
|
super().disable()
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the PageKite module"""
|
|
||||||
global app
|
|
||||||
app = PagekiteApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
# Register kite name with Name Services module.
|
|
||||||
utils.update_names_module(is_enabled=True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -70,16 +70,6 @@ class PerformanceApp(app_module.App):
|
|||||||
self.add(daemon_3)
|
self.add(daemon_3)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Performance module."""
|
|
||||||
global app
|
|
||||||
app = PerformanceApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -33,10 +33,3 @@ class PowerApp(app_module.App):
|
|||||||
self.add(info)
|
self.add(info)
|
||||||
|
|
||||||
# not in menu, see issue #834
|
# not in menu, see issue #834
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the power module."""
|
|
||||||
global app
|
|
||||||
app = PowerApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|||||||
@ -89,16 +89,6 @@ class PrivoxyApp(app_module.App):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = PrivoxyApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.call('pre', actions.superuser_run, 'privoxy', ['pre-install'])
|
helper.call('pre', actions.superuser_run, 'privoxy', ['pre-install'])
|
||||||
|
|||||||
@ -99,16 +99,6 @@ class QuasselApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the quassel module."""
|
|
||||||
global app
|
|
||||||
app = QuasselApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -174,16 +174,6 @@ class RadicaleDaemon(Daemon):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the radicale module."""
|
|
||||||
global app
|
|
||||||
app = RadicaleApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
if old_version == 1:
|
if old_version == 1:
|
||||||
|
|||||||
@ -77,16 +77,6 @@ class RoundcubeApp(app_module.App):
|
|||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = RoundcubeApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.call('pre', actions.superuser_run, 'roundcube', ['pre-install'])
|
helper.call('pre', actions.superuser_run, 'roundcube', ['pre-install'])
|
||||||
|
|||||||
@ -98,16 +98,6 @@ class SambaApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = SambaApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -15,7 +15,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.modules.users.components import UsersAndGroups
|
from plinth.modules.users.components import UsersAndGroups
|
||||||
|
|
||||||
from .manifest import (PUBLIC_ACCESS_SETTING_FILE, # noqa, pylint: disable=unused-import
|
from .manifest import (PUBLIC_ACCESS_SETTING_FILE, # noqa, pylint: disable=unused-import
|
||||||
backup, clients)
|
backup, clients)
|
||||||
|
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
@ -103,16 +103,6 @@ class SearxWebserverAuth(Webserver):
|
|||||||
super().enable()
|
super().enable()
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = SearxApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -51,13 +51,6 @@ class SecurityApp(app_module.App):
|
|||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module"""
|
|
||||||
global app
|
|
||||||
app = SecurityApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install the required packages"""
|
"""Install the required packages"""
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
|
|||||||
@ -60,16 +60,6 @@ class ShaarliApp(app_module.App):
|
|||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = ShaarliApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -77,16 +77,6 @@ class ShadowsocksApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = ShadowsocksApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -45,13 +45,6 @@ class SharingApp(app_module.App):
|
|||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = SharingApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def list_shares():
|
def list_shares():
|
||||||
"""Return a list of shares."""
|
"""Return a list of shares."""
|
||||||
output = actions.superuser_run('sharing', ['list'])
|
output = actions.superuser_run('sharing', ['list'])
|
||||||
|
|||||||
@ -61,16 +61,6 @@ class SnapshotApp(app_module.App):
|
|||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = SnapshotApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def is_supported():
|
def is_supported():
|
||||||
"""Return whether snapshots are support on current setup."""
|
"""Return whether snapshots are support on current setup."""
|
||||||
fs_type = storage.get_filesystem_type()
|
fs_type = storage.get_filesystem_type()
|
||||||
|
|||||||
@ -63,14 +63,6 @@ class SSHApp(app_module.App):
|
|||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the ssh module."""
|
|
||||||
global app
|
|
||||||
app = SSHApp()
|
|
||||||
if app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Configure the module."""
|
"""Configure the module."""
|
||||||
actions.superuser_run('ssh', ['setup'])
|
actions.superuser_run('ssh', ['setup'])
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class SSOApp(app_module.App):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Create components for the app."""
|
"""Create components for the app."""
|
||||||
|
super().__init__()
|
||||||
info = app_module.Info(app_id=self.app_id, version=version,
|
info = app_module.Info(app_id=self.app_id, version=version,
|
||||||
is_essential=is_essential, depends=depends,
|
is_essential=is_essential, depends=depends,
|
||||||
name=_('Single Sign On'))
|
name=_('Single Sign On'))
|
||||||
|
|||||||
@ -67,13 +67,6 @@ class StorageApp(app_module.App):
|
|||||||
glib.schedule(3, udisks2.init, repeat=False)
|
glib.schedule(3, udisks2.init, repeat=False)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = StorageApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def get_disks():
|
def get_disks():
|
||||||
"""Returns list of disks and their free space.
|
"""Returns list of disks and their free space.
|
||||||
|
|
||||||
|
|||||||
@ -90,21 +90,11 @@ class SyncthingApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-syncthing', managed_services[0])
|
daemon = Daemon('daemon-syncthing', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
users_and_groups = UsersAndGroups(
|
users_and_groups = UsersAndGroups('users-and-groups-syncthing',
|
||||||
'users-and-groups-syncthing', [SYSTEM_USER], self.groups)
|
[SYSTEM_USER], self.groups)
|
||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = SyncthingApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -92,6 +92,14 @@ class TahoeApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-tahoe', managed_services[0])
|
daemon = Daemon('daemon-tahoe', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
def is_enabled(self):
|
||||||
|
"""Return whether all the leader components are enabled.
|
||||||
|
|
||||||
|
Return True when there are no leader components and
|
||||||
|
domain name is setup.
|
||||||
|
"""
|
||||||
|
return super().is_enabled() and is_setup()
|
||||||
|
|
||||||
def diagnose(self):
|
def diagnose(self):
|
||||||
"""Run diagnostics and return the results."""
|
"""Run diagnostics and return the results."""
|
||||||
results = super().diagnose()
|
results = super().diagnose()
|
||||||
@ -108,6 +116,7 @@ class TahoeApp(app_module.App):
|
|||||||
|
|
||||||
class Shortcut(frontpage.Shortcut):
|
class Shortcut(frontpage.Shortcut):
|
||||||
"""Frontpage shortcut to use configured domain name for URL."""
|
"""Frontpage shortcut to use configured domain name for URL."""
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
"""Set the proper shortcut URL when enabled."""
|
"""Set the proper shortcut URL when enabled."""
|
||||||
super().enable()
|
super().enable()
|
||||||
@ -130,17 +139,6 @@ def get_configured_domain_name():
|
|||||||
return dnf.read().rstrip()
|
return dnf.read().rstrip()
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = TahoeApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and is_setup() \
|
|
||||||
and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -10,7 +10,8 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from plinth import action_utils, actions
|
from plinth import action_utils, actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import menu
|
from plinth import menu
|
||||||
from plinth.daemon import Daemon, diagnose_netcat, diagnose_port_listening
|
from plinth.daemon import (Daemon, app_is_running, diagnose_netcat,
|
||||||
|
diagnose_port_listening)
|
||||||
from plinth.modules.apache.components import diagnose_url
|
from plinth.modules.apache.components import diagnose_url
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.names.components import DomainType
|
from plinth.modules.names.components import DomainType
|
||||||
@ -85,6 +86,17 @@ class TorApp(app_module.App):
|
|||||||
reserved_usernames=['debian-tor'])
|
reserved_usernames=['debian-tor'])
|
||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
# Register hidden service name with Name Services module.
|
||||||
|
if self.is_enabled() and app_is_running(self):
|
||||||
|
status = utils.get_status(initialized=False)
|
||||||
|
hostname = status['hs_hostname']
|
||||||
|
services = [int(port['virtport']) for port in status['hs_ports']]
|
||||||
|
|
||||||
|
if status['hs_enabled'] and status['hs_hostname']:
|
||||||
|
domain_added.send_robust(sender='tor',
|
||||||
|
domain_type='domain-type-tor',
|
||||||
|
name=hostname, services=services)
|
||||||
|
|
||||||
def diagnose(self):
|
def diagnose(self):
|
||||||
"""Run diagnostics and return the results."""
|
"""Run diagnostics and return the results."""
|
||||||
results = super().diagnose()
|
results = super().diagnose()
|
||||||
@ -133,30 +145,6 @@ class TorApp(app_module.App):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = TorApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
needs_setup = setup_helper.get_state() == 'needs-setup'
|
|
||||||
|
|
||||||
if not needs_setup:
|
|
||||||
if app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
# Register hidden service name with Name Services module.
|
|
||||||
status = utils.get_status()
|
|
||||||
hostname = status['hs_hostname']
|
|
||||||
services = [int(port['virtport']) for port in status['hs_ports']]
|
|
||||||
|
|
||||||
if status['enabled'] and status['is_running'] and \
|
|
||||||
status['hs_enabled'] and status['hs_hostname']:
|
|
||||||
domain_added.send_robust(sender='tor',
|
|
||||||
domain_type='domain-type-tor',
|
|
||||||
name=hostname, services=services)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ APT_SOURCES_URI_PATHS = ('/files/etc/apt/sources.list/*/uri',
|
|||||||
APT_TOR_PREFIX = 'tor+'
|
APT_TOR_PREFIX = 'tor+'
|
||||||
|
|
||||||
|
|
||||||
def get_status():
|
def get_status(initialized=True):
|
||||||
"""Return current Tor status."""
|
"""Return current Tor status."""
|
||||||
output = actions.superuser_run('tor', ['get-status'])
|
output = actions.superuser_run('tor', ['get-status'])
|
||||||
status = json.loads(output)
|
status = json.loads(output)
|
||||||
@ -43,8 +43,8 @@ def get_status():
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'enabled': tor.app.is_enabled(),
|
'enabled': tor.app.is_enabled() if initialized else False,
|
||||||
'is_running': app_is_running(tor.app),
|
'is_running': app_is_running(tor.app) if initialized else False,
|
||||||
'use_upstream_bridges': status['use_upstream_bridges'],
|
'use_upstream_bridges': status['use_upstream_bridges'],
|
||||||
'upstream_bridges': status['upstream_bridges'],
|
'upstream_bridges': status['upstream_bridges'],
|
||||||
'relay_enabled': status['relay_enabled'],
|
'relay_enabled': status['relay_enabled'],
|
||||||
|
|||||||
@ -85,16 +85,6 @@ class TransmissionApp(app_module.App):
|
|||||||
self.add(users_and_groups)
|
self.add(users_and_groups)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the Transmission module."""
|
|
||||||
global app
|
|
||||||
app = TransmissionApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -93,16 +93,6 @@ class TTRSSApp(app_module.App):
|
|||||||
actions.superuser_run('ttrss', ['enable-api-access'])
|
actions.superuser_run('ttrss', ['enable-api-access'])
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = TTRSSApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.call('pre', actions.superuser_run, 'ttrss', ['pre-setup'])
|
helper.call('pre', actions.superuser_run, 'ttrss', ['pre-setup'])
|
||||||
|
|||||||
@ -94,13 +94,6 @@ class UpgradesApp(app_module.App):
|
|||||||
note.dismiss(should_dismiss=dismiss)
|
note.dismiss(should_dismiss=dismiss)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = UpgradesApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -91,13 +91,6 @@ class UsersApp(app_module.App):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the user module."""
|
|
||||||
global app
|
|
||||||
app = UsersApp()
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@ -92,16 +92,6 @@ class WireguardApp(app_module.App):
|
|||||||
return enabled and kvstore.get_default('wireguard-enabled', False)
|
return enabled and kvstore.get_default('wireguard-enabled', False)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize the module."""
|
|
||||||
global app
|
|
||||||
app = WireguardApp()
|
|
||||||
|
|
||||||
setup_helper = globals()['setup_helper']
|
|
||||||
if setup_helper.get_state() != 'needs-setup' and app.is_enabled():
|
|
||||||
app.set_enabled(True)
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user