From 4d2053e1157141b4f46e28ffafa012bbdc1795bb Mon Sep 17 00:00:00 2001 From: Burak Yavuz Date: Tue, 9 Nov 2021 04:08:31 +0000 Subject: [PATCH 01/33] Translated using Weblate (Turkish) Currently translated at 100.0% (1498 of 1498 strings) --- plinth/locale/tr/LC_MESSAGES/django.po | 30 +++++++------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/plinth/locale/tr/LC_MESSAGES/django.po b/plinth/locale/tr/LC_MESSAGES/django.po index 4860c721d..2cd5025d4 100644 --- a/plinth/locale/tr/LC_MESSAGES/django.po +++ b/plinth/locale/tr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-08 21:01-0500\n" -"PO-Revision-Date: 2021-10-27 04:42+0000\n" +"PO-Revision-Date: 2021-11-10 04:52+0000\n" "Last-Translator: Burak Yavuz \n" "Language-Team: Turkish \n" @@ -2134,16 +2134,12 @@ msgid "Has a TLS certificate" msgstr "TLS sertifikası var" #: plinth/modules/email_server/forms.py:15 -#, fuzzy -#| msgid "Enter a valid username." msgid "Enter a valid domain" -msgstr "Geçerli bir kullanıcı adı girin." +msgstr "Geçerli bir etki alanı girin" #: plinth/modules/email_server/forms.py:18 -#, fuzzy -#| msgid "Enter a valid username." msgid "Enter a valid destination" -msgstr "Geçerli bir kullanıcı adı girin." +msgstr "Geçerli bir hedef girin" #: plinth/modules/email_server/forms.py:22 msgid "domain" @@ -2166,10 +2162,8 @@ msgid "Cannot be a number" msgstr "Sayı olamaz" #: plinth/modules/email_server/forms.py:76 -#, fuzzy -#| msgid "My Aliases" msgid "Aliases" -msgstr "Kod Adlarım" +msgstr "Kod Adları" #: plinth/modules/email_server/forms.py:88 #: plinth/modules/firewall/templates/firewall.html:54 @@ -2214,16 +2208,12 @@ msgid "You have no email aliases." msgstr "E-posta kod adlarınız yok." #: plinth/modules/email_server/templates/email_alias.html:24 -#, fuzzy -#| msgid "Disabled" msgid "Disable" -msgstr "Etkisizleştirildi" +msgstr "Etkisizleştir" #: plinth/modules/email_server/templates/email_alias.html:26 -#, fuzzy -#| msgid "Enabled" msgid "Enable" -msgstr "Etkinleştirildi" +msgstr "Etkinleştir" #: plinth/modules/email_server/templates/email_alias.html:32 msgid "Create a new email alias" @@ -2241,10 +2231,8 @@ msgid "Domains" msgstr "Etki Alanları" #: plinth/modules/email_server/templates/email_server.html:19 -#, fuzzy -#| msgid "Manage Snapshots" msgid "Manage Spam" -msgstr "Anlık Görüntüleri Yönet" +msgstr "İstenmeyen İletiyi Yönet" #: plinth/modules/email_server/templates/email_server.html:30 msgid "Service Alert" @@ -2264,10 +2252,8 @@ msgid "Check syslog for more information" msgstr "Daha fazla bilgi için syslog'u gözden geçirin" #: plinth/modules/email_server/views.py:217 -#, fuzzy -#| msgid "An error occurred during configuration." msgid "Error updating configuration" -msgstr "Yapılandırma sırasında bir hata meydana geldi." +msgstr "Yapılandırma güncellenirken hata oldu" #: plinth/modules/email_server/views.py:219 plinth/modules/tor/views.py:137 #: plinth/views.py:219 From bdb239c72e87a7b824a25ab6a3885fdb8a87ee2d Mon Sep 17 00:00:00 2001 From: Michael Breidenbach Date: Fri, 12 Nov 2021 03:36:10 +0000 Subject: [PATCH 02/33] Translated using Weblate (Swedish) Currently translated at 100.0% (1498 of 1498 strings) --- plinth/locale/sv/LC_MESSAGES/django.po | 34 ++++++++------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/plinth/locale/sv/LC_MESSAGES/django.po b/plinth/locale/sv/LC_MESSAGES/django.po index 41f5dbaae..e55d68b5a 100644 --- a/plinth/locale/sv/LC_MESSAGES/django.po +++ b/plinth/locale/sv/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-08 21:01-0500\n" -"PO-Revision-Date: 2021-11-04 02:39+0000\n" +"PO-Revision-Date: 2021-11-13 03:49+0000\n" "Last-Translator: Michael Breidenbach \n" "Language-Team: Swedish \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.9-dev\n" +"X-Generator: Weblate 4.9.1-dev\n" #: doc/dev/_templates/layout.html:11 msgid "Page source" @@ -1404,7 +1404,7 @@ msgstr "" #: plinth/modules/datetime/__init__.py:69 msgid "Date & Time" -msgstr "Datum & Tid" +msgstr "Datum och Tid" #: plinth/modules/datetime/__init__.py:115 msgid "Time synchronized to NTP server" @@ -2132,16 +2132,12 @@ msgid "Has a TLS certificate" msgstr "Har ett TLS-certifikat" #: plinth/modules/email_server/forms.py:15 -#, fuzzy -#| msgid "Enter a valid username." msgid "Enter a valid domain" -msgstr "Ange ett giltigt användarnamn." +msgstr "Ange ett giltigt domän" #: plinth/modules/email_server/forms.py:18 -#, fuzzy -#| msgid "Enter a valid username." msgid "Enter a valid destination" -msgstr "Ange ett giltigt användarnamn." +msgstr "Ange ett giltigt destination" #: plinth/modules/email_server/forms.py:22 msgid "domain" @@ -2164,10 +2160,8 @@ msgid "Cannot be a number" msgstr "Kan inte vara ett nummer" #: plinth/modules/email_server/forms.py:76 -#, fuzzy -#| msgid "My Aliases" msgid "Aliases" -msgstr "Mina alias" +msgstr "Aliasnamn" #: plinth/modules/email_server/forms.py:88 #: plinth/modules/firewall/templates/firewall.html:54 @@ -2212,16 +2206,12 @@ msgid "You have no email aliases." msgstr "Du har inga e-postalias." #: plinth/modules/email_server/templates/email_alias.html:24 -#, fuzzy -#| msgid "Disabled" msgid "Disable" -msgstr "Inaktiverad" +msgstr "Avaktivera" #: plinth/modules/email_server/templates/email_alias.html:26 -#, fuzzy -#| msgid "Enabled" msgid "Enable" -msgstr "Aktiverad" +msgstr "Aktivera" #: plinth/modules/email_server/templates/email_alias.html:32 msgid "Create a new email alias" @@ -2239,10 +2229,8 @@ msgid "Domains" msgstr "Domäner" #: plinth/modules/email_server/templates/email_server.html:19 -#, fuzzy -#| msgid "Manage Snapshots" msgid "Manage Spam" -msgstr "Hantera ögonblicksbilder" +msgstr "Hantera skräppost" #: plinth/modules/email_server/templates/email_server.html:30 msgid "Service Alert" @@ -2262,10 +2250,8 @@ msgid "Check syslog for more information" msgstr "Kontrollera syslog för mer information" #: plinth/modules/email_server/views.py:217 -#, fuzzy -#| msgid "An error occurred during configuration." msgid "Error updating configuration" -msgstr "Ett fel inträffade under konfiguration." +msgstr "Fel vid uppdatering av konfiguration" #: plinth/modules/email_server/views.py:219 plinth/modules/tor/views.py:137 #: plinth/views.py:219 From 1147249bd8d03de1d0a698cd642d003f06f585f7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:13:25 -0800 Subject: [PATCH 03/33] app: Introduce separate method for post initialization operations During __init__, only component building must be done. All other operations go in to post_init(). This allows for cleaner initialization from various scenarios which simply have to query the app instead of fully initializing it. Tests: - None. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/app.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plinth/app.py b/plinth/app.py index 08ed15ade..b93853b1e 100644 --- a/plinth/app.py +++ b/plinth/app.py @@ -41,7 +41,15 @@ class App: _all_apps = collections.OrderedDict() def __init__(self): - """Initialize the app object.""" + """Build the app by adding components. + + App may be built just for the purpose for querying. For example, when + querying the list of package dependencies of essential apps, an app is + minimally constructed under a read-only environment for querying from a + specific component. So, this operation should have no side-effects such + connecting to signals, running configuration corrections and scheduling + operations. + """ if not self.app_id: raise ValueError('Invalid app ID configured') @@ -50,6 +58,14 @@ class App: # Add self to global list of apps self._all_apps[self.app_id] = self + def post_init(self): + """Perform post initialization operations. + + Additional initialization operations such as connecting to signals, + running configuration corrections and scheduling operations should be + done in this method rather than in __init__(). + """ + @classmethod def get(cls, app_id): """Return an app with given ID.""" From d2aee03c89fa91e95a6ccb28ade802ab856e0e5d Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:17:47 -0800 Subject: [PATCH 04/33] module_loader: Split app initialization into separate steps - Loading module is only for importing python modules and determining the order in which they should be loaded. - Initializing apps will create the instances which involves just creating the components of the apps. - Post initialization involves connecting to signals, running configuration fixes, etc. Tests: - All apps that have post initialization step have been tested. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/__main__.py | 3 +++ plinth/module_loader.py | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index bdb7041bc..4ab44f5c0 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -112,6 +112,7 @@ def main(): module_loader.include_urls() menu.init() module_loader.load_modules() + module_loader.apps_init() list_dependencies(arguments.list_dependencies) log.init() @@ -129,6 +130,8 @@ def main(): menu.init() module_loader.load_modules() + module_loader.apps_init() + module_loader.apps_post_init() frontpage.add_custom_shortcuts() if arguments.setup is not False: diff --git a/plinth/module_loader.py b/plinth/module_loader.py index 9b53184a7..561415507 100644 --- a/plinth/module_loader.py +++ b/plinth/module_loader.py @@ -66,15 +66,9 @@ def load_modules(): except KeyError: logger.error('Unsatified dependency for module - %s', module_name) - logger.info('Initializing apps - %s', ', '.join(ordered_modules)) - for module_name in ordered_modules: - _initialize_module(module_name, modules[module_name]) loaded_modules[module_name] = modules[module_name] - logger.debug('App initialization completed.') - post_module_loading.send_robust(sender="module_loader") - def _insert_modules(module_name, module, remaining_modules, ordered_modules): """Insert modules into a list based on dependency order""" @@ -118,6 +112,13 @@ def _include_module_urls(module_import_path, module_name): raise +def apps_init(): + """Create apps by constructing them with components.""" + logger.info('Initializing apps - %s', ', '.join(loaded_modules)) + for module_name, module in loaded_modules.items(): + _initialize_module(module_name, module) + + def _initialize_module(module_name, module): """Perform module initialization""" @@ -131,10 +132,6 @@ def _initialize_module(module_name, module): ] if module_classes and app_class: module.app = app_class[0][1]() - - if module.setup_helper.get_state( - ) != 'needs-setup' and module.app.is_enabled(): - module.app.set_enabled(True) except Exception as exception: logger.exception('Exception while running init for %s: %s', module, exception) @@ -142,6 +139,27 @@ def _initialize_module(module_name, module): raise +def apps_post_init(): + """Run post initialization on each app.""" + for module in loaded_modules.values(): + if not hasattr(module, 'app') or not module.app: + continue + + try: + module.app.post_init() + if module.setup_helper.get_state( + ) != 'needs-setup' and module.app.is_enabled(): + module.app.set_enabled(True) + except Exception as exception: + logger.exception('Exception while running post init for %s: %s', + module, exception) + if cfg.develop: + raise + + logger.debug('App initialization completed.') + post_module_loading.send_robust(sender="module_loader") + + def get_modules_to_load(): """Get the list of modules to be loaded""" global _modules_to_load From 79a6e041cac30b96f41777df491f7d68b3475933 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 11:45:57 -0800 Subject: [PATCH 05/33] avahi: Split app initialization Tests: - After startup, names module shows a .local domain if app is enabled. - If app is disabled, .local domain is not shown. - When hostname is changed, .local domain name in names modules changes. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/avahi/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plinth/modules/avahi/__init__.py b/plinth/modules/avahi/__init__.py index ae7ca6c09..243cfd5fd 100644 --- a/plinth/modules/avahi/__init__.py +++ b/plinth/modules/avahi/__init__.py @@ -85,6 +85,8 @@ class AvahiApp(app_module.App): **manifest.backup) self.add(backup_restore) + def post_init(self): + """Perform post initialization operations.""" if self.is_enabled(): domain_added.send_robust(sender='avahi', domain_type='domain-type-local', From 143bff39849870f6234d207ad0226cb9109d2065 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 11:47:46 -0800 Subject: [PATCH 06/33] backups: Split app initialization Tests: - After startup, every 3 minutes, backup schedule check is performed if a schedule is set. Reviewed-by: James Valleroy --- plinth/modules/backups/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/backups/__init__.py b/plinth/modules/backups/__init__.py index 9fdf8fb22..0803bdeaa 100644 --- a/plinth/modules/backups/__init__.py +++ b/plinth/modules/backups/__init__.py @@ -65,6 +65,9 @@ class BackupsApp(app_module.App): packages = Packages('packages-backups', managed_packages) self.add(packages) + @staticmethod + def post_init(): + """Perform post initialization operations.""" # Check every hour (every 3 minutes in debug mode) to perform scheduled # backups. interval = 180 if cfg.develop else 3600 From 2947e182cdbbf58daf254629b803209aec2112e3 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 11:50:08 -0800 Subject: [PATCH 07/33] cockpit: Split app initialization Tests: - When a domain is added it is added to the configuration file. - When a domain is removed it is removed from the configuration file. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/cockpit/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/cockpit/__init__.py b/plinth/modules/cockpit/__init__.py index 4efd156e8..3d07aac20 100644 --- a/plinth/modules/cockpit/__init__.py +++ b/plinth/modules/cockpit/__init__.py @@ -101,6 +101,9 @@ class CockpitApp(app_module.App): **manifest.backup) self.add(backup_restore) + @staticmethod + def post_init(): + """Perform post initialization operations.""" domain_added.connect(on_domain_added) domain_removed.connect(on_domain_removed) From 249c713bb5a01264654e84a9b5a13c7c930ce0bb Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 11:54:56 -0800 Subject: [PATCH 08/33] diagnostics: Split app initialization Tests: - When a print message is added in low disk space checking method, it is printed every 3 minutes. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/diagnostics/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py index 61bde37f4..5cb2b202e 100644 --- a/plinth/modules/diagnostics/__init__.py +++ b/plinth/modules/diagnostics/__init__.py @@ -64,6 +64,9 @@ class DiagnosticsApp(app_module.App): **manifest.backup) self.add(backup_restore) + @staticmethod + def post_init(): + """Perform post initialization operations.""" # Check periodically for low RAM space interval = 180 if cfg.develop else 3600 glib.schedule(interval, _warn_about_low_ram_space) From b163423a262089be09fdcfebefa4e0f7c211d40f Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 11:56:23 -0800 Subject: [PATCH 09/33] dynamicdns: Split app initialization Tests: - When configured, after startup, Dynamic DNS domain shows up in names module. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/dynamicdns/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/dynamicdns/__init__.py b/plinth/modules/dynamicdns/__init__.py index 6e0435d64..75ae6181c 100644 --- a/plinth/modules/dynamicdns/__init__.py +++ b/plinth/modules/dynamicdns/__init__.py @@ -80,6 +80,9 @@ class DynamicDNSApp(app_module.App): **manifest.backup) self.add(backup_restore) + @staticmethod + def post_init(): + """Perform post initialization operations.""" current_status = get_status() if current_status['enabled']: domain_added.send_robust(sender='dynamicdns', From 64298061146a7cf224212c33f2aedfe62c97e604 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 11:57:52 -0800 Subject: [PATCH 10/33] email_server: Don't get domain name during initialization This keeps the LE module working better when the domain name is changed after startup. Tests: - Untested. The module is not enabled yet. LE functionality in email server is not fully functional. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/email_server/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plinth/modules/email_server/__init__.py b/plinth/modules/email_server/__init__.py index 150d4cdb8..71c4e1ab0 100644 --- a/plinth/modules/email_server/__init__.py +++ b/plinth/modules/email_server/__init__.py @@ -82,17 +82,13 @@ class EmailServerApp(plinth.app.App): self.add(webserver) # Let's Encrypt event hook - default_domain = get_domainname() - domains = [default_domain] if default_domain else [] - letsencrypt = LetsEncrypt('letsencrypt-email-server', domains=domains, + letsencrypt = LetsEncrypt('letsencrypt-email-server', + domains=get_domains, daemons=['postfix', 'dovecot'], should_copy_certificates=False, managing_app='email_server') self.add(letsencrypt) - if not domains: - logger.warning('Could not fetch the FreedomBox domain name!') - def _add_ui_components(self): info = plinth.app.Info( app_id=self.app_id, version=version, name=self.app_name, @@ -146,6 +142,12 @@ class EmailServerApp(plinth.app.App): return results +def get_domains(): + """Return the list of domains configured.""" + default_domain = get_domainname() + return [default_domain] if default_domain else [] + + def setup(helper, old_version=None): """Installs and configures module""" From c27000c6d6f8d258b99960d42c1d62ccbf4b79b6 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 11:59:30 -0800 Subject: [PATCH 11/33] config: Split app configuration Tests: - After startup, the configured domain name shows up in names module. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/config/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/config/__init__.py b/plinth/modules/config/__init__.py index a2b0327bb..45060726c 100644 --- a/plinth/modules/config/__init__.py +++ b/plinth/modules/config/__init__.py @@ -68,6 +68,9 @@ class ConfigApp(app_module.App): 'config:index', can_have_certificate=True) self.add(domain_type) + @staticmethod + def post_init(): + """Perform post initialization operations.""" # Register domain with Name Services module. domainname = get_domainname() if domainname: From 32d7ce9b387e9412c5f5a73746743d3303db7966 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:01:19 -0800 Subject: [PATCH 12/33] letencrypt: Split app initialization Tests: - On startup, LE tries to obtain certs during post app initialization. - When domain is added, LE tried to obtain certificates. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/letsencrypt/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/letsencrypt/__init__.py b/plinth/modules/letsencrypt/__init__.py index 2b603c5a0..2763a5a51 100644 --- a/plinth/modules/letsencrypt/__init__.py +++ b/plinth/modules/letsencrypt/__init__.py @@ -83,6 +83,9 @@ class LetsEncryptApp(app_module.App): **manifest.backup) self.add(backup_restore) + @staticmethod + def post_init(): + """Perform post initialization operations.""" domain_added.connect(on_domain_added) domain_removed.connect(on_domain_removed) From 1d17ba2134cb12cc77be9156d752b7af0348a245 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:02:41 -0800 Subject: [PATCH 13/33] names: Split app initialization Tests: - When domain name is changed in config module. The updated names shows up in the names module. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/names/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/names/__init__.py b/plinth/modules/names/__init__.py index d17005760..f6aa8e2ae 100644 --- a/plinth/modules/names/__init__.py +++ b/plinth/modules/names/__init__.py @@ -56,6 +56,9 @@ class NamesApp(app_module.App): **manifest.backup) self.add(backup_restore) + @staticmethod + def post_init(): + """Perform post initialization operations.""" domain_added.connect(on_domain_added) domain_removed.connect(on_domain_removed) From e5b56e44f1f966ba336dd54ad5cead72c56d2458 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:03:50 -0800 Subject: [PATCH 14/33] pagekite: Split app initialization Tests: - When configured, upon startup, pagekite domains shows up in the names module. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/pagekite/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plinth/modules/pagekite/__init__.py b/plinth/modules/pagekite/__init__.py index 40f2c5913..8ae7d04d2 100644 --- a/plinth/modules/pagekite/__init__.py +++ b/plinth/modules/pagekite/__init__.py @@ -89,6 +89,8 @@ class PagekiteApp(app_module.App): **manifest.backup) self.add(backup_restore) + def post_init(self): + """Perform post initialization operations.""" # Register kite name with Name Services module. setup_helper = globals()['setup_helper'] if setup_helper.get_state() != 'needs-setup' and self.is_enabled(): From 4b3a4020d9bf8f6b26fedaaeb771975e000f162f Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:05:15 -0800 Subject: [PATCH 15/33] storage: Split app initialization Tests: - Upon startup, 'storage usage-info' action is triggered every 3 minutes. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/storage/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/storage/__init__.py b/plinth/modules/storage/__init__.py index 1c40575b0..9bcea62ba 100644 --- a/plinth/modules/storage/__init__.py +++ b/plinth/modules/storage/__init__.py @@ -68,6 +68,9 @@ class StorageApp(app_module.App): **manifest.backup) self.add(backup_restore) + @staticmethod + def post_init(): + """Perform post initialization operations.""" # Check every hour for low disk space, every 3 minutes in debug mode interval = 180 if cfg.develop else 3600 glib.schedule(interval, warn_about_low_disk_space) From fe482256f63c4894695ac98481f523de918595ac Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:06:59 -0800 Subject: [PATCH 16/33] tor: Split app initialziation Tests: - When onion services are enabled, upon startup, names module shows the onion domain. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/tor/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plinth/modules/tor/__init__.py b/plinth/modules/tor/__init__.py index 22d5d4e23..42c91d12a 100644 --- a/plinth/modules/tor/__init__.py +++ b/plinth/modules/tor/__init__.py @@ -95,6 +95,8 @@ class TorApp(app_module.App): backup_restore = BackupRestore('backup-restore-tor', **manifest.backup) self.add(backup_restore) + def post_init(self): + """Perform post initialization operations.""" # Register hidden service name with Name Services module. setup_helper = globals()['setup_helper'] if setup_helper.get_state() != 'needs-setup' and \ From 5b4f70d6f9d600112360c49066f9b7d2f0f3ccda Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:08:35 -0800 Subject: [PATCH 17/33] upgrades: Split app initialziation Tests: - Upon startup, upgrade check runs every 3 minutes. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/upgrades/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plinth/modules/upgrades/__init__.py b/plinth/modules/upgrades/__init__.py index 5704d75a4..1ffffd674 100644 --- a/plinth/modules/upgrades/__init__.py +++ b/plinth/modules/upgrades/__init__.py @@ -92,6 +92,8 @@ class UpgradesApp(app_module.App): **manifest.backup) self.add(backup_restore) + def post_init(self): + """Perform post initialization operations.""" self._show_new_release_notification() # Check every day (every 3 minutes in debug mode): From 9c091df245942f4d6cae361c7c9be811d2055944 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:09:32 -0800 Subject: [PATCH 18/33] ejabberd: Split app initialziation Tests: - When enabled, when domain name or hostname changes, ejabberd actions are triggered. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/ejabberd/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/ejabberd/__init__.py b/plinth/modules/ejabberd/__init__.py index 41a5418e7..8e3c2d052 100644 --- a/plinth/modules/ejabberd/__init__.py +++ b/plinth/modules/ejabberd/__init__.py @@ -128,6 +128,9 @@ class EjabberdApp(app_module.App): turn = EjabberdTurnConsumer('turn-ejabberd') self.add(turn) + @staticmethod + def post_init(): + """Perform post initialization operations.""" pre_hostname_change.connect(on_pre_hostname_change) post_hostname_change.connect(on_post_hostname_change) domain_added.connect(on_domain_added) From 3c44fa9a07bce9e27cb80cad251bb2416841bd24 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Nov 2021 12:11:43 -0800 Subject: [PATCH 19/33] gitweb: Split app initialization Tests: - When a public repo is added, upon startup, the front page shortcut is shown. - When all public repos are removed, upon startup, the front page shortcut is not shown. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/gitweb/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plinth/modules/gitweb/__init__.py b/plinth/modules/gitweb/__init__.py index 5a7c44481..2fdc29ee7 100644 --- a/plinth/modules/gitweb/__init__.py +++ b/plinth/modules/gitweb/__init__.py @@ -97,6 +97,8 @@ class GitwebApp(app_module.App): **manifest.backup) self.add(backup_restore) + def post_init(self): + """Perform post initialization operations.""" setup_helper = globals()['setup_helper'] if setup_helper.get_state() != 'needs-setup': self.update_service_access() From fa48fafa6be550493627f39a70f56206c8a53082 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 15 Nov 2021 12:49:48 -0800 Subject: [PATCH 20/33] frontpage: Avoid URL reverse during Shortcut component construction This allows the entire app construction process not to require Django. Tests: - An app with url is None (ejabberd) and one without (transmission) show their on the frontpage. Both shortcuts work as expected. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/frontpage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plinth/frontpage.py b/plinth/frontpage.py index 748730bce..741211158 100644 --- a/plinth/frontpage.py +++ b/plinth/frontpage.py @@ -70,7 +70,7 @@ class Shortcut(app.FollowerComponent): """ super().__init__(component_id) - if not url: + if url is None: url = '?selected={id}'.format(id=component_id) self.name = name From 00e42a42b9d40384c4876d96e5637ddf220e4e37 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 15 Nov 2021 12:51:12 -0800 Subject: [PATCH 21/33] menu: Avoid reversing URL during Menu component construction This allows app initialization to happen without Django being configured. Tests: - Update unit tests. - Visit /app, /system and /help pages. All the icons are listed properly. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/menu.py | 29 ++++++++++++----------- plinth/tests/test_menu.py | 49 +++++++-------------------------------- 2 files changed, 23 insertions(+), 55 deletions(-) diff --git a/plinth/menu.py b/plinth/menu.py index 97c811c7e..cee9bcfc6 100644 --- a/plinth/menu.py +++ b/plinth/menu.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -from django.urls import reverse, reverse_lazy +from django.urls import reverse_lazy from plinth import app @@ -8,7 +8,7 @@ from plinth import app class Menu(app.FollowerComponent): """Component to manage a single menu item.""" - _all_menus = {} + _all_menus = set() def __init__(self, component_id, name=None, short_description=None, icon=None, url_name=None, url_args=None, url_kwargs=None, @@ -57,21 +57,22 @@ class Menu(app.FollowerComponent): self.url = url self.order = order self.advanced = advanced - self.items = [] - # Add self to parent menu item - if parent_url_name: - parent_menu = self.get(parent_url_name) - parent_menu.items.append(self) + self.url_name = url_name + self.url_args = url_args + self.url_kwargs = url_kwargs + self.parent_url_name = parent_url_name - # Add self to global list of menu items - self._all_menus[url] = self + # Add self to global list of menu items. + self._all_menus.add(self) - @classmethod - def get(cls, urlname, url_args=None, url_kwargs=None): - """Return a menu item with given URL name.""" - url = reverse(urlname, args=url_args, kwargs=url_kwargs) - return cls._all_menus[url] + @property + def items(self): + """Return the list of children for this menu item.""" + return [ + item for item in self._all_menus + if item.parent_url_name == self.url_name + ] def sorted_items(self): """Return menu items in sorted order according to current locale.""" diff --git a/plinth/tests/test_menu.py b/plinth/tests/test_menu.py index bc953f87c..6c6e48997 100644 --- a/plinth/tests/test_menu.py +++ b/plinth/tests/test_menu.py @@ -47,20 +47,20 @@ def build_menu(size=5): @pytest.fixture(name='empty_menus', autouse=True) def fixture_empty_menus(): """Remove all menu entries before starting a test.""" - Menu._all_menus = {} + Menu._all_menus = set() -def test_init(): +def test_init(rf): """Verify that main_menu and essential items are created.""" menu_module.init() main_menu = menu_module.main_menu assert isinstance(main_menu, Menu) - apps_menu = main_menu.get('apps') + apps_menu = main_menu.active_item(rf.get('/apps/foo/')) assert apps_menu.icon == 'fa-download' assert str(apps_menu.url) == '/apps/' - system_menu = main_menu.get('system') + system_menu = main_menu.active_item(rf.get('/sys/bar/')) assert system_menu.icon == 'fa-cog' assert str(system_menu.url) == '/sys/' @@ -95,6 +95,7 @@ def test_menu_creation_with_arguments(): expected_icon, url_name, url_kwargs=url_kwargs, parent_url_name='index', order=expected_order, advanced=True) + assert menu.parent_url_name == 'index' assert len(parent_menu.items) == 1 assert parent_menu.items[0] == menu assert expected_name == menu.name @@ -103,46 +104,12 @@ def test_menu_creation_with_arguments(): assert expected_url == menu.url assert expected_order == menu.order assert menu.advanced + assert url_name == menu.url_name + assert menu.url_args is None + assert url_kwargs == menu.url_kwargs assert not menu.items -def test_get(): - """Verify that a menu item can be correctly retrieved.""" - expected_name = 'Name2' - expected_short_description = 'ShortDescription2' - expected_icon = 'Icon2' - expected_url = 'index' - url_name = 'index' - reversed_url = reverse(url_name) - expected_order = 2 - menu = Menu('menu-test', expected_name, expected_short_description, - expected_icon, url_name, order=expected_order, advanced=True) - actual_item = menu.get(expected_url) - - assert actual_item is not None - assert expected_name == actual_item.name - assert expected_short_description == actual_item.short_description - assert expected_icon == actual_item.icon - assert reversed_url == actual_item.url - assert expected_order == actual_item.order - assert actual_item.advanced - assert not actual_item.items - - -def test_get_with_item_not_found(): - """Verify that a KeyError is raised if a menu item is not found.""" - expected_name = 'Name3' - expected_short_description = 'ShortDescription3' - expected_icon = 'Icon3' - url_name = 'index' - expected_order = 3 - menu = Menu('menu-test', expected_name, expected_short_description, - expected_icon, url_name, order=expected_order) - - with pytest.raises(KeyError): - menu.get('apps') - - def test_sort_items(): """Verify that menu items are sorted correctly.""" size = 1000 From abf389aaa1b6aa4a800e76a48b6cf94514e312b1 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 15 Nov 2021 12:54:07 -0800 Subject: [PATCH 22/33] main: Drop initializing Django when listing dependencies - Avoid any potential problems with sqlite3 not being present. - Avoid any potential problems with secret key not being available. Avoid accidentally creating the secret key hardware/container images. Tests: - --list-dependencies works with and without secret key and plinth sqlite3. - --list-dependencies works with plinth and root users. - --list-dependencies does not create the sqlite3 database or the secret key. - Running app works in normal mode and creates the secret key. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/__main__.py | 3 --- plinth/web_framework.py | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index 4ab44f5c0..500250a59 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -108,9 +108,6 @@ def main(): if arguments.list_dependencies is not False: log.default_level = 'ERROR' - web_framework.init(read_only=True) - module_loader.include_urls() - menu.init() module_loader.load_modules() module_loader.apps_init() list_dependencies(arguments.list_dependencies) diff --git a/plinth/web_framework.py b/plinth/web_framework.py index 678012688..9fc8b6433 100644 --- a/plinth/web_framework.py +++ b/plinth/web_framework.py @@ -20,7 +20,7 @@ from . import cfg, glib, log, module_loader, settings logger = logging.getLogger(__name__) -def init(read_only=False): +def init(): """Setup Django configuration in the absence of .settings file""" # Workaround for django-simple-captcha 0.5.6 not being compatible with # Django 3.2. 0.5.14 is almost there in Debian. Workaround only until then. @@ -40,7 +40,7 @@ def init(read_only=False): settings.LANGUAGES = get_languages() settings.LOGGING = log.get_configuration() settings.MESSAGE_TAGS = {message_constants.ERROR: 'danger'} - settings.SECRET_KEY = _get_secret_key(read_only) + settings.SECRET_KEY = _get_secret_key() settings.SESSION_FILE_PATH = os.path.join(cfg.data_dir, 'sessions') settings.STATIC_URL = '/'.join([cfg.server_dir, 'static/']).replace('//', '/') @@ -69,7 +69,7 @@ def post_init(): glib.schedule(24 * 3600, _cleanup_expired_sessions, in_thread=True) -def _get_secret_key(read_only=False): +def _get_secret_key(): """Retrieve or create a new Django secret key.""" secret_key_file = pathlib.Path(cfg.data_dir) / 'django-secret.key' if secret_key_file.exists(): @@ -77,9 +77,6 @@ def _get_secret_key(read_only=False): if len(secret_key) >= 128: return secret_key - if read_only: - return '' - secret_key = _generate_secret_key() # File should be created with permission 0o700 old_umask = os.umask(0o077) From 5c62fc75993262fde15353e7c53bb9e9e99ede5d Mon Sep 17 00:00:00 2001 From: Andrij Mizyk Date: Thu, 18 Nov 2021 11:15:46 +0000 Subject: [PATCH 23/33] Translated using Weblate (Ukrainian) Currently translated at 79.2% (1187 of 1498 strings) --- plinth/locale/uk/LC_MESSAGES/django.po | 30 ++++++++------------------ 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/plinth/locale/uk/LC_MESSAGES/django.po b/plinth/locale/uk/LC_MESSAGES/django.po index 038deb16b..07f71e414 100644 --- a/plinth/locale/uk/LC_MESSAGES/django.po +++ b/plinth/locale/uk/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-08 21:01-0500\n" -"PO-Revision-Date: 2021-10-27 17:08+0000\n" +"PO-Revision-Date: 2021-11-19 11:51+0000\n" "Last-Translator: Andrij Mizyk \n" "Language-Team: Ukrainian \n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.9-dev\n" +"X-Generator: Weblate 4.9.1-dev\n" #: doc/dev/_templates/layout.html:11 msgid "Page source" @@ -2091,16 +2091,14 @@ msgid "Has a TLS certificate" msgstr "Має сертифікат TLS" #: plinth/modules/email_server/forms.py:15 -#, fuzzy -#| msgid "Enter a valid username." msgid "Enter a valid domain" -msgstr "Уведіть коректне імʼя користувача." +msgstr "Уведіть коректний домен" #: plinth/modules/email_server/forms.py:18 #, fuzzy #| msgid "Enter a valid username." msgid "Enter a valid destination" -msgstr "Уведіть коректне імʼя користувача." +msgstr "Уведіть коректне розташування" #: plinth/modules/email_server/forms.py:22 msgid "domain" @@ -2123,10 +2121,8 @@ msgid "Cannot be a number" msgstr "Не може бути числом" #: plinth/modules/email_server/forms.py:76 -#, fuzzy -#| msgid "My Aliases" msgid "Aliases" -msgstr "Мої аліяси" +msgstr "Псевдоніми" #: plinth/modules/email_server/forms.py:88 #: plinth/modules/firewall/templates/firewall.html:54 @@ -2171,16 +2167,12 @@ msgid "You have no email aliases." msgstr "У Вас нема аліясів ел. пошти." #: plinth/modules/email_server/templates/email_alias.html:24 -#, fuzzy -#| msgid "Disabled" msgid "Disable" -msgstr "Вимкнено" +msgstr "Вимкнути" #: plinth/modules/email_server/templates/email_alias.html:26 -#, fuzzy -#| msgid "Enabled" msgid "Enable" -msgstr "Дозволено" +msgstr "Дозволити" #: plinth/modules/email_server/templates/email_alias.html:32 msgid "Create a new email alias" @@ -2198,10 +2190,8 @@ msgid "Domains" msgstr "Домени" #: plinth/modules/email_server/templates/email_server.html:19 -#, fuzzy -#| msgid "Manage Snapshots" msgid "Manage Spam" -msgstr "Керування зрізами" +msgstr "Керування спамом" #: plinth/modules/email_server/templates/email_server.html:30 msgid "Service Alert" @@ -2221,10 +2211,8 @@ msgid "Check syslog for more information" msgstr "Перевірте системний журнал, щоб дізнатися більше" #: plinth/modules/email_server/views.py:217 -#, fuzzy -#| msgid "An error occurred during configuration." msgid "Error updating configuration" -msgstr "Під час налаштування відбулася помилка." +msgstr "Помилка оновлення налаштувань" #: plinth/modules/email_server/views.py:219 plinth/modules/tor/views.py:137 #: plinth/views.py:219 From a912c867c8ba8991ee9d36d7cf762eb48f34ecbb Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Sat, 6 Nov 2021 08:27:39 +0530 Subject: [PATCH 24/33] names: Create a generic TLS domain selection form Signed-off-by: Joseph Nuthalapati Reviewed-by: James Valleroy --- plinth/forms.py | 18 ++++++++++++++++++ plinth/modules/names/__init__.py | 11 +++++++++++ plinth/modules/quassel/__init__.py | 8 +------- plinth/modules/quassel/forms.py | 27 --------------------------- plinth/modules/quassel/views.py | 5 ++--- 5 files changed, 32 insertions(+), 37 deletions(-) delete mode 100644 plinth/modules/quassel/forms.py diff --git a/plinth/forms.py b/plinth/forms.py index 5bf5e739f..c783b99b7 100644 --- a/plinth/forms.py +++ b/plinth/forms.py @@ -39,6 +39,24 @@ class DomainSelectionForm(forms.Form): 'changed later.'), choices=[]) +class TLSDomainForm(forms.Form): + """Form to select a TLS domain for an app.""" + + def get_domain_choices(): + """Double domain entries for inclusion in the choice field.""" + from plinth.modules.names import get_available_tls_domains + return ((domain, domain) for domain in get_available_tls_domains()) + + domain = forms.ChoiceField( + choices=get_domain_choices(), + label=_('TLS domain'), + help_text=_( + 'Select a domain to use TLS with. If the list is empty, please ' + 'configure at least one domain with certificates.'), + required=False, + ) + + class LanguageSelectionFormMixin: """Form mixin for selecting the user's preferred language.""" diff --git a/plinth/modules/names/__init__.py b/plinth/modules/names/__init__.py index f6aa8e2ae..7ca071ceb 100644 --- a/plinth/modules/names/__init__.py +++ b/plinth/modules/names/__init__.py @@ -93,3 +93,14 @@ def on_domain_removed(sender, domain_type, name='', **kwargs): logger.info('Remove domain %s of type %s', domain_name.name, domain_type) + + +###################################################### +# Domain utilities meant to be used by other modules # +###################################################### + + +def get_available_tls_domains(): + """Return an iterator with all domains able to have a certificate.""" + return (domain.name for domain in components.DomainName.list() + if domain.domain_type.can_have_certificate) diff --git a/plinth/modules/quassel/__init__.py b/plinth/modules/quassel/__init__.py index f9a0333f6..1f7c03a93 100644 --- a/plinth/modules/quassel/__init__.py +++ b/plinth/modules/quassel/__init__.py @@ -114,12 +114,6 @@ def setup(helper, old_version=None): app.get_component('letsencrypt-quassel').setup_certificates() -def get_available_domains(): - """Return an iterator with all domains able to have a certificate.""" - return (domain.name for domain in names.components.DomainName.list() - if domain.domain_type.can_have_certificate) - - def set_domain(domain): """Set the TLS domain by writing a file to data directory.""" if domain: @@ -136,7 +130,7 @@ def get_domain(): pass if not domain: - domain = next(get_available_domains(), None) + domain = next(names.get_available_tls_domains(), None) set_domain(domain) return domain diff --git a/plinth/modules/quassel/forms.py b/plinth/modules/quassel/forms.py deleted file mode 100644 index 72eef7e3d..000000000 --- a/plinth/modules/quassel/forms.py +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -""" -Forms for Quassel app. -""" - -from django import forms -from django.utils.translation import gettext_lazy as _ - -from plinth.modules import quassel - - -def get_domain_choices(): - """Double domain entries for inclusion in the choice field.""" - return ((domain, domain) for domain in quassel.get_available_domains()) - - -class QuasselForm(forms.Form): - """Form to select a TLS domain for Quassel.""" - - domain = forms.ChoiceField( - choices=get_domain_choices, - label=_('TLS domain'), - help_text=_( - 'Select a domain to use TLS with. If the list is empty, please ' - 'configure at least one domain with certificates.'), - required=False, - ) diff --git a/plinth/modules/quassel/views.py b/plinth/modules/quassel/views.py index a5e671d0b..90d2ca56b 100644 --- a/plinth/modules/quassel/views.py +++ b/plinth/modules/quassel/views.py @@ -3,15 +3,14 @@ from django.contrib import messages from django.utils.translation import gettext_lazy as _ +from plinth.forms import TLSDomainForm from plinth.modules import quassel from plinth.views import AppView -from .forms import QuasselForm - class QuasselAppView(AppView): app_id = 'quassel' - form_class = QuasselForm + form_class = TLSDomainForm def get_initial(self): """Return the values to fill in the form.""" From aaea6bf00ef7092ce5caf77b880e474df5240367 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Sat, 6 Nov 2021 09:50:32 +0530 Subject: [PATCH 25/33] tt-rss: Allow selection of a domain name Fixes: #2136 Signed-off-by: Joseph Nuthalapati [james: Fix comment] Signed-off-by: James Valleroy Reviewed-by: James Valleroy --- actions/ttrss | 34 +++++++++++++++++++++++++++++--- plinth/modules/ttrss/__init__.py | 18 +++++++++++++++++ plinth/modules/ttrss/urls.py | 6 ++---- plinth/modules/ttrss/views.py | 28 ++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 plinth/modules/ttrss/views.py diff --git a/actions/ttrss b/actions/ttrss index 5867b7543..e54fa6ef3 100755 --- a/actions/ttrss +++ b/actions/ttrss @@ -29,6 +29,13 @@ def parse_arguments(): subparsers.add_parser('dump-database', help='Dump database to file') subparsers.add_parser('restore-database', help='Restore database from file') + subparsers.add_parser('get-domain', + help='Get the domain set for Tiny Tiny RSS.') + set_domain = subparsers.add_parser( + 'set-domain', help='Set the domain to be used by Tiny Tiny RSS.') + set_domain.add_argument( + 'domain_name', + help='The domain name that will be used by Tiny Tiny RSS.') subparsers.required = True return parser.parse_args() @@ -40,6 +47,29 @@ def subcommand_pre_setup(_): ['tt-rss tt-rss/database-type string pgsql']) +def subcommand_get_domain(_): + """Get the domain set for Tiny Tiny RSS.""" + aug = load_augeas() + + from urllib.parse import urlparse + for match in aug.match('/files' + CONFIG_FILE + '/define'): + if aug.get(match) == 'SELF_URL_PATH': + url = aug.get(match + '/value').strip("'") + print(urlparse(url).netloc) + + +def subcommand_set_domain(args): + """Set the domain to be used by Tiny Tiny RSS.""" + url = f"'https://{args.domain_name}/tt-rss/'" + aug = load_augeas() + + for match in aug.match('/files' + CONFIG_FILE + '/define'): + if aug.get(match) == 'SELF_URL_PATH': + aug.set(match + '/value', url) + + aug.save() + + def subcommand_setup(_): """Setup Tiny Tiny RSS configuration.""" aug = load_augeas() @@ -49,9 +79,7 @@ def subcommand_setup(_): skip_self_url_path_exists = False for match in aug.match('/files' + CONFIG_FILE + '/define'): - if aug.get(match) == 'SELF_URL_PATH': - aug.set(match + '/value', "'http://localhost/tt-rss/'") - elif aug.get(match) == 'PLUGINS': + if aug.get(match) == 'PLUGINS': aug.set(match + '/value', "'auth_remote, note'") elif aug.get(match) == '_SKIP_SELF_URL_PATH_CHECKS': skip_self_url_path_exists = True diff --git a/plinth/modules/ttrss/__init__.py b/plinth/modules/ttrss/__init__.py index 40d7ea7cb..1ae8a73c0 100644 --- a/plinth/modules/ttrss/__init__.py +++ b/plinth/modules/ttrss/__init__.py @@ -102,6 +102,13 @@ class TTRSSApp(app_module.App): super().enable() actions.superuser_run('ttrss', ['enable-api-access']) + # Try to set the domain to one of the available TLS domains + domain = get_domain() + if not domain or domain == 'localhost': + from plinth.modules import names + domain = next(names.get_available_tls_domains(), None) + set_domain(domain) + class TTRSSBackupRestore(BackupRestore): """Component to backup/restore TT-RSS""" @@ -136,3 +143,14 @@ def force_upgrade(helper, packages): helper.install(['tt-rss'], force_configuration='new') actions.superuser_run('ttrss', ['setup']) return True + + +def get_domain(): + """Read TLS domain from tt-rss config file.""" + return actions.superuser_run('ttrss', ['get-domain']).strip() + + +def set_domain(domain): + """Set the TLS domain in tt-rss configuration file.""" + if domain: + actions.superuser_run('ttrss', ['set-domain', domain]) diff --git a/plinth/modules/ttrss/urls.py b/plinth/modules/ttrss/urls.py index 310722a56..737e9dea1 100644 --- a/plinth/modules/ttrss/urls.py +++ b/plinth/modules/ttrss/urls.py @@ -5,8 +5,6 @@ URLs for the Tiny Tiny RSS module. from django.urls import re_path -from plinth.views import AppView +from .views import TTRSSAppView -urlpatterns = [ - re_path(r'^apps/ttrss/$', AppView.as_view(app_id='ttrss'), name='index') -] +urlpatterns = [re_path(r'^apps/ttrss/$', TTRSSAppView.as_view(), name='index')] diff --git a/plinth/modules/ttrss/views.py b/plinth/modules/ttrss/views.py new file mode 100644 index 000000000..c71be5ae0 --- /dev/null +++ b/plinth/modules/ttrss/views.py @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later + +from django.contrib import messages +from django.utils.translation import gettext_lazy as _ + +from plinth.forms import TLSDomainForm +from plinth.modules import ttrss +from plinth.views import AppView + + +class TTRSSAppView(AppView): + app_id = 'ttrss' + form_class = TLSDomainForm + + def get_initial(self): + """Return the values to fill in the form.""" + initial = super().get_initial() + initial['domain'] = ttrss.get_domain() + return initial + + def form_valid(self, form): + """Change the domain of TT-RSS app.""" + data = form.cleaned_data + if ttrss.get_domain() != data['domain']: + ttrss.set_domain(data['domain']) + messages.success(self.request, _('Configuration updated')) + + return super().form_valid(form) From 122bda7f7eb12ffc341847e7657d8ecdb56ce3a1 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 13 Nov 2021 07:16:11 -0500 Subject: [PATCH 26/33] debian: Fail build if no module dependencies found debian/rules uses --list-dependencies to collect the dependencies of all essential modules. Ensure that the list is not empty. Helps #2149. Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index a99ef4c7f..422282dca 100755 --- a/debian/rules +++ b/debian/rules @@ -10,6 +10,8 @@ override_dh_auto_install-indep: dh_auto_install ./run --develop --list-dependencies | sort | tr '\n' ', ' | \ sed -e 's/^/freedombox:Depends=/' >> debian/freedombox.substvars + # Ensure the list of dependencies is not empty. + test -s debian/freedombox.substvars || exit 1 # pybuild can run pytest. However, when the top level directory is included in # the path (done using manage.py), it results in import problems. From bec080ec90aa6aee717f30a9025fec3264bc9115 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Thu, 18 Nov 2021 09:38:48 -0500 Subject: [PATCH 27/33] datetime: Avoid error when systemctl is not available This situation happens when building the package with cowbuilder. Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- plinth/modules/datetime/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plinth/modules/datetime/__init__.py b/plinth/modules/datetime/__init__.py index 486d2ad9a..7110aedd5 100644 --- a/plinth/modules/datetime/__init__.py +++ b/plinth/modules/datetime/__init__.py @@ -54,7 +54,7 @@ class DateTimeApp(app_module.App): '--value', 'systemd-timesyncd' ]) self._time_managed = 'yes' in output.decode() - except subprocess.CalledProcessError: + except (FileNotFoundError, subprocess.CalledProcessError): # When systemd is not running. self._time_managed = False From 18bf1062a8fd5ff1bba279f7a868e51d4aa45389 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Mon, 22 Nov 2021 18:18:37 -0500 Subject: [PATCH 28/33] locale: Update translation strings Signed-off-by: James Valleroy --- plinth/locale/ar_SA/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/bg/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/bn/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/cs/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/da/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/de/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/django.pot | 157 ++++++++++--------- plinth/locale/el/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/es/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/fa/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/fake/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/fr/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/gl/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/gu/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/hi/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/hu/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/id/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/it/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/ja/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/kn/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/lt/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/nb/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/nl/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/pl/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/pt/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/ru/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/si/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/sl/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/sq/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/sr/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/sv/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/ta/LC_MESSAGES/django.po | 157 ++++++++++--------- plinth/locale/te/LC_MESSAGES/django.po | 165 ++++++++++---------- plinth/locale/tr/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/uk/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/vi/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/zh_Hans/LC_MESSAGES/django.po | 161 +++++++++---------- plinth/locale/zh_Hant/LC_MESSAGES/django.po | 157 ++++++++++--------- 38 files changed, 3046 insertions(+), 3008 deletions(-) diff --git a/plinth/locale/ar_SA/LC_MESSAGES/django.po b/plinth/locale/ar_SA/LC_MESSAGES/django.po index c81c09993..8218f0855 100644 --- a/plinth/locale/ar_SA/LC_MESSAGES/django.po +++ b/plinth/locale/ar_SA/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-08 21:01-0500\n" +"POT-Creation-Date: 2021-11-22 18:17-0500\n" "PO-Revision-Date: 2020-06-10 15:41+0000\n" "Last-Translator: aiman an \n" "Language-Team: Arabic (Saudi Arabia) \n" "Language-Team: Bulgarian \n" "Language-Team: Bengali \n" "Language-Team: Czech \n" "Language-Team: Danish \n" "Language-Team: German \n" "Language-Team: LANGUAGE \n" @@ -60,15 +60,27 @@ msgid "" "later." msgstr "" -#: plinth/forms.py:46 +#: plinth/forms.py:52 plinth/modules/coturn/forms.py:30 +#: plinth/modules/mumble/forms.py:21 +msgid "TLS domain" +msgstr "" + +#: plinth/forms.py:54 plinth/modules/coturn/forms.py:32 +#: plinth/modules/mumble/forms.py:23 +msgid "" +"Select a domain to use TLS with. If the list is empty, please configure at " +"least one domain with certificates." +msgstr "" + +#: plinth/forms.py:64 msgid "Language" msgstr "" -#: plinth/forms.py:47 +#: plinth/forms.py:65 msgid "Language to use for presenting this web interface" msgstr "" -#: plinth/forms.py:54 +#: plinth/forms.py:72 msgid "Use the language preference set in the browser" msgstr "" @@ -134,36 +146,36 @@ msgstr "" msgid "Backups allows creating and managing backup archives." msgstr "" -#: plinth/modules/backups/__init__.py:56 plinth/modules/backups/__init__.py:205 -#: plinth/modules/backups/__init__.py:250 +#: plinth/modules/backups/__init__.py:56 plinth/modules/backups/__init__.py:208 +#: plinth/modules/backups/__init__.py:253 msgid "Backups" msgstr "" -#: plinth/modules/backups/__init__.py:202 +#: plinth/modules/backups/__init__.py:205 msgid "" "Enable an automatic backup schedule for data safety. Prefer an encrypted " "remote backup location or an extra attached disk." msgstr "" -#: plinth/modules/backups/__init__.py:208 +#: plinth/modules/backups/__init__.py:211 msgid "Enable a Backup Schedule" msgstr "" -#: plinth/modules/backups/__init__.py:212 -#: plinth/modules/backups/__init__.py:259 -#: plinth/modules/storage/__init__.py:328 +#: plinth/modules/backups/__init__.py:215 +#: plinth/modules/backups/__init__.py:262 +#: plinth/modules/storage/__init__.py:331 #, python-brace-format msgid "Go to {app_name}" msgstr "" -#: plinth/modules/backups/__init__.py:247 +#: plinth/modules/backups/__init__.py:250 #, python-brace-format msgid "" "A scheduled backup failed. Past {error_count} attempts for backup did not " "succeed. The latest error is: {error_message}" msgstr "" -#: plinth/modules/backups/__init__.py:255 +#: plinth/modules/backups/__init__.py:258 msgid "Error During Backup" msgstr "" @@ -924,9 +936,10 @@ msgstr "" #: plinth/modules/deluge/views.py:42 plinth/modules/dynamicdns/views.py:169 #: plinth/modules/ejabberd/views.py:85 plinth/modules/email_server/views.py:214 #: plinth/modules/matrixsynapse/views.py:124 plinth/modules/mumble/views.py:28 -#: plinth/modules/pagekite/forms.py:78 plinth/modules/quassel/views.py:29 +#: plinth/modules/pagekite/forms.py:78 plinth/modules/quassel/views.py:28 #: plinth/modules/shadowsocks/views.py:59 -#: plinth/modules/transmission/views.py:47 plinth/modules/wordpress/views.py:37 +#: plinth/modules/transmission/views.py:47 plinth/modules/ttrss/views.py:26 +#: plinth/modules/wordpress/views.py:37 msgid "Configuration updated" msgstr "" @@ -1241,18 +1254,6 @@ msgstr "" msgid "Invalid list of STUN/TURN Server URIs" msgstr "" -#: plinth/modules/coturn/forms.py:30 plinth/modules/mumble/forms.py:21 -#: plinth/modules/quassel/forms.py:22 -msgid "TLS domain" -msgstr "" - -#: plinth/modules/coturn/forms.py:32 plinth/modules/mumble/forms.py:23 -#: plinth/modules/quassel/forms.py:24 -msgid "" -"Select a domain to use TLS with. If the list is empty, please configure at " -"least one domain with certificates." -msgstr "" - #: plinth/modules/coturn/templates/coturn.html:15 msgid "Use the following URLs to configure your communication server:" msgstr "" @@ -1337,58 +1338,58 @@ msgid "" msgstr "" #: plinth/modules/diagnostics/__init__.py:54 -#: plinth/modules/diagnostics/__init__.py:238 +#: plinth/modules/diagnostics/__init__.py:241 msgid "Diagnostics" msgstr "" -#: plinth/modules/diagnostics/__init__.py:98 +#: plinth/modules/diagnostics/__init__.py:101 #: plinth/modules/email_server/templates/email_server.html:41 msgid "passed" msgstr "" -#: plinth/modules/diagnostics/__init__.py:99 +#: plinth/modules/diagnostics/__init__.py:102 #: plinth/modules/email_server/templates/email_server.html:39 #: plinth/modules/networks/views.py:49 msgid "failed" msgstr "" -#: plinth/modules/diagnostics/__init__.py:100 +#: plinth/modules/diagnostics/__init__.py:103 #: plinth/modules/email_server/templates/email_server.html:37 msgid "error" msgstr "" -#: plinth/modules/diagnostics/__init__.py:101 +#: plinth/modules/diagnostics/__init__.py:104 msgid "warning" msgstr "" #. Translators: This is the unit of computer storage Mebibyte similar to #. Megabyte. -#: plinth/modules/diagnostics/__init__.py:204 +#: plinth/modules/diagnostics/__init__.py:207 msgid "MiB" msgstr "" #. Translators: This is the unit of computer storage Gibibyte similar to #. Gigabyte. -#: plinth/modules/diagnostics/__init__.py:209 +#: plinth/modules/diagnostics/__init__.py:212 msgid "GiB" msgstr "" -#: plinth/modules/diagnostics/__init__.py:216 +#: plinth/modules/diagnostics/__init__.py:219 msgid "You should disable some apps to reduce memory usage." msgstr "" -#: plinth/modules/diagnostics/__init__.py:221 +#: plinth/modules/diagnostics/__init__.py:224 msgid "You should not install any new apps on this system." msgstr "" -#: plinth/modules/diagnostics/__init__.py:233 +#: plinth/modules/diagnostics/__init__.py:236 #, no-python-format, python-brace-format msgid "" "System is low on memory: {percent_used}% used, {memory_available} " "{memory_available_unit} free. {advice_message}" msgstr "" -#: plinth/modules/diagnostics/__init__.py:235 +#: plinth/modules/diagnostics/__init__.py:238 msgid "Low Memory" msgstr "" @@ -1861,7 +1862,7 @@ msgstr "" msgid "Email Server" msgstr "" -#: plinth/modules/email_server/__init__.py:99 +#: plinth/modules/email_server/__init__.py:95 msgid "Powered by Postfix, Dovecot & Rspamd" msgstr "" @@ -2779,7 +2780,7 @@ msgstr "" msgid "Certificates" msgstr "" -#: plinth/modules/letsencrypt/__init__.py:101 +#: plinth/modules/letsencrypt/__init__.py:104 msgid "Cannot test: No domains are configured." msgstr "" @@ -5803,104 +5804,104 @@ msgid "" "media, expand the root partition etc." msgstr "" -#: plinth/modules/storage/__init__.py:55 plinth/modules/storage/__init__.py:321 -#: plinth/modules/storage/__init__.py:352 +#: plinth/modules/storage/__init__.py:55 plinth/modules/storage/__init__.py:324 +#: plinth/modules/storage/__init__.py:355 msgid "Storage" msgstr "" -#: plinth/modules/storage/__init__.py:215 +#: plinth/modules/storage/__init__.py:218 #, python-brace-format msgid "{disk_size:.1f} bytes" msgstr "" -#: plinth/modules/storage/__init__.py:219 +#: plinth/modules/storage/__init__.py:222 #, python-brace-format msgid "{disk_size:.1f} KiB" msgstr "" -#: plinth/modules/storage/__init__.py:223 +#: plinth/modules/storage/__init__.py:226 #, python-brace-format msgid "{disk_size:.1f} MiB" msgstr "" -#: plinth/modules/storage/__init__.py:227 +#: plinth/modules/storage/__init__.py:230 #, python-brace-format msgid "{disk_size:.1f} GiB" msgstr "" -#: plinth/modules/storage/__init__.py:230 +#: plinth/modules/storage/__init__.py:233 #, python-brace-format msgid "{disk_size:.1f} TiB" msgstr "" -#: plinth/modules/storage/__init__.py:242 +#: plinth/modules/storage/__init__.py:245 msgid "The operation failed." msgstr "" -#: plinth/modules/storage/__init__.py:244 +#: plinth/modules/storage/__init__.py:247 msgid "The operation was cancelled." msgstr "" -#: plinth/modules/storage/__init__.py:246 +#: plinth/modules/storage/__init__.py:249 msgid "The device is already unmounting." msgstr "" -#: plinth/modules/storage/__init__.py:248 +#: plinth/modules/storage/__init__.py:251 msgid "The operation is not supported due to missing driver/tool support." msgstr "" -#: plinth/modules/storage/__init__.py:251 +#: plinth/modules/storage/__init__.py:254 msgid "The operation timed out." msgstr "" -#: plinth/modules/storage/__init__.py:253 +#: plinth/modules/storage/__init__.py:256 msgid "The operation would wake up a disk that is in a deep-sleep state." msgstr "" -#: plinth/modules/storage/__init__.py:256 +#: plinth/modules/storage/__init__.py:259 msgid "Attempting to unmount a device that is busy." msgstr "" -#: plinth/modules/storage/__init__.py:258 +#: plinth/modules/storage/__init__.py:261 msgid "The operation has already been cancelled." msgstr "" -#: plinth/modules/storage/__init__.py:260 -#: plinth/modules/storage/__init__.py:262 -#: plinth/modules/storage/__init__.py:264 +#: plinth/modules/storage/__init__.py:263 +#: plinth/modules/storage/__init__.py:265 +#: plinth/modules/storage/__init__.py:267 msgid "Not authorized to perform the requested operation." msgstr "" -#: plinth/modules/storage/__init__.py:266 +#: plinth/modules/storage/__init__.py:269 msgid "The device is already mounted." msgstr "" -#: plinth/modules/storage/__init__.py:268 +#: plinth/modules/storage/__init__.py:271 msgid "The device is not mounted." msgstr "" -#: plinth/modules/storage/__init__.py:270 +#: plinth/modules/storage/__init__.py:273 msgid "Not permitted to use the requested option." msgstr "" -#: plinth/modules/storage/__init__.py:272 +#: plinth/modules/storage/__init__.py:275 msgid "The device is mounted by another user." msgstr "" -#: plinth/modules/storage/__init__.py:316 +#: plinth/modules/storage/__init__.py:319 #, no-python-format, python-brace-format msgid "Low space on system partition: {percent_used}% used, {free_space} free." msgstr "" -#: plinth/modules/storage/__init__.py:318 +#: plinth/modules/storage/__init__.py:321 msgid "Low disk space" msgstr "" -#: plinth/modules/storage/__init__.py:346 +#: plinth/modules/storage/__init__.py:349 msgid "Disk failure imminent" msgstr "" -#: plinth/modules/storage/__init__.py:348 +#: plinth/modules/storage/__init__.py:351 #, python-brace-format msgid "" "Disk {id} is reporting that it is likely to fail in the near future. Copy " @@ -6127,24 +6128,24 @@ msgstr "" msgid "Tor Bridge Relay" msgstr "" -#: plinth/modules/tor/__init__.py:121 +#: plinth/modules/tor/__init__.py:123 msgid "Tor relay port available" msgstr "" -#: plinth/modules/tor/__init__.py:131 +#: plinth/modules/tor/__init__.py:133 msgid "Obfs3 transport registered" msgstr "" -#: plinth/modules/tor/__init__.py:141 +#: plinth/modules/tor/__init__.py:143 msgid "Obfs4 transport registered" msgstr "" -#: plinth/modules/tor/__init__.py:210 +#: plinth/modules/tor/__init__.py:212 #, python-brace-format msgid "Access URL {url} on tcp{kind} via Tor" msgstr "" -#: plinth/modules/tor/__init__.py:221 +#: plinth/modules/tor/__init__.py:223 #, python-brace-format msgid "Confirm Tor usage at {url} on tcp{kind}" msgstr "" @@ -6345,30 +6346,30 @@ msgstr "" msgid "Update" msgstr "" -#: plinth/modules/upgrades/__init__.py:127 +#: plinth/modules/upgrades/__init__.py:129 msgid "Updates" msgstr "" -#: plinth/modules/upgrades/__init__.py:130 +#: plinth/modules/upgrades/__init__.py:132 msgid "FreedomBox Updated" msgstr "" -#: plinth/modules/upgrades/__init__.py:215 +#: plinth/modules/upgrades/__init__.py:217 msgid "Could not start distribution update" msgstr "" -#: plinth/modules/upgrades/__init__.py:217 +#: plinth/modules/upgrades/__init__.py:219 msgid "" "There is not enough free space in the root partition to start the " "distribution update. Please ensure at least 5 GB is free. Distribution " "update will be retried after 24 hours, if enabled." msgstr "" -#: plinth/modules/upgrades/__init__.py:228 +#: plinth/modules/upgrades/__init__.py:230 msgid "Distribution update started" msgstr "" -#: plinth/modules/upgrades/__init__.py:230 +#: plinth/modules/upgrades/__init__.py:232 msgid "" "Started update to next stable release. This may take a long time to complete." msgstr "" @@ -7547,6 +7548,6 @@ msgstr "" msgid "%(percentage)s%% complete" msgstr "" -#: plinth/web_framework.py:117 +#: plinth/web_framework.py:114 msgid "Gujarati" msgstr "" diff --git a/plinth/locale/el/LC_MESSAGES/django.po b/plinth/locale/el/LC_MESSAGES/django.po index e954285be..7aefed775 100644 --- a/plinth/locale/el/LC_MESSAGES/django.po +++ b/plinth/locale/el/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-08 21:01-0500\n" +"POT-Creation-Date: 2021-11-22 18:17-0500\n" "PO-Revision-Date: 2021-04-14 04:27+0000\n" "Last-Translator: Michalis \n" "Language-Team: Greek \n" "Language-Team: Spanish \n" "Language-Team: Persian \n" "Language-Team: Plinth Developers \n" "Language-Team: French \n" "Language-Team: Galician \n" "Language-Team: Gujarati \n" "Language-Team: Hindi \n" "Language-Team: Hungarian \n" "Language-Team: Indonesian \n" "Language-Team: Italian \n" "Language-Team: Japanese \n" "Language-Team: Kannada \n" "Language-Team: Lithuanian \n" "Language-Team: Norwegian Bokmål \n" "Language-Team: Dutch \n" "Language-Team: Polish \n" "Language-Team: Portuguese \n" "Language-Team: Russian \n" "Language-Team: Sinhala \n" "Language-Team: Slovenian \n" "Language-Team: Albanian \n" "Language-Team: Serbian \n" "Language-Team: Swedish \n" "Language-Team: LANGUAGE \n" @@ -61,15 +61,27 @@ msgid "" "later." msgstr "" -#: plinth/forms.py:46 +#: plinth/forms.py:52 plinth/modules/coturn/forms.py:30 +#: plinth/modules/mumble/forms.py:21 +msgid "TLS domain" +msgstr "" + +#: plinth/forms.py:54 plinth/modules/coturn/forms.py:32 +#: plinth/modules/mumble/forms.py:23 +msgid "" +"Select a domain to use TLS with. If the list is empty, please configure at " +"least one domain with certificates." +msgstr "" + +#: plinth/forms.py:64 msgid "Language" msgstr "" -#: plinth/forms.py:47 +#: plinth/forms.py:65 msgid "Language to use for presenting this web interface" msgstr "" -#: plinth/forms.py:54 +#: plinth/forms.py:72 msgid "Use the language preference set in the browser" msgstr "" @@ -135,36 +147,36 @@ msgstr "" msgid "Backups allows creating and managing backup archives." msgstr "" -#: plinth/modules/backups/__init__.py:56 plinth/modules/backups/__init__.py:205 -#: plinth/modules/backups/__init__.py:250 +#: plinth/modules/backups/__init__.py:56 plinth/modules/backups/__init__.py:208 +#: plinth/modules/backups/__init__.py:253 msgid "Backups" msgstr "" -#: plinth/modules/backups/__init__.py:202 +#: plinth/modules/backups/__init__.py:205 msgid "" "Enable an automatic backup schedule for data safety. Prefer an encrypted " "remote backup location or an extra attached disk." msgstr "" -#: plinth/modules/backups/__init__.py:208 +#: plinth/modules/backups/__init__.py:211 msgid "Enable a Backup Schedule" msgstr "" -#: plinth/modules/backups/__init__.py:212 -#: plinth/modules/backups/__init__.py:259 -#: plinth/modules/storage/__init__.py:328 +#: plinth/modules/backups/__init__.py:215 +#: plinth/modules/backups/__init__.py:262 +#: plinth/modules/storage/__init__.py:331 #, python-brace-format msgid "Go to {app_name}" msgstr "" -#: plinth/modules/backups/__init__.py:247 +#: plinth/modules/backups/__init__.py:250 #, python-brace-format msgid "" "A scheduled backup failed. Past {error_count} attempts for backup did not " "succeed. The latest error is: {error_message}" msgstr "" -#: plinth/modules/backups/__init__.py:255 +#: plinth/modules/backups/__init__.py:258 msgid "Error During Backup" msgstr "" @@ -925,9 +937,10 @@ msgstr "" #: plinth/modules/deluge/views.py:42 plinth/modules/dynamicdns/views.py:169 #: plinth/modules/ejabberd/views.py:85 plinth/modules/email_server/views.py:214 #: plinth/modules/matrixsynapse/views.py:124 plinth/modules/mumble/views.py:28 -#: plinth/modules/pagekite/forms.py:78 plinth/modules/quassel/views.py:29 +#: plinth/modules/pagekite/forms.py:78 plinth/modules/quassel/views.py:28 #: plinth/modules/shadowsocks/views.py:59 -#: plinth/modules/transmission/views.py:47 plinth/modules/wordpress/views.py:37 +#: plinth/modules/transmission/views.py:47 plinth/modules/ttrss/views.py:26 +#: plinth/modules/wordpress/views.py:37 msgid "Configuration updated" msgstr "" @@ -1242,18 +1255,6 @@ msgstr "" msgid "Invalid list of STUN/TURN Server URIs" msgstr "" -#: plinth/modules/coturn/forms.py:30 plinth/modules/mumble/forms.py:21 -#: plinth/modules/quassel/forms.py:22 -msgid "TLS domain" -msgstr "" - -#: plinth/modules/coturn/forms.py:32 plinth/modules/mumble/forms.py:23 -#: plinth/modules/quassel/forms.py:24 -msgid "" -"Select a domain to use TLS with. If the list is empty, please configure at " -"least one domain with certificates." -msgstr "" - #: plinth/modules/coturn/templates/coturn.html:15 msgid "Use the following URLs to configure your communication server:" msgstr "" @@ -1338,58 +1339,58 @@ msgid "" msgstr "" #: plinth/modules/diagnostics/__init__.py:54 -#: plinth/modules/diagnostics/__init__.py:238 +#: plinth/modules/diagnostics/__init__.py:241 msgid "Diagnostics" msgstr "" -#: plinth/modules/diagnostics/__init__.py:98 +#: plinth/modules/diagnostics/__init__.py:101 #: plinth/modules/email_server/templates/email_server.html:41 msgid "passed" msgstr "" -#: plinth/modules/diagnostics/__init__.py:99 +#: plinth/modules/diagnostics/__init__.py:102 #: plinth/modules/email_server/templates/email_server.html:39 #: plinth/modules/networks/views.py:49 msgid "failed" msgstr "" -#: plinth/modules/diagnostics/__init__.py:100 +#: plinth/modules/diagnostics/__init__.py:103 #: plinth/modules/email_server/templates/email_server.html:37 msgid "error" msgstr "" -#: plinth/modules/diagnostics/__init__.py:101 +#: plinth/modules/diagnostics/__init__.py:104 msgid "warning" msgstr "" #. Translators: This is the unit of computer storage Mebibyte similar to #. Megabyte. -#: plinth/modules/diagnostics/__init__.py:204 +#: plinth/modules/diagnostics/__init__.py:207 msgid "MiB" msgstr "" #. Translators: This is the unit of computer storage Gibibyte similar to #. Gigabyte. -#: plinth/modules/diagnostics/__init__.py:209 +#: plinth/modules/diagnostics/__init__.py:212 msgid "GiB" msgstr "" -#: plinth/modules/diagnostics/__init__.py:216 +#: plinth/modules/diagnostics/__init__.py:219 msgid "You should disable some apps to reduce memory usage." msgstr "" -#: plinth/modules/diagnostics/__init__.py:221 +#: plinth/modules/diagnostics/__init__.py:224 msgid "You should not install any new apps on this system." msgstr "" -#: plinth/modules/diagnostics/__init__.py:233 +#: plinth/modules/diagnostics/__init__.py:236 #, no-python-format, python-brace-format msgid "" "System is low on memory: {percent_used}% used, {memory_available} " "{memory_available_unit} free. {advice_message}" msgstr "" -#: plinth/modules/diagnostics/__init__.py:235 +#: plinth/modules/diagnostics/__init__.py:238 msgid "Low Memory" msgstr "" @@ -1862,7 +1863,7 @@ msgstr "" msgid "Email Server" msgstr "" -#: plinth/modules/email_server/__init__.py:99 +#: plinth/modules/email_server/__init__.py:95 msgid "Powered by Postfix, Dovecot & Rspamd" msgstr "" @@ -2780,7 +2781,7 @@ msgstr "" msgid "Certificates" msgstr "" -#: plinth/modules/letsencrypt/__init__.py:101 +#: plinth/modules/letsencrypt/__init__.py:104 msgid "Cannot test: No domains are configured." msgstr "" @@ -5804,104 +5805,104 @@ msgid "" "media, expand the root partition etc." msgstr "" -#: plinth/modules/storage/__init__.py:55 plinth/modules/storage/__init__.py:321 -#: plinth/modules/storage/__init__.py:352 +#: plinth/modules/storage/__init__.py:55 plinth/modules/storage/__init__.py:324 +#: plinth/modules/storage/__init__.py:355 msgid "Storage" msgstr "" -#: plinth/modules/storage/__init__.py:215 +#: plinth/modules/storage/__init__.py:218 #, python-brace-format msgid "{disk_size:.1f} bytes" msgstr "" -#: plinth/modules/storage/__init__.py:219 +#: plinth/modules/storage/__init__.py:222 #, python-brace-format msgid "{disk_size:.1f} KiB" msgstr "" -#: plinth/modules/storage/__init__.py:223 +#: plinth/modules/storage/__init__.py:226 #, python-brace-format msgid "{disk_size:.1f} MiB" msgstr "" -#: plinth/modules/storage/__init__.py:227 +#: plinth/modules/storage/__init__.py:230 #, python-brace-format msgid "{disk_size:.1f} GiB" msgstr "" -#: plinth/modules/storage/__init__.py:230 +#: plinth/modules/storage/__init__.py:233 #, python-brace-format msgid "{disk_size:.1f} TiB" msgstr "" -#: plinth/modules/storage/__init__.py:242 +#: plinth/modules/storage/__init__.py:245 msgid "The operation failed." msgstr "" -#: plinth/modules/storage/__init__.py:244 +#: plinth/modules/storage/__init__.py:247 msgid "The operation was cancelled." msgstr "" -#: plinth/modules/storage/__init__.py:246 +#: plinth/modules/storage/__init__.py:249 msgid "The device is already unmounting." msgstr "" -#: plinth/modules/storage/__init__.py:248 +#: plinth/modules/storage/__init__.py:251 msgid "The operation is not supported due to missing driver/tool support." msgstr "" -#: plinth/modules/storage/__init__.py:251 +#: plinth/modules/storage/__init__.py:254 msgid "The operation timed out." msgstr "" -#: plinth/modules/storage/__init__.py:253 +#: plinth/modules/storage/__init__.py:256 msgid "The operation would wake up a disk that is in a deep-sleep state." msgstr "" -#: plinth/modules/storage/__init__.py:256 +#: plinth/modules/storage/__init__.py:259 msgid "Attempting to unmount a device that is busy." msgstr "" -#: plinth/modules/storage/__init__.py:258 +#: plinth/modules/storage/__init__.py:261 msgid "The operation has already been cancelled." msgstr "" -#: plinth/modules/storage/__init__.py:260 -#: plinth/modules/storage/__init__.py:262 -#: plinth/modules/storage/__init__.py:264 +#: plinth/modules/storage/__init__.py:263 +#: plinth/modules/storage/__init__.py:265 +#: plinth/modules/storage/__init__.py:267 msgid "Not authorized to perform the requested operation." msgstr "" -#: plinth/modules/storage/__init__.py:266 +#: plinth/modules/storage/__init__.py:269 msgid "The device is already mounted." msgstr "" -#: plinth/modules/storage/__init__.py:268 +#: plinth/modules/storage/__init__.py:271 msgid "The device is not mounted." msgstr "" -#: plinth/modules/storage/__init__.py:270 +#: plinth/modules/storage/__init__.py:273 msgid "Not permitted to use the requested option." msgstr "" -#: plinth/modules/storage/__init__.py:272 +#: plinth/modules/storage/__init__.py:275 msgid "The device is mounted by another user." msgstr "" -#: plinth/modules/storage/__init__.py:316 +#: plinth/modules/storage/__init__.py:319 #, no-python-format, python-brace-format msgid "Low space on system partition: {percent_used}% used, {free_space} free." msgstr "" -#: plinth/modules/storage/__init__.py:318 +#: plinth/modules/storage/__init__.py:321 msgid "Low disk space" msgstr "" -#: plinth/modules/storage/__init__.py:346 +#: plinth/modules/storage/__init__.py:349 msgid "Disk failure imminent" msgstr "" -#: plinth/modules/storage/__init__.py:348 +#: plinth/modules/storage/__init__.py:351 #, python-brace-format msgid "" "Disk {id} is reporting that it is likely to fail in the near future. Copy " @@ -6128,24 +6129,24 @@ msgstr "" msgid "Tor Bridge Relay" msgstr "" -#: plinth/modules/tor/__init__.py:121 +#: plinth/modules/tor/__init__.py:123 msgid "Tor relay port available" msgstr "" -#: plinth/modules/tor/__init__.py:131 +#: plinth/modules/tor/__init__.py:133 msgid "Obfs3 transport registered" msgstr "" -#: plinth/modules/tor/__init__.py:141 +#: plinth/modules/tor/__init__.py:143 msgid "Obfs4 transport registered" msgstr "" -#: plinth/modules/tor/__init__.py:210 +#: plinth/modules/tor/__init__.py:212 #, python-brace-format msgid "Access URL {url} on tcp{kind} via Tor" msgstr "" -#: plinth/modules/tor/__init__.py:221 +#: plinth/modules/tor/__init__.py:223 #, python-brace-format msgid "Confirm Tor usage at {url} on tcp{kind}" msgstr "" @@ -6346,30 +6347,30 @@ msgstr "" msgid "Update" msgstr "" -#: plinth/modules/upgrades/__init__.py:127 +#: plinth/modules/upgrades/__init__.py:129 msgid "Updates" msgstr "" -#: plinth/modules/upgrades/__init__.py:130 +#: plinth/modules/upgrades/__init__.py:132 msgid "FreedomBox Updated" msgstr "" -#: plinth/modules/upgrades/__init__.py:215 +#: plinth/modules/upgrades/__init__.py:217 msgid "Could not start distribution update" msgstr "" -#: plinth/modules/upgrades/__init__.py:217 +#: plinth/modules/upgrades/__init__.py:219 msgid "" "There is not enough free space in the root partition to start the " "distribution update. Please ensure at least 5 GB is free. Distribution " "update will be retried after 24 hours, if enabled." msgstr "" -#: plinth/modules/upgrades/__init__.py:228 +#: plinth/modules/upgrades/__init__.py:230 msgid "Distribution update started" msgstr "" -#: plinth/modules/upgrades/__init__.py:230 +#: plinth/modules/upgrades/__init__.py:232 msgid "" "Started update to next stable release. This may take a long time to complete." msgstr "" @@ -7548,6 +7549,6 @@ msgstr "" msgid "%(percentage)s%% complete" msgstr "" -#: plinth/web_framework.py:117 +#: plinth/web_framework.py:114 msgid "Gujarati" msgstr "" diff --git a/plinth/locale/te/LC_MESSAGES/django.po b/plinth/locale/te/LC_MESSAGES/django.po index a67dc390a..0a7d8050e 100644 --- a/plinth/locale/te/LC_MESSAGES/django.po +++ b/plinth/locale/te/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: FreedomBox UI\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-08 21:01-0500\n" +"POT-Creation-Date: 2021-11-22 18:17-0500\n" "PO-Revision-Date: 2021-05-17 18:31+0000\n" "Last-Translator: chilumula vamshi krishna \n" "Language-Team: Telugu \n" "Language-Team: Turkish \n" "Language-Team: Ukrainian \n" "Language-Team: Vietnamese \n" "Language-Team: Chinese (Simplified) \n" "Language-Team: Chinese (Traditional) Date: Mon, 22 Nov 2021 18:45:07 -0500 Subject: [PATCH 29/33] doc: Fetch latest manual Signed-off-by: James Valleroy --- doc/manual/en/ReleaseNotes.raw.wiki | 15 +++++++++++++++ doc/manual/es/ReleaseNotes.raw.wiki | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/doc/manual/en/ReleaseNotes.raw.wiki b/doc/manual/en/ReleaseNotes.raw.wiki index 4c9b99735..3b70912da 100644 --- a/doc/manual/en/ReleaseNotes.raw.wiki +++ b/doc/manual/en/ReleaseNotes.raw.wiki @@ -10,6 +10,21 @@ For more technical details, see the [[https://salsa.debian.org/freedombox-team/f The following are the release notes for each !FreedomBox version. +== FreedomBox 21.14 (2021-11-22) == + +=== Highlights === + + * tt-rss: Allow selection of a domain name + +=== Other Changes === + + * *: Split app initialization from app construction + * app: Introduce separate method for post initialization operations + * datetime: Avoid error when systemctl is not available + * debian: Fail build if no module dependencies found + * locale: Update translations for Swedish, Turkish, Ukrainian + * main: Drop initializing Django when listing dependencies + == FreedomBox 21.13 (2021-11-08) == === Highlights === diff --git a/doc/manual/es/ReleaseNotes.raw.wiki b/doc/manual/es/ReleaseNotes.raw.wiki index 4c9b99735..3b70912da 100644 --- a/doc/manual/es/ReleaseNotes.raw.wiki +++ b/doc/manual/es/ReleaseNotes.raw.wiki @@ -10,6 +10,21 @@ For more technical details, see the [[https://salsa.debian.org/freedombox-team/f The following are the release notes for each !FreedomBox version. +== FreedomBox 21.14 (2021-11-22) == + +=== Highlights === + + * tt-rss: Allow selection of a domain name + +=== Other Changes === + + * *: Split app initialization from app construction + * app: Introduce separate method for post initialization operations + * datetime: Avoid error when systemctl is not available + * debian: Fail build if no module dependencies found + * locale: Update translations for Swedish, Turkish, Ukrainian + * main: Drop initializing Django when listing dependencies + == FreedomBox 21.13 (2021-11-08) == === Highlights === From 9a855f7bd23cd6ede467e077a7d48e4fc0bce781 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Mon, 22 Nov 2021 18:46:18 -0500 Subject: [PATCH 30/33] Release v21.14 to unstable Signed-off-by: James Valleroy --- debian/changelog | 45 +++++++++++++++++++++++++++++++++++++++++++++ plinth/__init__.py | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1d66dee88..01c27bc7a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,48 @@ +freedombox (21.14) unstable; urgency=high + + [ Burak Yavuz ] + * Translated using Weblate (Turkish) + + [ Michael Breidenbach ] + * Translated using Weblate (Swedish) + + [ Sunil Mohan Adapa ] + * app: Introduce separate method for post initialization operations + * module_loader: Split app initialization into separate steps + * avahi: Split app initialization + * backups: Split app initialization + * cockpit: Split app initialization + * diagnostics: Split app initialization + * dynamicdns: Split app initialization + * email_server: Don't get domain name during initialization + * config: Split app configuration + * letencrypt: Split app initialization + * names: Split app initialization + * pagekite: Split app initialization + * storage: Split app initialization + * tor: Split app initialziation + * upgrades: Split app initialziation + * ejabberd: Split app initialziation + * gitweb: Split app initialization + * frontpage: Avoid URL reverse during Shortcut component construction + * menu: Avoid reversing URL during Menu component construction + * main: Drop initializing Django when listing dependencies (Closes: #999484) + + [ Andrij Mizyk ] + * Translated using Weblate (Ukrainian) + + [ Joseph Nuthalapati ] + * names: Create a generic TLS domain selection form + * tt-rss: Allow selection of a domain name + + [ James Valleroy ] + * debian: Fail build if no module dependencies found + * datetime: Avoid error when systemctl is not available + * locale: Update translation strings + * doc: Fetch latest manual + + -- James Valleroy Mon, 22 Nov 2021 18:45:33 -0500 + freedombox (21.13) unstable; urgency=medium [ Burak Yavuz ] diff --git a/plinth/__init__.py b/plinth/__init__.py index 252067f14..67c9c6062 100644 --- a/plinth/__init__.py +++ b/plinth/__init__.py @@ -3,4 +3,4 @@ Package init file. """ -__version__ = '21.13' +__version__ = '21.14' From 20b46f7df5feee233c5a278b6eb8b83e6b5284e7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 23 Nov 2021 07:30:10 -0800 Subject: [PATCH 31/33] config: Add packages component to a re-add zram-tools dependency Fixes: #2151. Tests: - Before this patch, --list-dependencies does not list zram-tools. After this patch, --list-dependencies lists zram-tools. - After this patch, --list-dependencies exactly matches the output from freedombox release without Packages component changes. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/config/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plinth/modules/config/__init__.py b/plinth/modules/config/__init__.py index 45060726c..490bd9e22 100644 --- a/plinth/modules/config/__init__.py +++ b/plinth/modules/config/__init__.py @@ -15,6 +15,7 @@ from plinth import frontpage, menu from plinth.modules.apache import (get_users_with_website, user_of_uws_url, uws_url_of_user) from plinth.modules.names.components import DomainType +from plinth.package import Packages from plinth.signals import domain_added version = 3 @@ -64,6 +65,9 @@ class ConfigApp(app_module.App): 'config:index', parent_url_name='system') self.add(menu_item) + packages = Packages('packages-config', managed_packages) + self.add(packages) + domain_type = DomainType('domain-type-static', _('Domain Name'), 'config:index', can_have_certificate=True) self.add(domain_type) From 9718b2aa2c2c6d224a19e28a04f9ecea948ae4e2 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Wed, 24 Nov 2021 10:37:37 -0500 Subject: [PATCH 32/33] Release v21.14.1 to unstable Signed-off-by: James Valleroy --- debian/changelog | 7 +++++++ plinth/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 01c27bc7a..eaaa1a4cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +freedombox (21.14.1) unstable; urgency=high + + [ Sunil Mohan Adapa ] + * config: Add packages component to a re-add zram-tools dependency + + -- James Valleroy Wed, 24 Nov 2021 10:36:25 -0500 + freedombox (21.14) unstable; urgency=high [ Burak Yavuz ] diff --git a/plinth/__init__.py b/plinth/__init__.py index 67c9c6062..433d08a00 100644 --- a/plinth/__init__.py +++ b/plinth/__init__.py @@ -3,4 +3,4 @@ Package init file. """ -__version__ = '21.14' +__version__ = '21.14.1' From 1f7e49fc88e851ff315e28a7950f8fb804cd2112 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 27 Nov 2021 09:11:28 -0500 Subject: [PATCH 33/33] Release v21.14.1~bpo11+1 to bullseye-backports Signed-off-by: James Valleroy --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8fcce5d26..48172fa36 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +freedombox (21.14.1~bpo11+1) bullseye-backports; urgency=medium + + * Rebuild for bullseye-backports. + + -- James Valleroy Sat, 27 Nov 2021 09:10:54 -0500 + freedombox (21.14.1) unstable; urgency=high [ Sunil Mohan Adapa ]