*: Update imports statements from plinth to freedombox

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2026-08-17 10:12:04 -07:00 committed by James Valleroy
parent 23b6aff290
commit baa44e91a2
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
453 changed files with 1385 additions and 1379 deletions

View File

@ -790,7 +790,7 @@ def move_uploaded_file(source: str | pathlib.Path,
If allow_overwrite is set to False and destination file exists, an
exception is raised.
"""
from plinth import settings
from freedombox import settings
if isinstance(source, str):
source = pathlib.Path(source)

View File

@ -14,7 +14,7 @@ import traceback
import types
import typing
from plinth import cfg, module_loader
from freedombox import cfg, module_loader
logger = logging.getLogger(__name__)

View File

@ -9,9 +9,9 @@ import inspect
import logging
from typing import ClassVar, TypeAlias
from plinth import cfg
from plinth.diagnostic_check import DiagnosticCheck
from plinth.signals import post_app_loading
from freedombox import cfg
from freedombox.diagnostic_check import DiagnosticCheck
from freedombox.signals import post_app_loading
from . import clients as clients_module
from . import db
@ -314,7 +314,7 @@ class App:
This is typically true if the apps has daemons or containers.
"""
from plinth import log
from freedombox import log
for component in self.components.values():
if isinstance(component, log.LogEmitter):
return True
@ -323,7 +323,7 @@ class App:
def get_logs(self) -> _list_type[dict[str, str]]:
"""Return the logs in a dictionary format."""
from plinth import log
from freedombox import log
logs: list[dict[str, str]] = []
for component in self.components.values():
if isinstance(component, log.LogEmitter):
@ -611,17 +611,17 @@ class EnableState(LeaderComponent):
def is_enabled(self):
"""Return whether the app/component is enabled."""
from plinth import kvstore
from freedombox import kvstore
return kvstore.get_default(self.key, False)
def enable(self):
"""Store that the app/component is enabled."""
from plinth import kvstore
from freedombox import kvstore
kvstore.set(self.key, True)
def disable(self):
"""Store that the app/component is disabled."""
from plinth import kvstore
from freedombox import kvstore
kvstore.set(self.key, False)

View File

@ -5,9 +5,9 @@ import pathlib
from django.utils.translation import gettext_noop
from plinth.diagnostic_check import (DiagnosticCheck,
DiagnosticCheckParameters, Result)
from plinth.privileged import config as privileged
from freedombox.diagnostic_check import (DiagnosticCheck,
DiagnosticCheckParameters, Result)
from freedombox.privileged import config as privileged
from . import app as app_module

View File

@ -62,7 +62,7 @@ def pytest_collection_modifyitems(config, items):
@pytest.fixture(name='load_cfg')
def fixture_load_cfg():
"""Load test configuration."""
from plinth import cfg
from freedombox import cfg
keys = ('file_root', 'data_dir', 'custom_static_dir', 'store_file',
'doc_dir', 'server_dir', 'host', 'port', 'use_x_forwarded_for',
@ -187,7 +187,7 @@ def fixture_mock_run_as_user():
"""A fixture to override action_utils.run_as_user."""
def _bypass_runuser(*args, username, **kwargs):
from plinth import action_utils
from freedombox import action_utils
return action_utils.run(*args, **kwargs)
with patch('plinth.action_utils.run_as_user') as mock:
@ -287,7 +287,7 @@ def fixture_host_sudo(host):
@pytest.fixture(name='test_menu')
def fixture_test_menu():
"""Initialized menu module."""
from plinth import menu as menu_module
from freedombox import menu as menu_module
menu_module.Menu._all_menus = set()
menu_module.init()

View File

@ -5,9 +5,9 @@ import contextlib
from django.utils.translation import gettext_noop
from plinth import app, log, privileged
from plinth.daemon import diagnose_port_listening
from plinth.diagnostic_check import (DiagnosticCheck,
from freedombox import app, log, privileged
from freedombox.daemon import diagnose_port_listening
from freedombox.diagnostic_check import (DiagnosticCheck,
DiagnosticCheckParameters, Result)
@ -89,7 +89,7 @@ class Container(app.LeaderComponent, log.LogEmitter):
@contextlib.contextmanager
def ensure_running(self):
"""Ensure a service is running and return to previous state."""
from plinth.privileged import service as service_privileged
from freedombox.privileged import service as service_privileged
starting_state = self.is_running()
if not starting_state:
service_privileged.enable(self.name)

View File

@ -6,8 +6,8 @@ Django context processors to provide common data to templates.
from django.utils.translation import gettext as _
from django.utils.translation import gettext_noop
from plinth import cfg, views, web_server
from plinth.utils import is_user_admin
from freedombox import cfg, views, web_server
from freedombox.utils import is_user_admin
def common(request):
@ -20,7 +20,7 @@ def common(request):
# the brand name 'FreedomBox' itself to be translated.
gettext_noop('FreedomBox')
from plinth.notification import Notification
from freedombox.notification import Notification
notifications_context = Notification.get_display_context(
request, user=request.user)

View File

@ -8,8 +8,8 @@ import subprocess
import psutil
from django.utils.translation import gettext_noop
from plinth import action_utils, app, log
from plinth.diagnostic_check import (DiagnosticCheck,
from freedombox import action_utils, app, log
from freedombox.diagnostic_check import (DiagnosticCheck,
DiagnosticCheckParameters, Result)
@ -71,14 +71,14 @@ class Daemon(app.LeaderComponent, log.LogEmitter):
def enable(self):
"""Run operations to enable the daemon/unit."""
from plinth.privileged import service as service_privileged
from freedombox.privileged import service as service_privileged
service_privileged.enable(self.unit)
if self.alias:
service_privileged.enable(self.alias)
def disable(self):
"""Run operations to disable the daemon/unit."""
from plinth.privileged import service as service_privileged
from freedombox.privileged import service as service_privileged
service_privileged.disable(self.unit)
if self.alias:
service_privileged.disable(self.alias)
@ -90,7 +90,7 @@ class Daemon(app.LeaderComponent, log.LogEmitter):
@contextlib.contextmanager
def ensure_running(self):
"""Ensure a service is running and return to previous state."""
from plinth.privileged import service as service_privileged
from freedombox.privileged import service as service_privileged
if action_utils.service_show(self.unit)['LoadState'] == 'not-found':
# The service's package not installed yet, don't try to start it

View File

@ -7,7 +7,7 @@ Uses utilities from 'postgres' package such as 'psql' and 'pg_dump'.
import os
import pathlib
from plinth import action_utils
from freedombox import action_utils
def _run_as(command, **kwargs):

View File

@ -6,7 +6,7 @@ Expose some API over D-Bus.
import logging
import threading
from plinth.utils import import_from_gi
from freedombox.utils import import_from_gi
from . import setup
@ -95,7 +95,7 @@ class DBusServer():
self.package_handler = PackageHandler()
self.package_handler.register(connection)
from plinth.modules.letsencrypt.dbus import LetsEncrypt
from freedombox.modules.letsencrypt.dbus import LetsEncrypt
lets_encrypt = LetsEncrypt()
lets_encrypt.register(connection)

View File

@ -9,7 +9,7 @@ from typing import TypeAlias
from django.utils.translation import gettext
from plinth.utils import SafeFormatter
from freedombox.utils import SafeFormatter
DiagnosticCheckParameters: TypeAlias = dict[str, str | int | bool | None]

View File

@ -54,7 +54,7 @@ class DomainSelectionForm(forms.Form):
def __init__(self, show_none=False, *args, **kwargs):
super().__init__(*args, **kwargs)
from plinth.modules.names.components import DomainName
from freedombox.modules.names.components import DomainName
domains = list(DomainName.list_names())
choices = list(zip(domains, domains))
@ -70,7 +70,7 @@ class DomainSelectionForm(forms.Form):
def _get_domain_choices():
"""Double domain entries for inclusion in the choice field."""
from plinth.modules.names import get_available_tls_domains
from freedombox.modules.names import get_available_tls_domains
return ((domain, domain) for domain in get_available_tls_domains())

View File

@ -6,8 +6,8 @@ import logging
import pathlib
from typing import ClassVar
from plinth import app, cfg
from plinth.modules.users import privileged as users_privileged
from freedombox import app, cfg
from freedombox.modules.users import privileged as users_privileged
logger = logging.getLogger(__name__)

View File

@ -7,8 +7,8 @@ import logging
import random
import threading
from plinth import dbus, network
from plinth.utils import import_from_gi
from freedombox import dbus, network
from freedombox.utils import import_from_gi
from . import cfg

View File

@ -8,7 +8,7 @@ from . import db
def get(key):
"""Return the value of a key"""
from plinth.models import KVStore
from freedombox.models import KVStore
with db.lock:
# pylint: disable-msg=E1101
@ -26,7 +26,7 @@ def get_default(key, default_value):
def set(key, value): # pylint: disable-msg=W0622
"""Store the value of a key"""
from plinth.models import KVStore
from freedombox.models import KVStore
with db.lock:
store = KVStore(key=key, value=value)
store.save()
@ -34,7 +34,7 @@ def set(key, value): # pylint: disable-msg=W0622
def delete(key, ignore_missing=False):
"""Delete a key"""
from plinth.models import KVStore
from freedombox.models import KVStore
with db.lock:
try:
return KVStore.objects.get(key=key).delete()

View File

@ -28,7 +28,7 @@ class LogEmitter:
unit: str
def get_logs(self: LogEmitterProtocol) -> dict[str, str]:
from plinth.privileged import service as service_privileged
from freedombox.privileged import service as service_privileged
return service_privileged.get_logs(self.unit)

View File

@ -5,7 +5,7 @@ from typing import ClassVar
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from plinth import app
from freedombox import app
class Menu(app.FollowerComponent):

View File

@ -19,9 +19,9 @@ from django.utils.deprecation import MiddlewareMixin
from django.utils.translation import gettext as _
from stronghold.utils import is_view_func_public
from plinth import app as app_module
from plinth import setup
from plinth.utils import is_user_admin
from freedombox import app as app_module
from freedombox import setup
from freedombox.utils import is_user_admin
from . import operation as operation_module
from . import views

View File

@ -8,7 +8,7 @@ from __future__ import unicode_literals
from django.db import migrations
from plinth.models import KVStore
from freedombox.models import KVStore
def merge_firstboot_finished_fields(apps, schema_editor):

View File

@ -7,7 +7,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.db import migrations, models
from plinth.models import UserProfile
from freedombox.models import UserProfile
def insert_users(apps, schema_editor):

View File

@ -9,7 +9,7 @@ Django migration for adding the notification model.
from django.db import migrations, models
from plinth.models import JSONField
from freedombox.models import JSONField
class Migration(migrations.Migration):

View File

@ -11,8 +11,8 @@ import types
import django
from plinth import cfg
from plinth.signals import pre_module_loading
from freedombox import cfg
from freedombox.signals import pre_module_loading
logger = logging.getLogger(__name__)
@ -50,7 +50,7 @@ def load_modules():
def _include_module_urls(module_import_path, module_name):
"""Include the module's URLs in global project URLs list"""
from plinth import urls
from freedombox import urls
url_module = module_import_path + '.urls'
try:
urls.urlpatterns += [

View File

@ -65,18 +65,18 @@ import os
from django.utils.translation import gettext_lazy as _
from plinth import action_utils
from plinth import app as app_module
from plinth import cfg
from plinth.config import DropinConfigs
from plinth.daemon import Daemon
from plinth.modules import names
from plinth.modules.firewall.components import Firewall
from plinth.modules.letsencrypt.components import LetsEncrypt
from plinth.modules.oidc.components import OpenIDConnect
from plinth.package import Packages
from plinth.signals import domain_added, domain_removed
from plinth.utils import format_lazy, is_valid_user_name
from freedombox import action_utils
from freedombox import app as app_module
from freedombox import cfg
from freedombox.config import DropinConfigs
from freedombox.daemon import Daemon
from freedombox.modules import names
from freedombox.modules.firewall.components import Firewall
from freedombox.modules.letsencrypt.components import LetsEncrypt
from freedombox.modules.oidc.components import OpenIDConnect
from freedombox.package import Packages
from freedombox.signals import domain_added, domain_removed
from freedombox.utils import format_lazy, is_valid_user_name
from . import privileged

View File

@ -6,10 +6,10 @@ import subprocess
from django.utils.translation import gettext_noop
from plinth import action_utils, app, kvstore
from plinth.diagnostic_check import (DiagnosticCheck,
from freedombox import action_utils, app, kvstore
from freedombox.diagnostic_check import (DiagnosticCheck,
DiagnosticCheckParameters, Result)
from plinth.privileged import service as service_privileged
from freedombox.privileged import service as service_privileged
from . import privileged

View File

@ -11,8 +11,8 @@ import urllib.parse
import augeas
from plinth import action_utils, utils
from plinth.actions import privileged, secret_str
from freedombox import action_utils, utils
from freedombox.actions import privileged, secret_str
openidc_config_path = pathlib.Path(
'/etc/apache2/conf-available/freedombox-openidc.conf')

View File

@ -8,9 +8,9 @@ from unittest.mock import Mock, PropertyMock, call, patch
import pytest
from plinth import app, kvstore
from plinth.diagnostic_check import DiagnosticCheck, Result
from plinth.modules.apache.components import (Webserver, WebserverRoot,
from freedombox import app, kvstore
from freedombox.diagnostic_check import DiagnosticCheck, Result
from freedombox.modules.apache.components import (Webserver, WebserverRoot,
check_url, diagnose_url,
diagnose_url_on_all)

View File

@ -3,9 +3,10 @@
Test module for (U)ser (Web) (S)ites.
"""
from plinth.modules.apache import (user_of_uws_directory, user_of_uws_url,
uws_directory_of_url, uws_directory_of_user,
uws_url_of_directory, uws_url_of_user)
from freedombox.modules.apache import (user_of_uws_directory, user_of_uws_url,
uws_directory_of_url,
uws_directory_of_user,
uws_url_of_directory, uws_url_of_user)
def test_uws_namings():

View File

@ -3,7 +3,7 @@
FreedomBox app for api for android app.
"""
from plinth import app as app_module
from freedombox import app as app_module
class ApiApp(app_module.App):

View File

@ -6,7 +6,7 @@ URLs for the plinth api for android app.
from django.urls import re_path
from stronghold.decorators import public
from plinth.modules.api import views
from freedombox.modules.api import views
urlpatterns = [
re_path(r'^api/(?P<version>[0-9]+)/shortcuts/?$', public(views.shortcuts)),

View File

@ -10,7 +10,7 @@ from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
from django.templatetags.static import static
from plinth import frontpage
from freedombox import frontpage
def shortcuts(request, **kwargs):

View File

@ -3,17 +3,18 @@
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import cfg, menu
from plinth.daemon import Daemon
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
from plinth.modules.names import get_hostname
from plinth.modules.names.components import DomainType
from plinth.package import Packages
from plinth.privileged import service as service_privileged
from plinth.signals import domain_added, domain_removed, post_hostname_change
from plinth.utils import format_lazy
from freedombox import app as app_module
from freedombox import cfg, menu
from freedombox.daemon import Daemon
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.firewall.components import Firewall
from freedombox.modules.names import get_hostname
from freedombox.modules.names.components import DomainType
from freedombox.package import Packages
from freedombox.privileged import service as service_privileged
from freedombox.signals import (domain_added, domain_removed,
post_hostname_change)
from freedombox.utils import format_lazy
from . import manifest

View File

@ -5,7 +5,7 @@ Functional, browser based tests for avahi app.
import pytest
from plinth.tests.functional import BaseAppTests
from freedombox.tests.functional import BaseAppTests
pytestmark = [
pytest.mark.system, pytest.mark.essential, pytest.mark.domain,

View File

@ -5,7 +5,7 @@ URLs for the service discovery module.
from django.urls import re_path
from plinth.views import AppView
from freedombox.views import AppView
urlpatterns = [
re_path(r'^sys/avahi/$', AppView.as_view(app_id='avahi'), name='index'),

View File

@ -14,10 +14,10 @@ from django.utils.text import get_valid_filename
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext_noop
from plinth import app as app_module
from plinth import cfg, glib, menu
from plinth.modules.names.components import DomainName
from plinth.package import Packages
from freedombox import app as app_module
from freedombox import cfg, glib, menu
from freedombox.modules.names.components import DomainName
from freedombox.package import Packages
from . import api, errors, manifest, privileged
@ -239,7 +239,7 @@ def split_path(path):
def _show_schedule_setup_notification():
"""Show a notification hinting to setup a remote backup schedule."""
from plinth.notification import Notification
from freedombox.notification import Notification
message = gettext_noop(
'Enable an automatic backup schedule for data safety. Prefer an '
'encrypted remote backup location or an extra attached disk.')
@ -267,7 +267,7 @@ def on_schedule_save(repository):
if not repository.schedule.enabled:
return
from plinth.notification import Notification
from freedombox.notification import Notification
try:
note = Notification.get('backups-remote-schedule')
note.dismiss()
@ -277,7 +277,7 @@ def on_schedule_save(repository):
def _show_schedule_error_notification(repository, is_error, exception=None):
"""Show or hide a notification related scheduled backup operation."""
from plinth.notification import Notification
from freedombox.notification import Notification
id_ = 'backups-schedule-error-' + repository.uuid
try:
note = Notification.get(id_)

View File

@ -12,11 +12,11 @@ TODO:
import logging
from plinth import action_utils
from plinth import app as app_module
from plinth import setup
from plinth.modules.apache import privileged as apache_privileged
from plinth.privileged import service as service_privileged
from freedombox import action_utils
from freedombox import app as app_module
from freedombox import setup
from freedombox.modules.apache import privileged as apache_privileged
from freedombox.privileged import service as service_privileged
from .components import BackupRestore

View File

@ -3,7 +3,7 @@
import copy
from plinth import app
from freedombox import app
from . import privileged
@ -157,7 +157,7 @@ class BackupRestore(app.FollowerComponent):
if not self.settings:
return
from plinth import kvstore
from freedombox import kvstore
data = {}
for key in self.settings:
try:
@ -181,6 +181,6 @@ class BackupRestore(app.FollowerComponent):
data = privileged.load_settings(self.app_id)
from plinth import kvstore
from freedombox import kvstore
for key, value in data.items():
kvstore.set(key, value)

View File

@ -2,7 +2,7 @@
import subprocess
from plinth.errors import PlinthError
from freedombox.errors import PlinthError
class BorgError(PlinthError):

View File

@ -15,9 +15,9 @@ from django.core.validators import (FileExtensionValidator,
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from plinth import cfg
from plinth.modules.storage import get_mounts
from plinth.utils import format_lazy
from freedombox import cfg
from freedombox.modules.storage import get_mounts
from freedombox.utils import format_lazy
from . import api, split_path
from .repository import get_repositories

View File

@ -12,11 +12,11 @@ import tarfile
from django.utils.translation import gettext_lazy as _
from plinth import action_utils, actions
from plinth import app as app_module
from plinth import module_loader
from plinth.actions import privileged, secret_str
from plinth.utils import Version
from freedombox import action_utils, actions
from freedombox import app as app_module
from freedombox import module_loader
from freedombox.actions import privileged, secret_str
from freedombox.utils import Version
from . import errors
@ -492,7 +492,7 @@ def delete_before_restore(app_id: str):
app_module.apps_init()
app = app_module.App.get(app_id)
from plinth.modules.backups.components import BackupRestore
from freedombox.modules.backups.components import BackupRestore
components = app.get_components_of_type(BackupRestore)
for component in components:
for path in component.delete_before_restore:

View File

@ -10,8 +10,8 @@ from uuid import uuid1
from django.utils.translation import gettext_lazy as _
from plinth import cfg
from plinth.utils import format_lazy
from freedombox import cfg
from freedombox.utils import format_lazy
from . import (_backup_handler, api, copy_ssh_client_public_key, errors,
generate_ssh_client_auth_key, get_known_hosts_path,

View File

@ -6,7 +6,7 @@ Manage storage of repository information in KVStore table in database.
import json
from uuid import uuid1
from plinth import kvstore
from freedombox import kvstore
# kvstore key for repository store
STORAGE_KEY = 'network_storage'

View File

@ -8,7 +8,7 @@ from unittest.mock import MagicMock, call, patch
import pytest
from django.core.files.uploadedfile import SimpleUploadedFile
from plinth.app import App
from freedombox.app import App
from .. import api, forms, repository
from ..components import BackupRestore

View File

@ -10,10 +10,10 @@ import uuid
import pytest
from plinth.modules import backups
from plinth.modules.backups import privileged
from plinth.modules.backups.repository import BorgRepository, SshBorgRepository
from plinth.tests import config as test_config
from freedombox.modules import backups
from freedombox.modules.backups import privileged
from freedombox.modules.backups.repository import BorgRepository, SshBorgRepository
from freedombox.tests import config as test_config
pytestmark = pytest.mark.usefixtures('needs_root', 'needs_borg', 'load_cfg',
'mock_privileged')

View File

@ -7,7 +7,7 @@ from unittest.mock import call, patch
import pytest
from plinth import kvstore
from freedombox import kvstore
from .. import components
from ..components import BackupRestore

View File

@ -11,7 +11,7 @@ import urllib.parse
import pytest
import requests
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [pytest.mark.system, pytest.mark.backups]

View File

@ -10,7 +10,7 @@ from unittest.mock import MagicMock, call, patch
import pytest
import plinth.modules.backups.repository as repository_module
from plinth.app import App
from freedombox.app import App
from ..components import BackupRestore
from ..schedule import Schedule

View File

@ -11,7 +11,7 @@ import subprocess
import pytest
from django.forms import ValidationError
from plinth.utils import generate_password, random_string
from freedombox.utils import generate_password, random_string
from .. import forms

View File

@ -5,7 +5,7 @@ Test network storage.
import pytest
from plinth.modules.backups import store
from freedombox.modules.backups import store
pytestmark = pytest.mark.django_db

View File

@ -19,9 +19,9 @@ from django.utils.translation import gettext_lazy
from django.views.decorators.http import require_POST
from django.views.generic import FormView, TemplateView, View
from plinth.errors import PlinthError
from plinth.modules import backups, storage
from plinth.views import AppView
from freedombox.errors import PlinthError
from freedombox.modules import backups, storage
from freedombox.views import AppView
from . import (SESSION_PATH_VARIABLE, api, errors, forms,
generate_ssh_client_auth_key, get_known_hosts_path,

View File

@ -3,15 +3,15 @@
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import frontpage, menu
from plinth.config import DropinConfigs
from plinth.daemon import Daemon, RelatedDaemon
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
from plinth.package import Packages
from plinth.privileged import service as service_privileged
from freedombox import app as app_module
from freedombox import frontpage, menu
from freedombox.config import DropinConfigs
from freedombox.daemon import Daemon, RelatedDaemon
from freedombox.modules.apache.components import Webserver
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.firewall.components import Firewall
from freedombox.package import Packages
from freedombox.privileged import service as service_privileged
from . import manifest, privileged

View File

@ -6,7 +6,7 @@ Django forms for bepasty app.
from django import forms
from django.utils.translation import gettext_lazy as _
from plinth.modules import bepasty
from freedombox.modules import bepasty
class SetDefaultPermissionsForm(forms.Form):

View File

@ -10,9 +10,9 @@ import string
import augeas
from plinth import action_utils
from plinth.actions import privileged, secret_str
from plinth.modules import bepasty
from freedombox import action_utils
from freedombox.actions import privileged, secret_str
from freedombox.modules import bepasty
CONF_FILE = pathlib.Path('/etc/bepasty-freedombox.conf')
DATA_DIR = '/var/lib/private/bepasty'

View File

@ -5,7 +5,7 @@ Functional, browser based tests for bepasty app.
import pytest
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [pytest.mark.apps, pytest.mark.bepasty]

View File

@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
from django.views.decorators.http import require_POST
from django.views.generic import FormView
from plinth.views import AppView
from freedombox.views import AppView
from . import privileged
from .forms import AddPasswordForm, SetDefaultPermissionsForm

View File

@ -3,13 +3,13 @@
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import cfg, menu
from plinth.daemon import Daemon
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
from plinth.package import Packages, install
from plinth.utils import format_lazy
from freedombox import app as app_module
from freedombox import cfg, menu
from freedombox.daemon import Daemon
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.firewall.components import Firewall
from freedombox.package import Packages, install
from freedombox.utils import format_lazy
from . import manifest, privileged

View File

@ -8,8 +8,8 @@ from pathlib import Path
import augeas
from plinth import action_utils
from plinth.actions import privileged
from freedombox import action_utils
from freedombox.actions import privileged
CONFIG_FILE = '/etc/bind/named.conf.options'
ZONES_DIR = '/var/bind/pri'

View File

@ -6,7 +6,7 @@ from pathlib import Path
import pytest
from plinth.modules import bind
from freedombox.modules import bind
@pytest.fixture(name='configuration_file')

View File

@ -5,7 +5,7 @@ Functional, browser based tests for bind app.
import pytest
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [pytest.mark.system, pytest.mark.bind]

View File

@ -5,7 +5,7 @@ URLs for the BIND module.
from django.urls import re_path
from plinth.modules.bind.views import BindAppView
from freedombox.modules.bind.views import BindAppView
urlpatterns = [
re_path(r'^sys/bind/$', BindAppView.as_view(), name='index'),

View File

@ -4,8 +4,8 @@
from django.contrib import messages
from django.utils.translation import gettext_lazy as _
from plinth.modules import names
from plinth.views import AppView
from freedombox.modules import names
from freedombox.views import AppView
from . import privileged
from .forms import BindForm

View File

@ -5,17 +5,17 @@ import re
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import cfg, frontpage, menu
from plinth.config import DropinConfigs
from plinth.daemon import Daemon
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import (Firewall,
FirewallLocalProtection)
from plinth.modules.users.components import UsersAndGroups
from plinth.package import Packages
from plinth.utils import format_lazy
from freedombox import app as app_module
from freedombox import cfg, frontpage, menu
from freedombox.config import DropinConfigs
from freedombox.daemon import Daemon
from freedombox.modules.apache.components import Webserver
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.firewall.components import (Firewall,
FirewallLocalProtection)
from freedombox.modules.users.components import UsersAndGroups
from freedombox.package import Packages
from freedombox.utils import format_lazy
from . import manifest, privileged

View File

@ -4,9 +4,9 @@
import pathlib
import shutil
from plinth import action_utils
from plinth.actions import privileged
from plinth.modules import calibre
from freedombox import action_utils
from freedombox.actions import privileged
from freedombox.modules import calibre
LIBRARIES_PATH = pathlib.Path('/var/lib/calibre-server-freedombox/libraries')

View File

@ -8,7 +8,7 @@ import time
import pytest
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [pytest.mark.apps, pytest.mark.calibre]

View File

@ -6,7 +6,7 @@ from unittest.mock import call, patch
import pytest
from plinth.modules.calibre import privileged
from freedombox.modules.calibre import privileged
pytestmark = pytest.mark.usefixtures('mock_privileged')
privileged_modules_to_mock = ['plinth.modules.calibre.privileged']

View File

@ -10,8 +10,8 @@ from django import urls
from django.contrib.messages.storage.fallback import FallbackStorage
from django.http.response import Http404
from plinth import module_loader
from plinth.modules.calibre import views
from freedombox import module_loader
from freedombox.modules.calibre import views
# For all tests, use plinth.urls instead of urls configured for testing
pytestmark = pytest.mark.urls('plinth.urls')

View File

@ -10,8 +10,8 @@ from django.urls import reverse_lazy
from django.utils.translation import gettext as _
from django.views.generic.edit import FormView
from plinth import app as app_module
from plinth import views
from freedombox import app as app_module
from freedombox import views
from . import forms, privileged

View File

@ -6,15 +6,15 @@ FreedomBox app to configure Cockpit.
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import cfg, frontpage, menu
from plinth.config import DropinConfigs
from plinth.daemon import Daemon
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
from plinth.package import Packages
from plinth.utils import format_lazy
from freedombox import app as app_module
from freedombox import cfg, frontpage, menu
from freedombox.config import DropinConfigs
from freedombox.daemon import Daemon
from freedombox.modules.apache.components import Webserver
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.firewall.components import Firewall
from freedombox.package import Packages
from freedombox.utils import format_lazy
from . import manifest, privileged

View File

@ -5,8 +5,8 @@ Configure Cockpit.
import augeas
from plinth import action_utils
from plinth.actions import privileged
from freedombox import action_utils
from freedombox.actions import privileged
CONFIG_FILE = '/etc/cockpit/cockpit.conf'

View File

@ -5,7 +5,7 @@ Functional, browser based tests for cockpit app.
import pytest
from plinth.tests.functional import BaseAppTests
from freedombox.tests.functional import BaseAppTests
pytestmark = [pytest.mark.system, pytest.mark.essential, pytest.mark.cockpit]

View File

@ -5,7 +5,7 @@ URLs for Cockpit module.
from django.urls import re_path
from plinth.views import AppView
from freedombox.views import AppView
urlpatterns = [
re_path(r'^sys/cockpit/$', AppView.as_view(app_id='cockpit'),

View File

@ -6,13 +6,13 @@ import pathlib
import augeas
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import frontpage, menu
from plinth.daemon import RelatedDaemon
from plinth.modules.apache import (get_users_with_website, user_of_uws_url,
uws_url_of_user)
from plinth.package import Packages
from plinth.privileged import service as service_privileged
from freedombox import app as app_module
from freedombox import frontpage, menu
from freedombox.daemon import RelatedDaemon
from freedombox.modules.apache import (get_users_with_website, user_of_uws_url,
uws_url_of_user)
from freedombox.package import Packages
from freedombox.privileged import service as service_privileged
from . import manifest, privileged
@ -170,11 +170,11 @@ def change_home_page(shortcut_id: str):
def get_advanced_mode():
"""Get whether option is enabled."""
from plinth import kvstore
from freedombox import kvstore
return kvstore.get_default(ADVANCED_MODE_KEY, False)
def set_advanced_mode(advanced_mode):
"""Turn on/off advanced mode."""
from plinth import kvstore
from freedombox import kvstore
kvstore.set(ADVANCED_MODE_KEY, advanced_mode)

View File

@ -7,9 +7,9 @@ from django import forms
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from plinth import cfg, frontpage
from plinth.modules.apache import get_users_with_website
from plinth.utils import format_lazy
from freedombox import cfg, frontpage
from freedombox.modules.apache import get_users_with_website
from freedombox.utils import format_lazy
from . import home_page_url2scid

View File

@ -6,8 +6,8 @@ import pathlib
import augeas
from plinth import action_utils
from plinth.actions import privileged
from freedombox import action_utils
from freedombox.actions import privileged
APACHE_CONF_ENABLED_DIR = '/etc/apache2/conf-enabled'
APACHE_HOMEPAGE_CONF_FILE_NAME = 'freedombox-apache-homepage.conf'

View File

@ -9,10 +9,10 @@ from unittest.mock import Mock, patch
import pytest
from plinth import __main__ as plinth_main
from plinth import utils
from plinth.modules.apache import uws_directory_of_user, uws_url_of_user
from plinth.modules.config import (_home_page_scid2url, change_home_page,
from freedombox import __main__ as plinth_main
from freedombox import utils
from freedombox.modules.apache import uws_directory_of_user, uws_url_of_user
from freedombox.modules.config import (_home_page_scid2url, change_home_page,
get_home_page, home_page_url2scid)

View File

@ -5,7 +5,7 @@ Functional, browser based tests for config app.
import pytest
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [pytest.mark.system, pytest.mark.essential, pytest.mark.config]

View File

@ -4,8 +4,8 @@
from django.contrib import messages
from django.utils.translation import gettext as _
from plinth import views
from plinth.modules import config
from freedombox import views
from freedombox.modules import config
from . import privileged
from .forms import ConfigurationForm

View File

@ -8,17 +8,18 @@ from typing import Iterator
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import menu
from plinth.daemon import Daemon
from plinth.modules import names
from plinth.modules.backups.components import BackupRestore
from plinth.modules.coturn.components import TurnConfiguration, TurnConsumer
from plinth.modules.firewall.components import Firewall
from plinth.modules.letsencrypt.components import LetsEncrypt
from plinth.modules.users.components import UsersAndGroups
from plinth.package import Packages
from plinth.utils import format_lazy
from freedombox import app as app_module
from freedombox import menu
from freedombox.daemon import Daemon
from freedombox.modules import names
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.coturn.components import (TurnConfiguration,
TurnConsumer)
from freedombox.modules.firewall.components import Firewall
from freedombox.modules.letsencrypt.components import LetsEncrypt
from freedombox.modules.users.components import UsersAndGroups
from freedombox.package import Packages
from freedombox.utils import format_lazy
from . import manifest, privileged

View File

@ -11,7 +11,7 @@ from dataclasses import dataclass, field
from time import time
from typing import ClassVar, Iterable
from plinth import app
from freedombox import app
TURN_REST_TTL = 24 * 3600
@ -129,7 +129,7 @@ class TurnConsumer(app.FollowerComponent):
def get_configuration(self) -> TurnConfiguration:
"""Return current coturn configuration."""
from plinth.modules import coturn
from freedombox.modules import coturn
return coturn.get_config()
@ -145,7 +145,7 @@ class TurnTimeLimitedConsumer(TurnConsumer):
def get_configuration(self) -> UserTurnConfiguration:
"""Return user coturn configuration."""
from plinth.modules import coturn
from freedombox.modules import coturn
static_config = coturn.get_config()
timestamp = int(time()) + TURN_REST_TTL
username = str(timestamp) + ':' + TURN_REST_USER

View File

@ -7,8 +7,8 @@ from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
from plinth.modules import coturn
from plinth.modules.coturn.components import TurnConfiguration
from freedombox.modules import coturn
from freedombox.modules.coturn.components import TurnConfiguration
def get_domain_choices():

View File

@ -8,8 +8,8 @@ import string
import augeas
from plinth import action_utils
from plinth.actions import privileged
from freedombox import action_utils
from freedombox.actions import privileged
CONFIG_FILE = pathlib.Path('/etc/coturn/freedombox.conf')

View File

@ -8,7 +8,7 @@ from unittest.mock import call, patch
import pytest
from plinth.utils import random_string
from freedombox.utils import random_string
from .. import notify_configuration_change
from ..components import (TurnConfiguration, TurnConsumer,

View File

@ -4,7 +4,7 @@ Functional, browser based tests for coturn app.
"""
import pytest
from plinth.tests.functional import BaseAppTests
from freedombox.tests.functional import BaseAppTests
pytestmark = [pytest.mark.apps, pytest.mark.coturn]

View File

@ -5,8 +5,8 @@ from django.contrib import messages
from django.utils.translation import gettext_lazy as _
import plinth.modules.coturn as coturn
from plinth import app as app_module
from plinth import views
from freedombox import app as app_module
from freedombox import views
from . import forms

View File

@ -8,12 +8,12 @@ import subprocess
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext_noop
from plinth import app as app_module
from plinth import menu
from plinth.daemon import Daemon, RelatedDaemon
from plinth.diagnostic_check import DiagnosticCheck, Result
from plinth.modules.backups.components import BackupRestore
from plinth.package import Packages
from freedombox import app as app_module
from freedombox import menu
from freedombox.daemon import Daemon, RelatedDaemon
from freedombox.diagnostic_check import DiagnosticCheck, Result
from freedombox.modules.backups.components import BackupRestore
from freedombox.package import Packages
from . import manifest

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Set time zone with timedatectl."""
from plinth import action_utils
from plinth.actions import privileged
from freedombox import action_utils
from freedombox.actions import privileged
@privileged

View File

@ -4,7 +4,7 @@ Functional, browser based tests for datetime app.
"""
import pytest
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [pytest.mark.system, pytest.mark.essential, pytest.mark.datetime]

View File

@ -7,7 +7,7 @@ import subprocess
from django.contrib import messages
from django.utils.translation import gettext as _
from plinth.views import AppView
from freedombox.views import AppView
from . import privileged
from .forms import DateTimeForm

View File

@ -3,18 +3,18 @@
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import frontpage, menu
from plinth.config import DropinConfigs
from plinth.daemon import Daemon
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import (Firewall,
FirewallLocalProtection)
from plinth.modules.upgrades.utils import get_current_release
from plinth.modules.users import add_user_to_share_group
from plinth.modules.users.components import UsersAndGroups
from plinth.package import Packages
from freedombox import app as app_module
from freedombox import frontpage, menu
from freedombox.config import DropinConfigs
from freedombox.daemon import Daemon
from freedombox.modules.apache.components import Webserver
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.firewall.components import (Firewall,
FirewallLocalProtection)
from freedombox.modules.upgrades.utils import get_current_release
from freedombox.modules.users import add_user_to_share_group
from freedombox.modules.users.components import UsersAndGroups
from freedombox.package import Packages
from . import manifest, privileged

View File

@ -5,8 +5,8 @@ Forms for Deluge app.
from django.utils.translation import gettext_lazy as _
from plinth.modules.storage.forms import (DirectorySelectForm,
DirectoryValidator)
from freedombox.modules.storage.forms import (DirectorySelectForm,
DirectoryValidator)
from . import SYSTEM_USER

View File

@ -5,9 +5,9 @@ import pathlib
import shutil
import time
from plinth import action_utils
from plinth.actions import privileged
from plinth.modules.deluge.utils import Config
from freedombox import action_utils
from freedombox.actions import privileged
from freedombox.modules.deluge.utils import Config
DELUGE_CONF_DIR = pathlib.Path('/var/lib/deluged/config/')

View File

@ -7,7 +7,7 @@ import os
import time
import pytest
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [pytest.mark.apps, pytest.mark.deluge]

View File

@ -5,7 +5,7 @@ Tests for utilities that edit Deluge configuration files.
import pytest
from plinth.modules.deluge.utils import Config
from freedombox.modules.deluge.utils import Config
test_content = '''{
"file": 3,

View File

@ -4,7 +4,7 @@
from django.contrib import messages
from django.utils.translation import gettext as _
from plinth import views
from freedombox import views
from . import privileged
from .forms import DelugeForm

View File

@ -16,16 +16,16 @@ from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext_noop
from plinth import app as app_module
from plinth import cfg, glib, kvstore, menu
from plinth import operation as operation_module
from plinth.daemon import RelatedDaemon, diagnose_port_listening
from plinth.diagnostic_check import (CheckJSONDecoder, CheckJSONEncoder,
DiagnosticCheck, Result)
from plinth.modules.apache.components import diagnose_url_on_all
from plinth.modules.backups.components import BackupRestore
from plinth.setup import run_repair_on_app
from plinth.utils import format_lazy
from freedombox import app as app_module
from freedombox import cfg, glib, kvstore, menu
from freedombox import operation as operation_module
from freedombox.daemon import RelatedDaemon, diagnose_port_listening
from freedombox.diagnostic_check import (CheckJSONDecoder, CheckJSONEncoder,
DiagnosticCheck, Result)
from freedombox.modules.apache.components import diagnose_url_on_all
from freedombox.modules.backups.components import BackupRestore
from freedombox.setup import run_repair_on_app
from freedombox.utils import format_lazy
from . import manifest
@ -213,7 +213,7 @@ def _get_memory_info():
def _warn_about_low_ram_space(request):
"""Warn about insufficient RAM space."""
from plinth.notification import Notification
from freedombox.notification import Notification
memory_info = _get_memory_info()
if memory_info['free_bytes'] < 1024**3:
@ -291,7 +291,7 @@ def start_diagnostics():
def _run_diagnostics():
"""Run diagnostics and notify for failures."""
from plinth.notification import Notification
from freedombox.notification import Notification
_run_on_all_enabled_modules()
apps_with_issues = set()

View File

@ -4,8 +4,8 @@
from collections import OrderedDict
from unittest.mock import patch
from plinth.app import App, Info
from plinth.modules.diagnostics import get_results
from freedombox.app import App, Info
from freedombox.modules.diagnostics import get_results
class AppTest(App):

View File

@ -14,12 +14,12 @@ from django.utils.translation import gettext_lazy as _
from django.views.decorators.http import require_POST
from django.views.generic import TemplateView
from plinth import operation
from plinth.app import App
from plinth.diagnostic_check import Result
from plinth.modules import diagnostics
from plinth.setup import run_repair_on_app
from plinth.views import AppView
from freedombox import operation
from freedombox.app import App
from freedombox.diagnostic_check import Result
from freedombox.modules import diagnostics
from freedombox.setup import run_repair_on_app
from freedombox.views import AppView
from .forms import ConfigureForm

View File

@ -11,14 +11,14 @@ from typing import Any, Literal, Tuple
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import cfg, glib, kvstore, menu
from plinth.modules.backups.components import BackupRestore
from plinth.modules.names.components import DomainType
from plinth.modules.privacy import lookup_public_address
from plinth.modules.users.components import UsersAndGroups
from plinth.signals import domain_added, domain_removed
from plinth.utils import format_lazy
from freedombox import app as app_module
from freedombox import cfg, glib, kvstore, menu
from freedombox.modules.backups.components import BackupRestore
from freedombox.modules.names.components import DomainType
from freedombox.modules.privacy import lookup_public_address
from freedombox.modules.users.components import UsersAndGroups
from freedombox.signals import domain_added, domain_removed
from freedombox.utils import format_lazy
from . import generic, gnudip, manifest

View File

@ -9,9 +9,9 @@ from django.core.exceptions import ValidationError
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from plinth import cfg
from plinth.modules.dynamicdns import get_config
from plinth.utils import format_lazy
from freedombox import cfg
from freedombox.modules.dynamicdns import get_config
from freedombox.utils import format_lazy
class DomainForm(forms.Form):

View File

@ -5,7 +5,7 @@ Functional, browser based tests for dynamicdns app.
import pytest
from plinth.tests import functional
from freedombox.tests import functional
pytestmark = [
pytest.mark.system, pytest.mark.essential, pytest.mark.domain,

View File

@ -7,7 +7,7 @@ from unittest.mock import Mock, patch
import pytest
from plinth.modules.dynamicdns import gnudip
from freedombox.modules.dynamicdns import gnudip
response_to_salt_request = """
<html>

Some files were not shown because too many files have changed in this diff Show More