3577 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
61ff15a04f
*: Use action_utils.run instead of subprocess.run
- This is to capture stdout and stderr and transmit that from privileged daemon
back to the service to be displayed in HTML.

Tests:

- Unit tests and code checks pass.

- Some of the modified actions work as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:53 +03:00
Sunil Mohan Adapa
5566f05cad
config: Set home page to FreedomBox for invalid values
- When attempting to set an invalid shortcut ID or invalid user's directory as
home page, set FreedomBox UI as home page.

- Simplify the tests somewhat and avoid failure first time and skipping the test
next time.

Tests:

- Run unit tests as 'root' and 'fbx' users.

- Set home page to apache default, FreedomBox, user home page and a shortcut.
The set value is retained. The change works when visiting / with browser. The
value is as expected in Apache configuration.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:47 +03:00
Sunil Mohan Adapa
647e72516c
backups: Fix robust handling of known errors
During functional tests, it was noticed that getattr() failed at the following
line. The original intent of the code is to ensure that there are no failures
when 'stdout'/'stderr' attribute are not present or when they return None.

    stdout = (getattr(err, 'stdout') or b'').decode()

Tests:

- Make the UI raise incorrect password error. Notice that the error is shown
properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:47 +03:00
Sunil Mohan Adapa
288b58e0b5
storage: Fix disk usage checking with disconnected SSH mounts
- When disconnected sshfs mounts are present, then df command prints the disk
usage for the remaining disks but prints a warning to the stderr and return a
non-zero return code. Accommodate this case and parse the information for all
the available disks.

Tests:

- Create a remote backup location and mount it. When the SSH process is killed,
it leaves a mount point that is not properly connected. View the storage page to
see that disk usage for other partitions is shown properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:42 +03:00
Sunil Mohan Adapa
904e5935cb
backups: Ignore a typing error with mypy
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:39 +03:00
Sunil Mohan Adapa
d512a8b645
diagnostics: In development mode, run diagnostics more rarely
Due the frequency and length of execution of diagnostics, the service does not
restart when files are modified. The operation also makes other testing tasks
wait until completed. It also makes functional tests slower. So, reduce the
frequency of execution. It can always be temporarily changed when debugging
diagnostics operations is necessary.

Tests:

- Change the development interval to 18 seconds and notice that new interval is
effective in development mode but not in production mode.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:39 +03:00
Sunil Mohan Adapa
2862862161
api: Fix showing icons for custom shortcuts
Tests:

- Add a custom shortcut and provide a custom icon for it in
/var/www/plinth/custom/static/icons/. Visit the page /plinth/api/1/shortcuts/.
The icon path for the custom shortcut is correct and accessible from browser.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-22 19:43:06 -04:00
Sunil Mohan Adapa
ced83a31e9
zoph: Fix cases when CLI user is set to "autodetect"
Closes: #2538

Tests:

- Without the patch, set the Zoph CLI User to "autodetect" and notice the
failure to load Zoph page.

- With the patch, set user to "autodetect" and access the app page. It is
updated to the first admin user in Zoph DB.

- Try with updating Zoph configuration.

- Try with re-running Zoph setup.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 13:25:58 -04:00
Sunil Mohan Adapa
5758bdba2a
upgrades: Overwrite apt sources lens with bug fixes
Fixes: #2251
Fixes: #2426

- Temporarily add a bug fix for the one-line style apt sources format. Upstream
submission: https://github.com/hercules-team/augeas/pull/865 .

- Currently, only two options with keys arch= or trusted= are allowed. However,
as documented in apt manual page[1], there are many different options possible.
Apt itself parses these options in a much more generic way[2][3].

- Fixes allow parsing all the different options allowed by apt. A practical
example (accepted by apt) is also provided as a test case.

Tests:

- Add the following line to one of the apt sources file in
/etc/apt/sources.list.d: "deb
[signed-by=/usr/share/keyrings/debian-archive-trixie-stable.gpg]
https://deb.debian.org/debian trixie main". In augtool, print
/augeas/files/etc/apt/sources.list.d//error.

