diff --git a/plinth/modules/api/test/test_get_apps.py b/plinth/modules/api/test/test_get_apps.py deleted file mode 100644 index 2d4a33a84..000000000 --- a/plinth/modules/api/test/test_get_apps.py +++ /dev/null @@ -1,43 +0,0 @@ -# -# This file is part of Plinth. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -""" -Test get apps for api module. -""" - -import unittest - -from plinth.modules.api.views import get_app_payload - - -class TestApi(unittest.TestCase): - apps = [{ - 'name': 'someName', - 'short_description': 'someDescription', - 'icon': 'someIconURl', - 'label': 'someLabel' - }] - - expected = [{ - 'name': 'someName', - 'short_description': 'someDescription', - 'icon': 'static/theme/icons/someIconURl.svg' - }] - - def test_get_app_payload(self): - apps = get_app_payload(self.apps) - self.assertEquals(apps, self.expected) \ No newline at end of file diff --git a/plinth/modules/diaspora/__init__.py b/plinth/modules/diaspora/__init__.py index 7cbdeee30..60453caf1 100644 --- a/plinth/modules/diaspora/__init__.py +++ b/plinth/modules/diaspora/__init__.py @@ -15,16 +15,15 @@ # import os -import augeas from django.utils.translation import ugettext_lazy as _ -from plinth.utils import format_lazy -from plinth import actions, action_utils, frontpage, \ - service as service_module +import augeas +from plinth import service as service_module +from plinth import action_utils, actions, frontpage from plinth.errors import DomainNotRegisteredError from plinth.menu import main_menu -from .manifest import clients +from plinth.utils import format_lazy domain_name_file = "/etc/diaspora/domain_name" lazy_domain_name = None # To avoid repeatedly reading from file @@ -70,25 +69,23 @@ description = [ ' federate with other diaspora* pods.') ] +from .manifest import clients # isort:skip clients = clients def init(): """Initialize the Diaspora module.""" menu = main_menu.get('apps') - menu.add_urlname(name, 'glyphicon-thumbs-up', 'diaspora:index', short_description) + menu.add_urlname(name, 'glyphicon-thumbs-up', 'diaspora:index', + short_description) global service setup_helper = globals()['setup_helper'] if setup_helper.get_state() != 'needs-setup': - service = service_module.Service( - managed_services[0], - name, - ports=['http', 'https'], - is_external=True, - is_enabled=is_enabled, - enable=enable, - disable=disable) + service = service_module.Service(managed_services[0], name, ports=[ + 'http', 'https' + ], is_external=True, is_enabled=is_enabled, enable=enable, + disable=disable) if is_enabled(): add_shortcut() @@ -103,18 +100,13 @@ def setup(helper, old_version=None): def setup_domain_name(domain_name): - actions.superuser_run('diaspora', - ['setup', '--domain-name', domain_name]) + actions.superuser_run('diaspora', ['setup', '--domain-name', domain_name]) global service if service is None: - service = service_module.Service( - managed_services[0], - name, - ports=['http', 'https'], - is_external=True, - is_enabled=is_enabled, - enable=enable, - disable=disable) + service = service_module.Service(managed_services[0], name, ports=[ + 'http', 'https' + ], is_external=True, is_enabled=is_enabled, enable=enable, + disable=disable) service.notify_enabled(None, True) add_shortcut() @@ -123,9 +115,7 @@ def add_shortcut(): """Add shortcut to diaspora on the Plinth homepage""" if is_setup(): frontpage.add_shortcut( - 'diaspora', - name, - short_description, + 'diaspora', name, short_description, url='https://diaspora.{}'.format(get_configured_domain_name()), login_required=True) @@ -170,16 +160,14 @@ def diagnose(): results = [] results.append( - action_utils.diagnose_url( - 'http://diaspora.localhost', kind='4', check_certificate=False)) + action_utils.diagnose_url('http://diaspora.localhost', kind='4', + check_certificate=False)) results.append( - action_utils.diagnose_url( - 'http://diaspora.localhost', kind='6', check_certificate=False)) + action_utils.diagnose_url('http://diaspora.localhost', kind='6', + check_certificate=False)) results.append( - action_utils.diagnose_url( - 'http://diaspora.{}'.format(get_configured_domain_name()), - kind='4', - check_certificate=False)) + action_utils.diagnose_url('http://diaspora.{}'.format( + get_configured_domain_name()), kind='4', check_certificate=False)) return results @@ -197,8 +185,7 @@ def generate_apache_configuration(conf_file, domain_name): aug.set('/augeas/load/Httpd/incl[last() + 1]', conf_file) aug.load() - aug.defvar('conf', - '/files' + conf_file) + aug.defvar('conf', '/files' + conf_file) aug.set('$conf/VirtualHost', None) aug.defvar('vh', '$conf/VirtualHost') diff --git a/plinth/modules/diaspora/manifest.py b/plinth/modules/diaspora/manifest.py index 1afd28ed2..6696563af 100644 --- a/plinth/modules/diaspora/manifest.py +++ b/plinth/modules/diaspora/manifest.py @@ -17,10 +17,11 @@ from django.utils.translation import ugettext_lazy as _ +from plinth.modules import diaspora from plinth.templatetags.plinth_extras import Mobile_OS, Store -from plinth.utils import format_lazy +from plinth.utils import f_droid_url, format_lazy -from . import get_configured_domain_name +dandelion_package_id = 'com.github.dfa.diaspora_android' clients = [{ 'name': @@ -32,8 +33,7 @@ clients = [{ 'type': 'store', 'os': Mobile_OS.ANDROID.value, 'store_name': Store.F_DROID.value, - 'url': 'https://f-droid.org/repository/browse/?fdid=com' - '.github.dfa.diaspora_android ', + 'url': f_droid_url(dandelion_package_id), }] }, { 'name': @@ -43,6 +43,7 @@ clients = [{ 'web', 'url': format_lazy('https://diaspora.{host}', - host=get_configured_domain_name()) + host=diaspora.get_configured_domain_name() if + diaspora.is_setup() else "") }] }]