mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
*: Add setup method on all apps that don't have it
This is needed for the apps to get enabled soon after installation. In case of 'sharing' app, a shortcut will appear on the apps page. This also brings uniformity to help later refactoring. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
75f6abac1e
commit
f6ef0135d2
@ -20,3 +20,8 @@ class ApiApp(app_module.App):
|
|||||||
info = app_module.Info(app_id=self.app_id, version=self._version,
|
info = app_module.Info(app_id=self.app_id, version=self._version,
|
||||||
is_essential=True)
|
is_essential=True)
|
||||||
self.add(info)
|
self.add(info)
|
||||||
|
|
||||||
|
def setup(self, old_version):
|
||||||
|
"""Install and configure the app."""
|
||||||
|
super().setup(old_version)
|
||||||
|
self.enable()
|
||||||
|
|||||||
@ -67,6 +67,11 @@ class DiagnosticsApp(app_module.App):
|
|||||||
interval = 180 if cfg.develop else 3600
|
interval = 180 if cfg.develop else 3600
|
||||||
glib.schedule(interval, _warn_about_low_ram_space)
|
glib.schedule(interval, _warn_about_low_ram_space)
|
||||||
|
|
||||||
|
def setup(self, old_version):
|
||||||
|
"""Install and configure the app."""
|
||||||
|
super().setup(old_version)
|
||||||
|
self.enable()
|
||||||
|
|
||||||
def diagnose(self):
|
def diagnose(self):
|
||||||
"""Run diagnostics and return the results."""
|
"""Run diagnostics and return the results."""
|
||||||
results = super().diagnose()
|
results = super().diagnose()
|
||||||
|
|||||||
@ -51,6 +51,11 @@ class FirstBootApp(app_module.App):
|
|||||||
"""Perform post initialization operations."""
|
"""Perform post initialization operations."""
|
||||||
post_setup.connect(_clear_first_boot_steps)
|
post_setup.connect(_clear_first_boot_steps)
|
||||||
|
|
||||||
|
def setup(self, old_version):
|
||||||
|
"""Install and configure the app."""
|
||||||
|
super().setup(old_version)
|
||||||
|
self.enable()
|
||||||
|
|
||||||
|
|
||||||
def _clear_first_boot_steps(sender, module_name, **kwargs):
|
def _clear_first_boot_steps(sender, module_name, **kwargs):
|
||||||
"""Flush the cache of first boot steps so it is recreated."""
|
"""Flush the cache of first boot steps so it is recreated."""
|
||||||
|
|||||||
@ -74,3 +74,8 @@ class HelpApp(app_module.App):
|
|||||||
static_files = web_server.StaticFiles('static-files-help',
|
static_files = web_server.StaticFiles('static-files-help',
|
||||||
directory_map)
|
directory_map)
|
||||||
self.add(static_files)
|
self.add(static_files)
|
||||||
|
|
||||||
|
def setup(self, old_version):
|
||||||
|
"""Install and configure the app."""
|
||||||
|
super().setup(old_version)
|
||||||
|
self.enable()
|
||||||
|
|||||||
@ -59,6 +59,11 @@ class NamesApp(app_module.App):
|
|||||||
domain_added.connect(on_domain_added)
|
domain_added.connect(on_domain_added)
|
||||||
domain_removed.connect(on_domain_removed)
|
domain_removed.connect(on_domain_removed)
|
||||||
|
|
||||||
|
def setup(self, old_version):
|
||||||
|
"""Install and configure the app."""
|
||||||
|
super().setup(old_version)
|
||||||
|
self.enable()
|
||||||
|
|
||||||
|
|
||||||
def on_domain_added(sender, domain_type, name='', description='',
|
def on_domain_added(sender, domain_type, name='', description='',
|
||||||
services=None, **kwargs):
|
services=None, **kwargs):
|
||||||
|
|||||||
@ -40,3 +40,8 @@ class PowerApp(app_module.App):
|
|||||||
backup_restore = BackupRestore('backup-restore-power',
|
backup_restore = BackupRestore('backup-restore-power',
|
||||||
**manifest.backup)
|
**manifest.backup)
|
||||||
self.add(backup_restore)
|
self.add(backup_restore)
|
||||||
|
|
||||||
|
def setup(self, old_version):
|
||||||
|
"""Install and configure the app."""
|
||||||
|
super().setup(old_version)
|
||||||
|
self.enable()
|
||||||
|
|||||||
@ -49,6 +49,11 @@ class SharingApp(app_module.App):
|
|||||||
**manifest.backup)
|
**manifest.backup)
|
||||||
self.add(backup_restore)
|
self.add(backup_restore)
|
||||||
|
|
||||||
|
def setup(self, old_version):
|
||||||
|
"""Install and configure the app."""
|
||||||
|
super().setup(old_version)
|
||||||
|
self.enable()
|
||||||
|
|
||||||
|
|
||||||
def list_shares():
|
def list_shares():
|
||||||
"""Return a list of shares."""
|
"""Return a list of shares."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user