27 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
a2159bdff0
doc/dev: Limit table of contents depth to 2 for clarity
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-08-26 18:29:58 -04:00
Sunil Mohan Adapa
4b09d91f93
*: Add type hints for diagnose method
Helps: #2410.

- Ensure that diagnostics methods and parameters are type checked so that we can
catch any potential issues.

- Move plinth/modules/diagnostics/check.py to plinth/diagnostic_check.py to
avoid many circular dependencies created. This is due to
plinth.modules.diagnostics automatically imported when
plinth.modules.diagnostics.check is imported. Also app.py is already (type)
dependent on diagnostic_check due to diagnose() method. To make the Check
classes independent of diagnostic module is okay.

Tests:

- Run make check-type.

- Run full diagnostics with following apps installed: torproxy, tor.
  - Test to netcat to 9051 in tor works.
  - Test 'port available for internal/external networks' in firewall works.
  - Test 'Package is latest' works.
  - Test 'Access url with proxy' in privoxy works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
[jvalleroy: Also move tests for diagnostic_check]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-09 14:23:33 -05:00
Sunil Mohan Adapa
02e409a3a1
daemon: Add new component for daemons shared across apps
- This is useful for managing redis service needed by the upcoming Nextcloud
app.

- Disable the daemon only if all the apps using it are disabled. Enable it when
even one of the them is enabled.

- The component is not a 'leader' component as it does not decide the
enabled/disabled status of the app.

Tests:

- Unit tests pass.

- Install zoph and wordpress with full patch series. If one of the apps is
disabled, mysql service is still enabled and running. If both apps are disabled,
then mysql service is disabled and not running. Enabled/disabled status of apps
are accurate after they are enabled/disabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-02-21 20:54:49 -05:00
James Valleroy
2a8b9b94ba
app: Update diagnose() docstring
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add reference documentation for the DiagnosticCheck and Result classes]
[sunil: Add link to DiagnosticCheck class from docstring]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2023-10-30 22:09:00 -07:00
Sunil Mohan Adapa
598e1e3b4a
config: Add new component for managing drop-in /etc/ config files
- Use two separate strategies: one to symlink from /etc to files in /usr/ and
two to copy files from /usr to /etc. The latter is needed for some rare cases
where symlinks don't work because the daemon runs in a chrooted environment.

- Update tutorial and reference sections in developer documentation.

Tests:

- Unit tests works and are comprehensive.

- Using the component in apps works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-06-05 20:27:23 -04:00
Sunil Mohan Adapa
4bf347dbe3
firewall: Introduce component for local service protection
- Automatically handle a setup of the component getting added to an existing
app.

Tests:

- Run unit tests

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-12-05 20:46:49 -05:00
Sunil Mohan Adapa
5c5fc9eb61
actions: Drop unused superuser_run and related methods
Tests:

- All tests in patch series have been done with this patch applied
- Unit tests pass

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:54:03 -04:00
Sunil Mohan Adapa
ce709ca8ce
doc: dev: Document previously undocumented components
Tests:

- Build HTML and ensure build succeeds that the changes are reflected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 18:55:02 -04:00
Sunil Mohan Adapa
a68776d04b
doc: dev: Use and recommend new privileged actions
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-20 18:17:07 -04:00
Sunil Mohan Adapa
224cbe51c5
doc/dev: Drop reference to module level depends declaration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:39:57 -05:00
Sunil Mohan Adapa
a3d4d99b33
*: Drop use of module level version
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:38:08 -05:00
Sunil Mohan Adapa
cf36a9d385
*: Drop use of module level is_essential flag
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:37:59 -05:00
Sunil Mohan Adapa
1681aeb2f9
doc/dev: Drop discussion on managed_paths
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:36:41 -05:00
Sunil Mohan Adapa
40830f73f1
doc/dev: Remove mention of managed_services
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:36:06 -05:00
Sunil Mohan Adapa
e3e3042da4
doc/dev: Update documentation to not refer to managed_packages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:35:02 -05:00
Joseph Nuthalapati
53fbaf27f2
components: Add docstrings & tutorial for Packages
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Include the new component reference in the components index]
[sunil: Minor changes to component doc string]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-11-08 16:12:00 -08:00
Sunil Mohan Adapa
673ed475b7
doc/dev: Drop seemingly irrelevant automodule reference
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-08-17 19:42:23 -07:00
Carlos Henrique Lima Melara
0ce610c074
docs: Set the version attribute as required instead of optional
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-04-17 09:55:06 -07:00
Joseph Nuthalapati
ceacde67b9
coturn: Add new component for usage of coturn by other apps
Sunil:

 - Add TurnConfiguration to reference documentation. Add more details in
 docstrings.

 - Rename the component to TurnConsumer since 'Component' in the name is
 redundant and unconventional. Also, hopefully, the component will retain the
 API over multiple TURN servers.

 - Log when notifying other components about configuration change.

 - Use TurnConfiguration class more widely.

 - Refactor for simplicity.

 - Additional tests.

 - Move URI generation code into TurnConfiguration.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-02-28 16:28:41 -08:00