- With the patch, run 'make build install' and errors in augtool disappear.

- In tor proxy app, enabling/disabling apt through tor works. The files in
/etc/apt/ are updated as expected.

Link: https://manpages.debian.org/trixie/apt/sources.list.5.en.html
Link: 3c9399e643/apt-pkg/sourcelist.cc (L215)
Link: 3c9399e643/apt-pkg/contrib/strutl.cc (L245)
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 08:11:50 -04:00
Sunil Mohan Adapa
a98e6f7563
upgrades: Multiple fixes for parsing Apt's Deb822 style sources
- Allow DOS style line endings

- Allow preceding, trailing, and repeating empty lines

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 08:11:48 -04:00
Sunil Mohan Adapa
795bd1fd9e
torproxy: When disabling apt over tor fails, report error properly
- It is not possible to disable apt over tor for as many files as possible with
the current code because even an error in a single file will result in entire
process failing. Instead, implement a way to disable the exception.

Tests:

- Add an unparsable line into the one of the apt sources files. Disabling apt
over tor works and all file but the error file are modified.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 08:11:44 -04:00
Sunil Mohan Adapa
567e34d467
bepasty: tests: Fix functional test failure to missing / in URL
Helps: #2517.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-09-19 11:13:12 -07:00
Sunil Mohan Adapa
5a55b59939
diagnostics, help: Link to diagnostics page logs in 500 error page
Closes: #2414.

- Remove separate implementation for showing logs in help page.

- Add link to the page in diagnostics app so that FreedomBox logs can more
easily be discovered by users.

Tests:

- Raise an exception in the common error middleware to cause a 500 internal
server error. Run FreedomBox service with the --develop option and notice that
500 error page is served. There, the link to logs page works. It shows the logs
for Diagnostics app.

- Diagnostics page description is update. Link to logs page works.

- Diagnostics page shows logs for plinth.service and freedombox-develop.service.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-18 16:35:23 +03:00
Sunil Mohan Adapa
c95ee766aa
bepasty: tests: Override backup/restore test properly
- The current name does not the match the base class method it intends to
override.

Tests:

- Run functional tests for bepasty -v option and notice that only one backup and
restore test runs.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-09-12 11:24:19 -07:00
Sunil Mohan Adapa
b7df34d175
matrixsynapse, upgrades: Install select packages from unstable
Tests:

- On stable, testing distributions applying the patches and restarting the
services causes two files to be created on the system.
/etc/apt/sources.list.d/freedombox-unstable.list and
/etc/apt/preferences.d/50freedombox-dist.pref. In unstable distributions the
files are not created.

- Installing Matrix Synapse on all three distributions works. Initial domain
configuration works. All diagnostic tests pass.

- On stable and testing distributions, running 'apt policy matrix-synapse' shows
that priority for package from unstable is 200 higher than installed package
priority of 100. Same for the package python3-pympler. Running 'apt policy
freedombox' shows that package from -backports has a priority of 500 that is
same as the priority of non-backports package.

Tests:

- During re-run of setup, unstable sources are setup.

- Matrix synapse app shows updated description.

- Upgrades app shows updated description about frequent feature updates.

- On oldstable, stable, and testing distributions unstable sources are setup.
But not on unstable.

- On stable, testing distributions applying the patches and restarting the
services causes two files to be created on the system.
/etc/apt/sources.list.d/freedombox-unstable.list and
/etc/apt/preferences.d/50freedombox-unstable.pref. In unstable distributions the
files are not created.

- Installing Matrix Synapse on all four distributions works. Initial domain
configuration works. All diagnostic tests pass.

- On oldstable, stable, and testing distributions, running 'apt policy
python3-pympler matrix-synapse python3-python-multipart' shows that priority for
package from unstable is 200 higher than installed package priority of 100.
Running 'apt policy freedombox' shows that package from -backports has a
priority of 500 that is same as the priority of non-backports package.

