From 320f1889fdac276083e20e95ae6b96a023d6b812 Mon Sep 17 00:00:00 2001 From: Pavel Borecki Date: Tue, 10 Sep 2019 07:48:27 +0000 Subject: [PATCH 01/11] Translated using Weblate (Czech) Currently translated at 98.5% (1057 of 1073 strings) --- plinth/locale/cs/LC_MESSAGES/django.po | 60 ++++++++++---------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/plinth/locale/cs/LC_MESSAGES/django.po b/plinth/locale/cs/LC_MESSAGES/django.po index 64ab0e300..11f001523 100644 --- a/plinth/locale/cs/LC_MESSAGES/django.po +++ b/plinth/locale/cs/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-09 17:49-0400\n" -"PO-Revision-Date: 2019-08-02 21:11+0000\n" +"PO-Revision-Date: 2019-09-11 08:23+0000\n" "Last-Translator: Pavel Borecki \n" "Language-Team: Czech \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Weblate 3.8-dev\n" +"X-Generator: Weblate 3.9-dev\n" #: plinth/action_utils.py:298 #, python-brace-format @@ -128,7 +128,7 @@ msgstr "" #: plinth/modules/avahi/__init__.py:77 msgid "Local Network Domain" -msgstr "" +msgstr "Doména místní sítě" #: plinth/modules/backups/__init__.py:40 msgid "Backups" @@ -224,11 +224,11 @@ msgstr "Pro šifrování je potřebná heslová fráze." #: plinth/modules/backups/forms.py:189 msgid "Select Disk or Partition" -msgstr "" +msgstr "Vybrat datové úložiště nebo oddíl" #: plinth/modules/backups/forms.py:190 msgid "Backups will be stored in the directory FreedomBoxBackups" -msgstr "" +msgstr "Zálohy budou uloženy ve složce FreedomBoxBackups" #: plinth/modules/backups/forms.py:199 msgid "SSH Repository Path" @@ -294,7 +294,7 @@ msgstr "" #: plinth/modules/backups/repository.py:154 msgid "Existing repository is not encrypted." -msgstr "" +msgstr "Existující repozitář není šifrován." #: plinth/modules/backups/repository.py:342 #, python-brace-format @@ -319,16 +319,12 @@ msgid "Upload and Restore" msgstr "Nahrát a obnovit" #: plinth/modules/backups/templates/backups.html:59 -#, fuzzy -#| msgid "Add a remote backup location" msgid "Add a backup location" -msgstr "Přidat umístění pro zálohy na protějšku" +msgstr "Přidat umístění pro zálohy" #: plinth/modules/backups/templates/backups.html:63 -#, fuzzy -#| msgid "Add a remote backup location" msgid "Add Backup Location" -msgstr "Přidat umístění pro zálohy na protějšku" +msgstr "Přidat umístění pro zálohy" #: plinth/modules/backups/templates/backups.html:66 msgid "Add a remote backup location" @@ -509,13 +505,11 @@ msgstr "Obnovit z nahraného souboru" #: plinth/modules/backups/views.py:255 msgid "No additional disks available to add a repository." -msgstr "" +msgstr "Nejsou k dispozici žádná další úložiště pro přidání repozitáře." #: plinth/modules/backups/views.py:263 -#, fuzzy -#| msgid "Create remote backup repository" msgid "Create backup repository" -msgstr "Vytvořit repozitář pro zálohy na protějšku" +msgstr "Vytvořit repozitář pro zálohy" #: plinth/modules/backups/views.py:290 msgid "Create remote backup repository" @@ -558,10 +552,8 @@ msgid "Remove Repository" msgstr "Odebrat repozitář" #: plinth/modules/backups/views.py:419 -#, fuzzy -#| msgid "Repository removed. The remote backup itself was not deleted." msgid "Repository removed. Backups were not deleted." -msgstr "Repozitář odebrán. Záloha na protějšku jako taková smazána nebyla." +msgstr "Repozitář odebrán. Zálohy jako takové smazány nebyly." #: plinth/modules/backups/views.py:429 msgid "Unmounting failed!" @@ -1121,10 +1113,8 @@ msgstr "" "IP adresou." #: plinth/modules/dynamicdns/__init__.py:78 -#, fuzzy -#| msgid "Domain Name" msgid "Dynamic Domain Name" -msgstr "Doménový název" +msgstr "Název dynamické domény" #: plinth/modules/dynamicdns/forms.py:43 msgid "" @@ -1617,19 +1607,19 @@ msgstr "Příručka" #: plinth/modules/help/templates/help_support.html:24 #: plinth/templates/base.html:164 plinth/templates/base.html:165 msgid "Get Support" -msgstr "" +msgstr "Získat podporu" #: plinth/modules/help/help.py:61 plinth/modules/help/help.py:98 #: plinth/modules/help/templates/help_feedback.html:24 #: plinth/templates/base.html:170 plinth/templates/base.html:171 msgid "Submit Feedback" -msgstr "" +msgstr "Odeslat zpětnou vazbu" #: plinth/modules/help/help.py:66 plinth/modules/help/help.py:92 #: plinth/modules/help/templates/help_contribute.html:24 #: plinth/templates/base.html:176 plinth/templates/base.html:177 msgid "Contribute" -msgstr "" +msgstr "Zapojit se" #: plinth/modules/help/help.py:86 msgid "Documentation and FAQ" @@ -1739,7 +1729,7 @@ msgstr "Nastavení %(box_name)s" #: plinth/modules/help/templates/help_contribute.html:27 msgid "The FreedomBox project welcomes contributions of all kinds." -msgstr "" +msgstr "Projekt FreedomBox vítá příspěvky jakéhokoli druhu." #: plinth/modules/help/templates/help_contribute.html:33 msgid "" @@ -1765,7 +1755,7 @@ msgstr "" #: plinth/modules/help/templates/help_feedback.html:27 #, python-format msgid "Your feedback will help us improve %(box_name)s!" -msgstr "" +msgstr "Vaše zpětná vazba nám pomůže vylepšit %(box_name)s!" #: plinth/modules/help/templates/help_feedback.html:33 msgid "" @@ -1784,7 +1774,7 @@ msgstr "" #: plinth/modules/help/templates/help_feedback.html:51 msgid "Thank you!" -msgstr "" +msgstr "Děkujeme!" #: plinth/modules/help/templates/help_index.html:31 #, python-format @@ -1831,10 +1821,8 @@ msgstr "" "a> kanálu pomocí webového rozhraní k IRC." #: plinth/modules/help/templates/help_manual.html:40 -#, fuzzy -#| msgid "Download" msgid "Download as PDF" -msgstr "Stáhnout" +msgstr "Stáhnout jako PDF" #: plinth/modules/help/templates/help_support.html:27 #, python-format @@ -2908,11 +2896,11 @@ msgstr "" #: plinth/modules/names/components.py:27 msgid "All" -msgstr "" +msgstr "Vše" #: plinth/modules/names/components.py:31 plinth/modules/names/components.py:35 msgid "All web apps" -msgstr "" +msgstr "Všechny webové aplikace" #: plinth/modules/networks/__init__.py:36 msgid "Networks" @@ -3683,10 +3671,8 @@ msgstr "" "smluvit využití jeho {box_name}." #: plinth/modules/pagekite/__init__.py:96 -#, fuzzy -#| msgid "PageKite Account" msgid "PageKite Domain" -msgstr "PageKite účet" +msgstr "PageKite doména" #: plinth/modules/pagekite/forms.py:69 msgid "Enable PageKite" @@ -4476,7 +4462,7 @@ msgstr "" #: plinth/modules/security/templates/security.html:42 msgid "Show security vulnerabilities" -msgstr "" +msgstr "Zobrazit zranitelnosti zabezpečení" #: plinth/modules/security/templates/security.html:49 msgid "App Name" From f47da405cecb30bb4e3ebfd020d4b0b22a47a111 Mon Sep 17 00:00:00 2001 From: Anxin YI <2732146152@qq.com> Date: Thu, 12 Sep 2019 04:53:15 +0000 Subject: [PATCH 02/11] Translated using Weblate (Chinese (Simplified)) Currently translated at 64.6% (693 of 1073 strings) --- plinth/locale/zh_Hans/LC_MESSAGES/django.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plinth/locale/zh_Hans/LC_MESSAGES/django.po b/plinth/locale/zh_Hans/LC_MESSAGES/django.po index dc5f0188e..b6681de2e 100644 --- a/plinth/locale/zh_Hans/LC_MESSAGES/django.po +++ b/plinth/locale/zh_Hans/LC_MESSAGES/django.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: Plinth\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-09 17:49-0400\n" -"PO-Revision-Date: 2019-08-11 14:23+0000\n" -"Last-Translator: ZeroAurora \n" +"PO-Revision-Date: 2019-09-13 05:23+0000\n" +"Last-Translator: Anxin YI <2732146152@qq.com>\n" "Language-Team: Chinese (Simplified) \n" "Language: zh_Hans\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 3.8-dev\n" +"X-Generator: Weblate 3.9-dev\n" #: plinth/action_utils.py:298 #, python-brace-format @@ -125,7 +125,7 @@ msgstr "" #: plinth/modules/avahi/__init__.py:77 msgid "Local Network Domain" -msgstr "" +msgstr "本地网络领域" #: plinth/modules/backups/__init__.py:40 msgid "Backups" @@ -493,7 +493,7 @@ msgstr "从已上传的文件中恢复" #: plinth/modules/backups/views.py:255 msgid "No additional disks available to add a repository." -msgstr "" +msgstr "没有可增加到信息库的额外可用磁盘。" #: plinth/modules/backups/views.py:263 #, fuzzy From e83f387be12ce88161dfc6875ca557dc9913bb4e Mon Sep 17 00:00:00 2001 From: Pavel Borecki Date: Mon, 16 Sep 2019 18:31:06 +0000 Subject: [PATCH 03/11] Translated using Weblate (Czech) Currently translated at 98.9% (1061 of 1073 strings) --- plinth/locale/cs/LC_MESSAGES/django.po | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/plinth/locale/cs/LC_MESSAGES/django.po b/plinth/locale/cs/LC_MESSAGES/django.po index 11f001523..7be1ba0fb 100644 --- a/plinth/locale/cs/LC_MESSAGES/django.po +++ b/plinth/locale/cs/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-09 17:49-0400\n" -"PO-Revision-Date: 2019-09-11 08:23+0000\n" +"PO-Revision-Date: 2019-09-17 19:24+0000\n" "Last-Translator: Pavel Borecki \n" "Language-Team: Czech \n" @@ -331,8 +331,6 @@ msgid "Add a remote backup location" msgstr "Přidat umístění pro zálohy na protějšku" #: plinth/modules/backups/templates/backups.html:70 -#, fuzzy -#| msgid "Add a remote backup location" msgid "Add Remote Backup Location" msgstr "Přidat umístění pro zálohy na protějšku" @@ -1720,6 +1718,10 @@ msgid "" "maintained on a best-effort basis by contributors in Debian and FreedomBox " "community." msgstr "" +"Používáte balíčky z Debian backports. Mějte na paměti, že bezpečnostní tým " +"projektu Debian se nezabývá opravami zabezpečení těchto balíčků. Nicméně " +"jsou spravovány na základě nejlepší snahy přispěvateli z komunit Debian a " +"FreedomBox." #: plinth/modules/help/templates/help_base.html:36 #: plinth/modules/help/templates/help_index.html:76 @@ -1739,6 +1741,11 @@ msgid "" "into your language, hosting hackathons or install fests, and by spreading " "the word." msgstr "" +"Můžete přispět programováním, testováním a hlášením chyb, diskutováním o " +"dalších příkladech použití a nových aplikacích, navrhování log a grafiky, " +"poskytování podpory dalším uživatelům, překládání FreedomBox a jeho aplikací " +"do svého jazyka, hostování hackathonů nebo instalačních festivalů a " +"propagací." #: plinth/modules/help/templates/help_contribute.html:43 msgid "" @@ -1763,6 +1770,9 @@ msgid "" "improve them on our discussion forum." msgstr "" +"Dejte nám vědět, které funkce vám chybí, jaké jsou vaše oblíbené aplikace a " +"jak je můžeme vylepšit na našem diskuzním fóru." #: plinth/modules/help/templates/help_feedback.html:41 msgid "" From 3e619d6882c1566bb9b59e8008bf4eff1435ed78 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Fri, 13 Sep 2019 07:01:02 +0530 Subject: [PATCH 04/11] firstboot: network connections not used, cleanup No longer showing network connections in firstboot. Removed dead code. Signed-off-by: Joseph Nuthalapati Reviewed-by: Sunil Mohan Adapa --- plinth/modules/first_boot/views.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plinth/modules/first_boot/views.py b/plinth/modules/first_boot/views.py index 4bec3b936..bf52c32d4 100644 --- a/plinth/modules/first_boot/views.py +++ b/plinth/modules/first_boot/views.py @@ -21,7 +21,6 @@ from django.utils.translation import ugettext as _ from django.views.generic import TemplateView from django.views.generic.edit import FormView -from plinth import network from plinth.modules import first_boot from .forms import FirstbootWizardSecretForm @@ -62,7 +61,6 @@ class CompleteView(TemplateView): def get_context_data(self, **kwargs): """Add network connections to context list.""" context = super().get_context_data(**kwargs) - context['connections'] = network.get_connection_list() context['title'] = _('Setup Complete') context['firstboot_complete'] = True return context From 7cbaec3e26d4daffc59dd791607c18bb57c36813 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Fri, 13 Sep 2019 07:47:25 +0530 Subject: [PATCH 05/11] firstboot: Add new help menu to firstboot navbar - Refactor the help menu into a django template include. - Show help menu if user is logged in, instead of after completing firstboot. Closes: #1517 Signed-off-by: Joseph Nuthalapati [sunil@medhas.org Rename help-menu.inc to help-menu.inc] [sunil@medhas.org Use user.is_authenticated instead of another variable] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- .../first_boot/templates/base_firstboot.html | 6 +- .../templates/firstboot_navbar.html | 11 +--- plinth/templates/base.html | 46 +------------ plinth/templates/help-menu.html | 66 +++++++++++++++++++ 4 files changed, 71 insertions(+), 58 deletions(-) create mode 100644 plinth/templates/help-menu.html diff --git a/plinth/modules/first_boot/templates/base_firstboot.html b/plinth/modules/first_boot/templates/base_firstboot.html index 78b28ea10..06780bd4d 100644 --- a/plinth/modules/first_boot/templates/base_firstboot.html +++ b/plinth/modules/first_boot/templates/base_firstboot.html @@ -29,7 +29,7 @@ {% endblock %} {% block mainmenu_right %} - {% if firstboot_complete %} - {% include "firstboot_navbar.html" %} - {% endif %} + {% if user.is_authenticated %} + {% include "firstboot_navbar.html" %} + {% endif %} {% endblock %} diff --git a/plinth/modules/first_boot/templates/firstboot_navbar.html b/plinth/modules/first_boot/templates/firstboot_navbar.html index a3a8b4ea6..6317f2874 100644 --- a/plinth/modules/first_boot/templates/firstboot_navbar.html +++ b/plinth/modules/first_boot/templates/firstboot_navbar.html @@ -17,13 +17,4 @@ # {% endcomment %} -{% load i18n %} - -
  • - - - - -
  • +{% include "help-menu.html" %} diff --git a/plinth/templates/base.html b/plinth/templates/base.html index ad69921e9..87b2c93d6 100644 --- a/plinth/templates/base.html +++ b/plinth/templates/base.html @@ -141,51 +141,7 @@ {% block mainmenu_right %} {% if user.is_authenticated %} - + {% include "help-menu.html" %} From 54b0e7c63b8979ffd427db2695f6e480ad64745f Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 9 Sep 2019 17:34:13 -0700 Subject: [PATCH 06/11] letsencrypt: Update and fix tests involving domain changes - Remove checking of the sender is 'test' and use mocking. - Remove need for tests being run as root. - Simplify log messages, avoid pylint warnings. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/letsencrypt/__init__.py | 15 ++--- .../tests/test_domain_name_changes.py | 61 +++++++++++++++++-- 2 files changed, 62 insertions(+), 14 deletions(-) diff --git a/plinth/modules/letsencrypt/__init__.py b/plinth/modules/letsencrypt/__init__.py index 5fb061232..23f60bdb4 100644 --- a/plinth/modules/letsencrypt/__init__.py +++ b/plinth/modules/letsencrypt/__init__.py @@ -163,9 +163,8 @@ def on_domain_added(sender, domain_type='', name='', description='', return False try: - # Obtaining certs during tests or empty names isn't expected to succeed - if sender != 'test' and name: - logger.info('Obtaining a Let\'s Encrypt certificate for %s', name) + if name: + logger.info('Obtaining certificate for %s', name) certificate_obtain(name) return True except ActionError: @@ -178,15 +177,13 @@ def on_domain_removed(sender, domain_type, name='', **kwargs): return False try: - # Revoking certs during tests or empty names isn't expected to succeed - if sender != 'test' and name: - logger.info("Revoking the Let\'s Encrypt certificate for " + name) + if name: + logger.info('Revoking certificate for %s', name) certificate_revoke(name) return True except ActionError as exception: - logger.warning( - ('Failed to revoke certificate for domain {domain}: {error}' - ).format(domain=name, error=exception.args[2])) + logger.warning('Failed to revoke certificate for %s: %s', name, + exception.args[2]) return False diff --git a/plinth/modules/letsencrypt/tests/test_domain_name_changes.py b/plinth/modules/letsencrypt/tests/test_domain_name_changes.py index 1a0f776f0..394a7a3fd 100644 --- a/plinth/modules/letsencrypt/tests/test_domain_name_changes.py +++ b/plinth/modules/letsencrypt/tests/test_domain_name_changes.py @@ -18,21 +18,72 @@ Tests for letsencrypt module. """ +from unittest.mock import call, patch + import pytest +from plinth.modules.names.components import DomainType + from .. import on_domain_added, on_domain_removed -pytestmark = pytest.mark.usefixtures('needs_root', 'needs_sudo') + +@pytest.fixture(name='domain_types') +def fixture_domain_types(): + """Create a domain types required for tests.""" + DomainType('domain-type-tor', 'Tor Hidden Service', 'tor:index', + can_have_certificate=False) + DomainType('domain-type-test', 'Test Domain Type', 'test:index') +@pytest.mark.usefixtures('domain_types') def test_add_onion_domain(): + """Test that .onion domains are ignored when added/removed.""" assert not on_domain_added('test', 'domain-type-tor', 'ddddd.onion') + assert not on_domain_removed('test', 'domain-type-tor', 'ddddd.onion') +@patch('plinth.modules.letsencrypt.get_status') +@patch('plinth.modules.letsencrypt.certificate_obtain') @pytest.mark.usefixtures('load_cfg') -def test_add_valid_domain(): - assert on_domain_added('test', 'domainname', 'subdomain.domain.tld') +@pytest.mark.parametrize('domain,status_input,obtain,result', [ + ('domain1.tld', { + 'certificate_available': True, + 'validity': 'not-valid' + }, True, True), + ('domain2.tld', { + 'certificate_available': False, + 'validity': 'valid' + }, True, True), + ('domain3.tld', { + 'certificate_available': True, + 'validity': 'valid' + }, False, False), + ('', { + 'certificate_available': False, + 'validity': 'valid' + }, False, True), +]) +def test_add_valid_domain(certificate_obtain, get_status, domain, status_input, + obtain, result): + """Test adding a domain that can have certificates.""" + get_status.return_value = {'domains': {domain: status_input}} + assert result == on_domain_added('test', 'domain-type-test', domain) + if obtain: + certificate_obtain.assert_has_calls([call(domain)]) + else: + certificate_obtain.assert_not_called() -def test_remove_domain(): - assert on_domain_removed('test', '', 'somedomain.tld') +@patch('plinth.modules.letsencrypt.certificate_revoke') +@pytest.mark.usefixtures('load_cfg') +@pytest.mark.parametrize('domain,revoke,result', [ + ('domain1.tld', True, True), + ('', False, True), +]) +def test_remove_domain(certificate_revoke, domain, revoke, result): + """Test removing a domain that can certificates.""" + assert result == on_domain_removed('test', 'domain-type-test', domain) + if revoke: + certificate_revoke.assert_has_calls([call(domain)]) + else: + certificate_revoke.assert_not_called() From 6db1926a62bee229838fe3ff832c666114754d2b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 9 Sep 2019 17:36:19 -0700 Subject: [PATCH 07/11] tor: Fix test case for getting status Mock the app so that it doesn't have to be loaded. Closes: #1645. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/tor/tests/test_tor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plinth/modules/tor/tests/test_tor.py b/plinth/modules/tor/tests/test_tor.py index 86985c352..1226f52af 100644 --- a/plinth/modules/tor/tests/test_tor.py +++ b/plinth/modules/tor/tests/test_tor.py @@ -18,6 +18,8 @@ Tests for Tor module. """ +from unittest.mock import patch + import pytest from django.core.exceptions import ValidationError @@ -36,8 +38,9 @@ class TestTor: utils.is_apt_transport_tor_enabled() @staticmethod + @patch('plinth.modules.tor.app') @pytest.mark.usefixtures('needs_root', 'load_cfg') - def test_get_status(): + def test_get_status(_app): """Test that get_status does not raise any unhandled exceptions. This should work regardless of whether tor is installed, or From dbb3558aab7190856a62f77465d6f9db0dc7f7c3 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 17 Sep 2019 19:49:01 -0700 Subject: [PATCH 08/11] firstboot: Hide left menu during first boot as intended This seems to be a regression from earlier behavior. Signed-off-by: Sunil Mohan Adapa Reviewed-by: Joseph Nuthalapati --- .../first_boot/templates/base_firstboot.html | 3 + plinth/templates/base.html | 58 ++++++++++--------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/plinth/modules/first_boot/templates/base_firstboot.html b/plinth/modules/first_boot/templates/base_firstboot.html index 06780bd4d..500e9a8ca 100644 --- a/plinth/modules/first_boot/templates/base_firstboot.html +++ b/plinth/modules/first_boot/templates/base_firstboot.html @@ -28,6 +28,9 @@ {% endblock %} +{% block mainmenu_left_collapse %} +{% endblock %} + {% block mainmenu_right %} {% if user.is_authenticated %} {% include "firstboot_navbar.html" %} diff --git a/plinth/templates/base.html b/plinth/templates/base.html index 87b2c93d6..1202c2ceb 100644 --- a/plinth/templates/base.html +++ b/plinth/templates/base.html @@ -108,34 +108,36 @@