Sunil Mohan Adapa
b378305f58
doc: dev: Update the tutorial to reflect latest API/code
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-01-04 13:47:41 +02:00
Sunil Mohan Adapa
5f3c691c38
doc: dev: Update documentation for using backup component
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-01-04 13:47:39 +02:00
Alice Kile
0b5b384651
app: Separate app enable/disable form from config form
- Introduce new API to mark an app that it can't be disabled.

- Mark jsxc, storage, config, upgrade and firewall apps as can't be disabled.

- Fixed functional tests

- Replaced AppForm with forms.Form in all modules' forms.py.

- Remove app.template.js.

- Remove unused styles.

- Remove app status checks in form_valid of Deluge, Diaspora, Matrix, Ejabberd,
MediaWiki, Storage, Transmission, Quassel

- Purge unused is_enabled context variables (Ikiwiki)

- ejabberd: Minor cleanup in template

- jsxc: Cleanup unneeded overrides

- tahoe: Cleanup unnecessary overrides

Tests performed:

- For all apps affected, test enable/disable button works and submitting
configuration form works: with changes updates message and without changes
'settings unchanged' message.
  - avahi
  - bind
  - cockpit
  - SKIP: coquelicot
  - datetime
  - deluge
  - SKIP: diaspora
  - ejabberd
  - gitweb
  - i2p
  - infinoted
  - ikiwiki
  - matrixsynapse
  - mediawiki
  - minetest
  - minidlna
  - mldonkey
  - mumble
  - pagekite
  - privoxy
  - quassel
  - radicale
  - roundcube
  - SKIP: samba
  - searx
  - SKIP: shaarli
  - shadowsocks
  - ssh
  - tahoe
  - transmission
  - FAIL: tt-rss (not installable)
  - wireguard
- Deluge test that configuration changes when app is disabled work
- Quassel test that setting the domain works when app is diabled
- Transmission test that setting the domain works when app is diabled
- Ikiwiki create form works properly
- Enable/disable button appears as expected when enabled and when disabled
- Enable/disable button works without Javascript
- Functional tests work for affected apps, Tor and OpenVPN
- AppForm is removed from developer documentation
  - Forms reference
  - Customizing tutorial
- Test all apps using directory select form
  - Transmission
  - Deluge
- Visit each template that overrides block configuration and ensure that it is
loaded properly and the display is as expected.
- All apps that use AppView that are not tested above should not have an
enable/disable button. That is JSXC, update, config, firewall, storage, users.

Signed-off-by: Alice Kile <buoyantair@protonmail.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-03-29 09:42:31 +03:00
Sunil Mohan Adapa
7a0ea38fb1
web_server: Introduce component to handle special static file dirs
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-03-25 20:22:37 +02:00
Sunil Mohan Adapa
22c3241a52
notification: Add developer documentation
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-02-22 15:51:47 -05:00
Sunil Mohan Adapa
72ce23e377
app: Introduce Info component to store basic app information
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-02-16 18:21:53 -05:00
Sunil Mohan Adapa
2ebb565c92
diagnostics: Use new component based API for all diagnostic tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-30 11:37:46 -05:00
Sunil Mohan Adapa
80498919fb
doc: Add developer documentation using Sphinx
- This is completely reworked but based on /Developer page in the FreedomBox
  Manual.

- This documentation can be made available as static site on
  https://docs.freedombox.org and the /Developer page in the FreedomBox Manual
  can be dropped.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-11-02 13:51:14 -04:00