- When frequent feature updates is not enabled, the app can't be installed.
"This application is currently not available in your distribution." message is
shown. After enabling frequent feature updates, the apps can be installed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-08 19:33:56 -04:00
Sunil Mohan Adapa
fecd6a3577
upgrades: Overhaul detection of distribution
- Move some utilities to utils.py from distupgrade.py and __init__.py.

- This fixes issues with apt preferences being set on unstable
distribution (despite code that tries to prevent it).

- There is no way to distinguish between 'testing' and 'unstable' distributions
in Debian using commands like lsb_release (powered by /etc/os-release). See:
https://lwn.net/Articles/984635/ . So, use the value set in
/etc/apt/sources.list.

Tests: (tested entire patchset)

- Deluge can be installed in trixie.

- Auto-distribution upgrade button is checked during setup on stable and
oldstable but not on testing and unstable.

- Auto-distribution upgrade button is enabled in the form on stable and
oldstable but not on testing and unstable.

- Backports wizard step is skipped on unstable (non-develop mode), but not on
oldstable, stable, testing, and unstable (develop mode).

- If backports are not activated during first wizard, then backports can be
activated on upgrades app page if distribution is oldstable, stable, testing, or
unstable (non-develop mode) but not unstable (develop mode).

- During re-run of setup, setting up backport sources is skipped if already
setup.

- Backports sources files are not added in testing (non-develop) and
unstable (non-develop) distributions. Backports sources are added to oldstable,
stable, testing (develop) and unstable (develop). Unstable sources sources are
not added to unstable but added to oldstable, stable, and testing.

- Backports sources file is added with correct code name bookworm/trixie for
oldstable, stable, and testing distributions.

- When backports sources is set to 'bookworm-backports' on Trixie distribution,
re-running setup updates them to 'trixie-backports'.

- Preferences files are added in oldstable, stable, and testing distributions
but not unstable.

- If unstable and another distro is present in apt sources, then it is treated
as unstable as shown in the distribution upgrade page.

- Current codename is shown properly from sources.list in oldstable, stable,
testing, and unstable in distribution upgrade page.

- NOT TESTED: If distribution upgrade is interrupted, then continue page is
shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-08 19:33:33 -04:00
Sunil Mohan Adapa
4a0e35f806
dynamicdns: Handle showing errors from GnuDIP
- Recently we have changed to using HTTP protocol for GnuDIP updates. These
involve using requests library. For exceptions raised by this library the
arguments may not all be JSON serializable. So, explicitly convert them into
strings.

Tests:

- Turn of network connection to the machine. Trigger a Dynamic DNS update by
re-submitting configuration form. This will results in an error message shown
in status table instead of an unhandled exception.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 22:00:04 +05:30
Sunil Mohan Adapa
0c6f04b55f
actions, backups: Fix tests depending on sudo based actions
Tests:

- Mounting/unmounting of remote SSH repositories works.

- Creating repo, creating/deleting/list archives work.

- If a privileged method raises an exception after outputting to stdout (using
action_utils.run) then stdout is shown in the HTML UI message.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 20:24:10 +05:30
Sunil Mohan Adapa
a580437de2
privileged_daemon: Introduce a command line client for the API
- Similar call signature as actions/actions.

Tests:

- Running make install places a binary file in /usr/bin/freedombox-cmd

- Running 'freedombox-cmd upgrades get_log --no-args' works.

- Running 'freedombox-cmd upgrades activate_backports --no-args' works.

- Running 'freedombox-cmd storage usage_info --no-args' works.

- Running 'freedombox-cmd sshfs is_mounted --no-args' works.

- echo '{"args": ["USERNAME", "AUTH_USER", "AUTH_PASSWORD"], "kwargs": {}}' |
sudo freedombox-cmd users remove_user.

- Distribution upgrade from Bookworm to Trixie works.

  - Snapshots are disabled and re-enabled during upgrade.

  - /etc/apt/sources.list changes are completed on completion.

- If a command fails, the return code is not 0.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 20:23:36 +05:30
Sunil Mohan Adapa
143e4a00bd
actions, backup: Implement raw output for privileged daemon
- Regression: downloading does not work with sudo based action anymore. However,
sudo based actions are to be removed in later patches.

