Ability to use lru_cache(user_function) was only introduced in Python 3.8.
Buster has Python 3.7. This causes startup failure in Buster. Fix this by using
the older API for lru_cache instead of the new one.
Tests:
- On stable and testing, starting the Plinth daemon and visiting the performance
page should work.
- Adding a print statement in the _get_url() method shows that it is only called
once, ever.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Helps: #1962
Shown an alarming warning in connection_show page (only) for the primary
connection. Captions 'Deactivate' and 'Delete' buttons, now explicitly
mention the primary connection and they are placed within the warning
box.
Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Primary connection is not the same as connection user is using]
[sunil: Reduce the importance of primary connection as it is just default route]
[sunil: Update primary connection message]
[sunil: Fix the use of exclamation icon for screen readers as per bootstrap]
[sunil: Don't place buttons inside the warning, as it is non-intuitive UI]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Closes: #1974
BTW: Javascript IPV4/6 hide/show arrangements triggered on page load.
Otherwise page loads form fields inconsistently.
Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Fix the use of RadioSelect widget]
[sunil: Alter the wording of what each type means]
[sunil: Drop the help text for radio group as it is mostly repetitive]
[sunil: js: Make the entire jQuery code run on document ready]
[sunil: js: Revert unneeded double call to change methods, change() is enough]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Made the method private to reduce the exposed API of the module]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Pull the delete button in the connection show page to the right to prevent
hitting it by accident.
Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Use a new consistent style compatible with bootstrap4]
[sunil: Styled the delete button with danger color]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Fixes the issue that after disabling an app which has a daemon alias,
only the alias was disabled and the real service kept still running.
Closes#2019
Test on Debian testing: After disabling the bind app,
check that both 'bind9' and 'named' services are not running.
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Closes: #2022.
- Differently URL based on version of Cockpit used.
- Lazily evaluate when necessary.
- Cache the result.
[sunil: Use subprocess.run() instead of getoutput() for security]
[sunil: Use long form arguments in command invocation for readability]
[sunil: Perform isort]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Tests in testing container:
- SSH, Service Discovery, and Web Server are shown as enabled on
Firewall page.
- FreedomBox interface can be accessed after disabling Cockpit.
Closes: #2016.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
'syncthing' group name was replaced by 'syncthing-access' in MR !1995,
update the sharing app functional test to use this new group name.
Test:
- Update the sharing app Apache2 configuration. Run the sharing app tests.
All tests pass.
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
- Keep a count of number of consecutive failures. Reset the count on a
successful backup.
- Keep the count for each repository.
Tests performed:
- Insert an exception into method for running a scheduled backup.
- When the FreedomBox is run in develop mode, it attempts to take backups every
3 minutes.
- It fails and shows the notification. Text is good. The error count is 1 and
error text is same as exception text. Go to backups button redirects to backup
page.
- In another 3 minutes another attempt is made and count increments this time.
- If the notification is dismissed, after another attempt is made, notification
comes back with incremented count.
- When the exception is removed and FreedomBox is restarted, schedule backup
succeeds and notification is dismissed automatically.
- When backup is deleted and exception is reintroduced, the notification comes
back with count reset to 1.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Tests performed:
- Ensure that backups module is setup from version zero by deleting entry in DB.
Start FreedomBox. Observe the notification comes up.
- Dismiss button dismiss the notification.
- Go to button takes us to the backups module.
- Incrementing the version number of the backups app does not show the
notification again.
- Starting with old code, the notification show up when FreedomBox is run.
Incrementing the version number of the backups app after that does not show the
notification again.
- Enable a schedule and the notification should be dismissed.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- This will lead to backups only once a day or so.
- In case of errors, backups are tried every hour.
- Cleanups are also triggered but cleanups happen only after a successful
backup.
Tests performed:
- In development mode, a new backup is taken after 3 minutes of enabling a
repository's schedule.
- Error in one repository does not effect the backup of other repositories.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This is a simplification of UX by allowing only a single schedule to be attached
to each repository.
Tests performed:
- Editing a schedule works for root, local and remote repositories.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Simplify save() method such that a simple load(uuid).save() does not destroy
data. Currently, the verified parameter is lost.
- Drop unused store_credentials argument to save().
- Make verified a property of the SSH repository and instantiate with
it properly.
Tests performed:
- Adding a new remote repository works with SSH verification from unknown and
known hosts.
- Mounting and unmounting works.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Useful for abstracting the mount() operation that is not available on non-remote
repositories.
- On non-remote repositories do nothing.
- On remote repositories, mount the location in preparation for operations on
the repository.
Tests performed:
- When an SSH repository is unmounted before a schedule backup, it is
automatically mounted for listing, backup and cleanup at scheduled time.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- This allows schedule to be stored along with the repository information.
Tests performed:
- Storing/retrieving a schedule along with root repository works.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Tests performed:
- Schedules are able to store and retrieve comments properly. Information about
schedule backups stored in comments is extracted properly.
- Unit tests run.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Tests performed:
- Ran all backup related unit tests.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Make the code work outside backups module.
- Move code to main.js so that any app can use this functionality.
- Make the code work for multiple such form fields in the same page.
- Use only pure JS, don't use jQuery.
- Add event handlers only after DOM content is loaded to avoid race conditions.
Tests performed:
- Checking the select-all button checks all options.
- De-checking the select-all button de-checks all options.
- De-checking one option when everything is checked, de-checks the select-all
button.
- Checking the last option when everything else is checked, checks the
select-all button.
- When loading a schedule page with all options checked, select-all button is
checked.
- When loading a schedule page with some option unchecked, select-all button is
unchecked.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Hide the warning 'The Syncthing admin interface is configured to allow
remote access without a password. ... '. This warning is unnecessary because
we are using authentication through Apache.
- Hide the usage reporting notification by declining reporting, if the user
has not made a choice yet.
- Call add_user_to_share_group() in setup() before starting syncthing to
avoid another syncthing daemon restart.
- Add a functional test for hidden notification messages.
- Functional tests: Improve the method to check if the javascript
loading process is complete.
Closes#1581
Tests performed:
- The syncthing app is installed successfully on Debian testing
- All syncthing tests pass on Debian stable and testing
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
When installing the syncthing app, create a LDAP group named "syncthing-access"
instead of "syncthing", because the app creates the "syncthing" system group
to run the syncthing daemon. Duplicate group names can cause some ambiguity as
described in #2008.
- Rename the existing "syncthing" LDAP and Django group to "syncthing-access".
- Update existing web shares to be accessible with new group name
- Functional tests: Add tests to check access to the syncthing site with a user
in the syncthing-access group and no group.
- Functional tests: Scroll to the edit button before clicking. Fixes some test
failures on a smaller browser window.
Fixes#2008
Tests performed on Debian stable and testing:
- Check that the existing "syncthing" group is renamed after upgrade:
1) Without patch applied, install syncthing, create a user in group "syncthing".
2) Apply patch, update Apache2 config file /etc/apache2/conf-available/syncthing-plinth.conf,
reload Apache2, restart plinth.
3) Check that the created user is now in the "syncthing-access" group and can
access /syncthing site.
- Check that the app upgrade succeeds when there are no users in the syncthing group.
- Create a web share accessible by the 'syncthing' group. Check that after the upgrade,
the share is accessible to a member of syncthing-access group.
- All the syncthing app tests pass.
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
The tahoe-lafs package is removed from Bullseye due to missing python3
support. The package may be reintroduced later.
I think the app can simply be disabled, because in Buster it was
marked as Advanced, and not really usable anyway.
Closes: #1856.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>