Tests:

- Downloading tar backup archive works. Untar works. Downloading gives upto
10MiB/s speed.

- If API is not called with _raw_output=True, then special exception is raised.

- Downloading tar file from command line using nc also works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 20:23:25 +05:30
Sunil Mohan Adapa
0aa3ee5a70
actions: Simplify raw output code in privileged methods
Tests:

- Downloading tar backup archive works. Untar works. Downloading gives upto
10MiB/s speed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 20:23:16 +05:30
Sunil Mohan Adapa
773460dde9
storage: Don't use privileged action feature to run as different user
- Instead implement running specific commands inside the privileged action as a
specific user.

Tests:

- In transmission, setting the download directory is valid if

  - A parent level directory is writable by transmission daemon and child does
  not exist.

  - A leaf level directory is writable by transmission daemon when leaf exists.

  - A leaf level exists and is not a directory.

- In MiniDLNA, setting the directory works only if it exists and is readable.
Work when write permission is not available.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 20:22:54 +05:30
Sunil Mohan Adapa
87331e7c97
gitweb: Don't use privileged action feature to run as different user
- Instead implement running specific commands inside the privileged action as a
specific user.

Tests:

- Gitweb functional tests and unit tests work.

- Running various operations such as clone, create, set branch, rename, etc. all
result in repositories (and all their contents) owned by www-data:www-data.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 20:22:40 +05:30
Sunil Mohan Adapa
7a4fb9d9f6
gitweb: Use pathlib API more
Tests:

- Existing gitweb repos are listed properly. Newly created repos are reported
  properly.

  - Directories without .git extension or starting with . are not shown.

  - Private repos are shown as private and public ones as public.

- Cloning progress is shown properly in the list of repos.

  - Cloning starts with 0%.

  - Cloning file is removed after completion of cloning process.

  - Cloning is done into .temp directory.

  - After cloning repo can be checked out as expected.

- Getting/setting of default branch/description/owner/private works.

- Getting the list of branches work when selecting the default branch.

- Creating new blank repo works.

- Deleting a repo works

- Uninstalling the app works. All repos are removed.

- Retrieving non-existent repo shows error as expected

- Backup/restore of repos works as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-05 20:22:15 +05:30
Sunil Mohan Adapa
46c3ac90f3
email: Fix Thunderbird auto configuration failure
- When there is no URL name provided, the view fails to render when computing
breadcrumbs from middleware. Provide a name so that the URL does not lead to a
500 HTTP error.

Tests:

- Accessing the URL on development machine does not lead to an error page.

- On a production machine, when trying to use Thunderbird account setup wizard,
without the patch, Thunderbird says that it found configuration by enumerating
common names for the domain. A 500 error can be seen in the journal. After the
change in patch, Thunderbird says that it found the configuration from the
provider. A 200 success code can be seen from journal.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-05 07:33:03 -04:00
Joseph Nuthalapati
5e1345f0df
backups: Trim translatable string
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-02 12:26:36 +05:30
Veiko Aasa
35b03aa5df
samba: Update client list
Removed android apps that have been discontinued and added SambaLite
app.

Tested that SambaLite works with Samba app.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-01 23:18:54 +05:30
Sunil Mohan Adapa
52cde4c0b6
upgrades: Don't allow needs-restart to restart privileged daemon
Fixes: #2534.

- Otherwise, if python standard library is updated, needs-restart will determine
that the freedombox-privileged.service needs to be restarted. The service may
have triggered the 'apt-get install' operation that triggered needs-restart in
the first place. That causes the install operation to fail.

Tests:

- Installing Calibre app which also brings in python standard library update
succeeds and freedombox-privileged.service is not restarted during 'apt-get
install' operation.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-09-01 23:14:25 +05:30
Sunil Mohan Adapa
411bec8f53
syncthing: Update Android clients to Syncthing-Fork
Closes: #2539.

- MPL 2.0 is a free software license.
https://www.gnu.org/licenses/license-list.html#MPL-2.0

Tests:

- Links in the app page work.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-31 11:03:20 +05:30
Joseph Nuthalapati
0a9341851f
power: logind config to ignore laptop lid close
Defined two settings for ignoring laptop lid close action. They handle
the two cases - running on battery power and running on external power.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-29 20:50:47 -07:00
Sunil Mohan Adapa
5cee6563cc
diagnostics: Fix notification severity when skipping tests
Fixes: #2531.

- Currently, when a diagnostics test is skipped, the notification shows up with
'error' severity. Instead of this, treat 'skipped' and 'not done' tests as
passed for the purpose of the notification.

Tests:

- Change code in package.py to set the result of diagnostic test to be 'SKIPPED'
and 'NOT_DONE', in both cases, the notification is not shown after running full
diagnostic runs.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-21 19:38:33 +05:30
Sunil Mohan Adapa
f27b222657
homeassistant: Fix typo in description
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-08-20 08:33:25 -07:00
Sunil Mohan Adapa
493dd7b3d3
email: Increment app version number to trigger dovecot restart
- Since we have important fixes deployed that we would like to get effected
immediately.

Tests:

- Not tested.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-08-18 20:31:25 -04:00
Sunil Mohan Adapa
e02263c93b
dovecot: Fix location of Inbox in dovecot 2.4
- Dovecot is upgraded from 2.3 to 2.4, users are unable to see the old mails
from before the upgrade. New mails can be received but old mails can't be
accessed. Old mails are still present in
/var/mail/{usernmame}/mail/mailboxes/... New mails are being stored in
/var/mail/{username}/u.*. Other mailboxes such as 'Sent' are not affected.

Tests:

- Mails received in the inbox before the upgrade to dovecot 2.4 are now visible.
Without the patch, pre-upgrade mails are not visible and newly received mails
are stored in /var/mail/{username} instead of /var/mail/{username}/mailboxes/...

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-08-18 20:31:17 -04:00
Sunil Mohan Adapa
8692bd20ee
dovecot: Allow login using email address with dovecot version 2.4
- Users were able to login using email address during dovecot 2.3 on Bookworm.
It was incorrectly assumed that there were not able to do that. Hence the
feature was not ported to 2.4. Early upgraders have reported this issue.

Tests:

- Login using full email address in the User Name field in Thunderbird. Without
the patch, the login fails and with the patch, it succeeds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-08-18 20:31:14 -04:00
Sunil Mohan Adapa
fe7d478099
sogo: Allow adding IMAP accounts and changing full name
Configuration provided by David (https://discuss.freedombox.org/u/david/)

Tests:

- Install SOGo without patch and apply the patch. The app setup is run and new
version of configuration file is installed. After logging into SOGo:

  - Mail settings shows an option to add IMAP account.

  - Editing Full Name in the identity of the default account is now possible.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-08-18 09:26:12 -04:00
Sunil Mohan Adapa
a70611a2e9
tests: Ensure that privileged daemon is not used during tests
- Fallback to sudo based privileged implementation. Privileged daemon tests are
still to be implemented.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-16 22:42:15 +05:30
Sunil Mohan Adapa
4220511eb7
ui: Use system's UI fonts on all platforms instead of Lato
- The most pleasant font on any system is the default system font.

  - It is the most optimized and styled font for the system considering screen
  type and screen sizes.

  - Used by all the system apps. Websites can become consistent with system apps
  by using system fonts. GNOME, KDE, Ubuntu, Android, Chrome OS, iOS, and MacOS,
  all have their own system fonts.

  - Changed by the user using OS settings if they don't like it.

- Many popular sites have started using system fonts.

- No extra fonts have to be loaded making page loading jerk free and much
faster. On the first FreedomBox UI page load, the largest item is the font.

- We won't have carry the binary woff files in FreedomBox source tree anymore.
Also eliminates a bunch of lintian warnings.

- Lato font was used because it is prescribed by the FreedomBox identity manual.
Lato can still be used in other places such as marketing materials.

Tests:

- System font is used in the UI. When system font is changed in Gnome settings
and browser is restarted, the new font is shown in the UI.

- Check that the overall layout of the app grids is not effected by the font
size change.

- Check that all the tables in the UI are not affected by the font change.

- Backups repository listing shows each backup archive in one line.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-03 06:29:38 +05:30
Sunil Mohan Adapa
1f98dfcad1
setup: Perform a check for app availability after the page loads
- Using AJAX request instead of loading the initial page slowly.

Tests:

- Unit tests passes.

- Deluge app is not available in bookworm and is available in Trixie.

- When app is available, no message is shown. Install button is enabled.

- When app is not available a proper warning alert message is shown. Install
button is disabled.

- During check for the availability, the progress message is shown. Install
button is disabled.

- When Javascript is disabled on the page, no availability check is performed.
Install button is enabled.

- When an exception is raised in the is-available view, error message is shown.
Install button is enabled.

- When is-available view return HTML response, error message is shown. Install
button is enabled.

- When is-available view invalid JSON response, error message is shown. Install
button is enabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-02 21:06:17 +05:30
Sunil Mohan Adapa
a99508a6b2
distupgrade: Update Trixie's release date as announced
Tests:

- Distribution upgrade page shows the updated date.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-08-01 20:00:40 -04:00
Sunil Mohan Adapa
30432aa9b6
distupgrade: Handle comments in sources.list file
Tests:

- Add a comment and /etc/apt/sources.list file. Distribution upgrade page does
not load and fails with an error.

- With the patch, page loads properly. Distribution upgrade can be triggered.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
[jvalleroy: Fix test for release date]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-08-01 20:00:32 -04:00
Benedek Nagy
bd656386b9
email: Add full text search capability
Add Full Text Search capability to Dovecot.
- Add 'dovecot-fts-xapian' to the list of packages for the email app.
- Add relevant configs for both dovecot 2.3 and 2.4
- Add a systemd timer to periodically clean search indexes

Configurations taken from plugin's upstream documentation:
https://github.com/grosjo/fts-xapian

Sunil:

- Tweak the dovecot 2.4 configuration. Remove explicit configuration same as or
close to default values.

- Drop the timer service for cleaning up the index. Dovecot documentation that
FTS plugins do it themselves.

- Drop the re-indexing command on setup. This could not be properly tested. On
first search, indexes will be created for mailboxes that don't have them.

Tests done:

- Perform a fresh install, on both Bookworm and Trixie, confirm the install is
successful, confirm the systemd service runs with exit 0.

- On Bookworm, apply the patches on an existing setup, confirm the patches apply
as expected.

- On a production like setup, set dovecot 2.4 to debug mode and check the
journal logs while receiving an email: The logs confirm that the fts module is
loaded and that it automatically creates a db for the indexes. I also opened the
newly created db file with less and confirmed that the human readable parts
contain my recent email.

- Using Sogo, perform a full search (including headers and body). Search works
and indexes are freshly created on all the folders.

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-23 15:46:11 -07:00
Sunil Mohan Adapa
38b3962bbc
email: Start servers during re-setup if they are not running
- This helps during distribution upgrade from dovecot 2.3 to 2.4. Dovecot will
stop running due to dovecot server 2.4 not understanding version 2.3
configuration files. When setup is re-run, starting the daemons again is the
right thing to do.

Tests:

- With email app installed, upgrade from bookworm to trixie. Dovecot is stopped
during distribution upgrade but after freedombox service runs, it recovers and
starts running again.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-20 07:54:09 -07:00
Benedek Nagy
271603a435
email: Add support for Dovecot 2.4
Sunil:

- When dovecot package is upgrade from 2.3 to 2.4 during distribution upgrade,
automatically re-run setup.

- Upgrade existing setups to new scheme by re-running setup with incremented app
version.

- Don't query dovecot version during app initialization. Instead overwrite the
DropinConfigs component to query dovecot version during setup and enable
operations.

- Use apt.Cache() to retrieve the installed version of dovecot package. Use
plinth.utils.Version to parse the version and perform a comparison.

- Split even configuration files that have not changed for simplicity.

- Add/update links in Dovecot configuration files.

Tests:

- Install email app on a testing container. Ensure that all files in
/etc/dovecot/conf.d/ are linked properly to 2.4 versions. TLS configuration is
accurate. Use Sogo to test login and sending mails.

  - User with LDAP account and correct password is able to login.

  - User without LDAP account or incorrect password is unable to login.

  - Send mail with Sogo to another account on the server. Notice that mails are
  stored in /var/mail/{user}/mail/ with mail:mail ownership in mbox format.

  - Logging in with email such as user@example.com works. Capital letters are
  allowed.

  - "Archive", "Drafts", "Sent", "Junk", "Trash" folders are automatically
  created and are marked with special flags. Creating additional folders such
  as "Sent Items" also results in them having special flags.

  - Thunderbird is able to connect via SSL with a self-signed certificate
  exception.

  - When an example spam message is sent, it is automatically moved to "Junk"
  folder after getting marked by rspamd.

  - When a message is moved to Junk folder, it is learned as spam by rspamd as
  seen in its admin console.

  - When a message is moved out of Junk folder (to other than "Trash" folder),
  it is learned as not-spam by rspamd as seen in its admin console.

- Install email app on a stable container with patches. Ensure that all files in
/etc/dovecot/conf.d/ are linked properly to 2.3 versions. TLS configuration is
accurate. Use Sogo to test login and sending mails.

- Install email app on a stable container without patches. Apply patches. Ensure
that all files in /etc/dovecot/conf.d/ are linked properly to 2.3 versions. TLS
configuration is accurate for dovecot 2.3. Use Sogo to test login and sending
mails. Perform distribution upgrade to testing. Ensure that all files in
/etc/dovecot/conf.d/ are linked properly to 2.3 versions. TLS configuration is
accurate for dovecot 2.4. Use Sogo to test login and sending mails.

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-20 07:54:05 -07:00
Benedek Nagy
6605460df5
sogo: Fix typo in configuration for sieve server
Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-13 01:15:21 -07:00
Sunil Mohan Adapa
33dfc2cd41
dynamicdns: Fix a type check error
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-10 09:25:52 -07:00
Joseph Nuthalapati
8d98345e2d
dynamicdns: Switch update client to HTTP protocol
Fixes: #2520

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Use params= argument instead of incorrectly contacting query params]
[sunil: Recognize error responses properly]
[sunil: Minor styling fixes]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-09 20:54:46 -07:00
Joseph Nuthalapati
9fa1e18aa3
diagnostics: Add collapsible sections for results
Uses Bootstrap accordion class to do collapsible sections without adding any
custom CSS or JavaScript.

Closes #2479

Sunil:

- Create one accordion instead of many. Automatically collapsing previously
expanded item works.

- Fix dangling </section> close tag.

- Embrace accordion styling instead of header-like styling for headers. The
tables with results are distinguished from the header due to header
highlighting and margins around tables.

- Fix issue with multiple 'passed' badges show for single app. 'regroup'
template tag expects the dict to be already sorted by the selected property.

- Internationalize badge text in headers.

- Right align badges. Move repair button into the accordion header for better
appearance.

- Wrap the header on small screen sizes.

- Add additional necessary HTML attributes.

- Change 'Loading...' to 'Running...' more accurately specify the status.

- Show Running and Exception statuses in header.

- Use 'text-bg-' classes instead of 'bg-' for allow automatic selection of text
color.

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>
2025-07-07 15:35:14 -07:00
Joseph Nuthalapati
3798e519d4
featherwiki: Disable caching to avoid 412 errors
Synchronize the Apache server configuration with TiddlyWiki.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Drop no-cache and must-revalidate directives as they are redundant]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-07 12:27:54 -07:00
Joseph Nuthalapati
98d4327c49
tiddlywiki: Avoid "412: Precondition failed" error
Apache sends an instruction to the browser to not cache the TiddlyWiki file at
all. This forces the browser to fetch the new version after each write avoiding
the case "file changed on server".

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Drop no-cache and must-revalidate directives as they are redundant]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-07-07 12:27:35 -07:00