26 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
623604649e
views: Implement an API to retrieve the readiness status in JSON
- This can have may uses such as:

  - Waiting properly on the reboot page until the system has been restarted
  while showing the status.

  - Or, waiting for first setup to complete before running functional tests.

  - Or, monitoring for the health status of FreedomBox in general.

- The page is public as all the information conveyed there is also already
public. Should we introduce any sensitive information there such as
'operations_in_progress', we can provide that information only to
administrators.

Tests:

- Visiting /plinth/status/ shows the status in JSON. Using curl to retrieve the
information is also possible.

- During the first setup 'is_first_setup_running' is 'true'. After it has
completed, it is 'false'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-11-03 13:53:59 +02:00
Sunil Mohan Adapa
e82d959c85
views: Add a menu entry and view for showing logs of an app
Tests:

- View logs menu entry is shown only for apps with daemons. It is now shown for
others such as Backups. It does not add menu for apps such as power.

- View logs entry for Date & Time shows show logs for multiple units. View logs
entry for Nextcloud shows many units.

- The textarea occupies full width. It is not editable. It is always scrolled to
the bottom. Control-A and Control-C selects all the text in it. It is re-sizable
vertically.

- The header shows unit name and unit description correctly.

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
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
4e900be128
ui: Show breadcrumbs on deeper pages
- Don't show them on section pages: home, apps, system and help pages.

- Tweak the appearance so that home icon is bigger, spacing between crumbs is
larger and to use '>' as separator.

- Change the name of the help menu item to show the value in breadcrumbs.

- Change the URLs for anchors in the help page so that they don't appear as part
of the breadcrumbs.

Tests:

- Section pages: home, apps, system and help pages don't have breadcrumbs.

- Visit various pages. Breadcrumbs are shown and all the links in the
breadcrumbs work as expected.

- Mobile view looks good.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-12-25 12:25:05 +02:00
Sunil Mohan Adapa
6e557dd1e9
system: Organize items into sections
Closes: #2161.

- Sections are ordered by importance on which administrator must act after
setting up the system.

- Consistent order across all the languages.

- Update the styling for the section hearers.

  - For system section, make them compact.

  - Make them look like a header text (with underline) rather than a
    divider (like in a menu).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-03-16 09:17:35 +02:00
Sunil Mohan Adapa
da9b771627
app: Implement advanced option to rerun app setup
Tests:

- Install bepasty app. Notice the extra menu option in the advanced menu.
Clicking it installs the app and run setup. Progress is shown during the re-run
of setup. When operation is completed 'App updated' notification is shown.

- Test Zoph app setup page.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-07-31 19:47:15 -04:00
Sunil Mohan Adapa
e1b4c2e52b
views: Implement a view to uninstall an app
- Take backup of the app before uninstall.

- Allow selecting the backup repository for backup.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-29 08:28:51 -04:00
Sunil Mohan Adapa
895d8cffbc
sso: Adjust URL to CAPTCHA page needed by Django security fix
Fixes: #2170.

Starting with Django 2.2.25, re_path behavior has changed. When the regular
expression ends with a '$', a full match is performed with the regular
expression. This breaks the behavior of how we are currently matching the locked
URLs for CAPTCHA based login forms.

Tests:

- All tests are done on Debian stable with Django 2.2.25 and on Debian unstable
with Django 3.2.10.

- Go to home page, click on login link. Enter wrong password three times.
CAPTCHA page is show with URL ending with /locked. Type the correct password and
login will be successful.

- Install tt-rss. Logout. Go to /tt-rss/, redirection will happen to login page.
Enter wrong password three times. CAPTCHA page is show with URL ending with
/locked. Type the correct password and login will be successful.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-01-16 10:15:32 -05:00
Sunil Mohan Adapa
cd2b2f5f2c
*: Use django.urls.re_path() instead of its alias url()
- In Django 2.2 django.conf.urls.url() is an alias to django.urls.re_path().

- In Django 4.0, url() function will be removed. On Django 3.2, it throws a
warning that this function will be removed in future.

Tests:

- Run unit tests with Django 3.2 and Django 2.2.

- With Django 3.2 there are no warnings when running unit tests and when running
FreedomBox Service.

- Visit a few affected apps with both Django versions.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:47 -04:00
Sunil Mohan Adapa
b3663075a0
notification: Expand and clarify restriction on id property
- This is to allow arbitrary strings to be part of id property via base32
encoding.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-15 18:00:53 -07:00
Sunil Mohan Adapa
9368504da5
*.py: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:38:55 +02:00
Sunil Mohan Adapa
afe179d91d
views: A view to dismiss notifications
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-02-10 18:13:25 -05:00
Alice Kile
eb83e00011
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-07 13:08:35 -05:00
James Valleroy
893bd2b4d6
apps: Separate enabled and disabled apps
- Add 'secondary' flag to menu items.

- Mark apps as 'secondary' when disabled.

- Extend TemplateView for apps index.

- Add card-container for disabled apps.

Closes #1309

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-05-07 16:57:55 -07:00
Sunil Mohan Adapa
1b95432217
locale: Make language selection page URL consistent
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-21 21:06:53 +01:00
Sai Kiran Naragam
5cff5629d8
locale: Anonymous users can set preferred language
Logged-in user flow is pending.

Check [How django discovers language preference]:
https://docs.djangoproject.com/en/1.10/topics/i18n/translation/#how-django-discovers-language-preference

Signed-off-by: Sai Kiran Naragam <saikiran.rguiiit@gmail.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2018-02-21 21:06:07 +01:00
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
Joseph Nuthalapati
5aabac036c
sso: Fix conflict between urls of sso and captcha
django-simple-captcha's /refresh url's regex was matching anything that ends
with the word "refresh". This was clashing with sso/refresh. Changed the regex
for captcha's url to captcha/refresh.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-12-02 17:03:18 -05:00
Joseph Nuthalapati
111f8f9145
sso: Fixes for regressions after adding captcha and axes
- Change sso refresh url to refresh-pubtkt since refresh was conflicting with
  captcha's image refresh url.
- Fix datetime.timedelta calculation for refresh interval. Now validity of
  ticket is 30 seconds as it was intended to be. It was wrongly set to 30 days
  earlier.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-12-02 17:03:07 -05:00
Joseph Nuthalapati
fc9ce8e6dd
Override monkey-patched LoginView from django-axes 3.0.3
- Fixes #1154
- Fixes #1138

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-11-30 20:22:01 -05:00
Joseph Nuthalpati
f330d09ec9
sso: Add captcha validation on 3 failed attempts
- clearing ip address correctly is not implemented yet
- currently clearing all ip addresses

Signed-off-by: Joseph Nuthalpati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-10-17 22:07:57 -04:00
Joseph Nuthalpati
62f26433e8
Add django-simple-captcha in the login page
User will be shown captcha in the second attempt to login if login
fails in the first attempt.

Signed-off-by: Joseph Nuthalpati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-10-17 22:07:12 -04:00
Johannes Keyser
3c4c770404
disks: add low disk space warning to system and disks page
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2017-08-31 15:48:23 +05:30
Sunil Mohan Adapa
ee7cc98fee
apps, system: Remove modules and merge into main
- Remove apps and system modules and merge their views into main views.

- Move main_menu from cfg into menu.py.

- Remove dependencies of other modules on apps and system modules.

- Update tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2017-05-05 22:31:45 -04:00
Sunil Mohan Adapa
1e8cc6f290
Cleanup final use of urls.patterns() method
- As deprecated in Django 1.9.
2016-02-13 13:49:30 +05:30
Sunil Mohan Adapa
65fa648d9f Reorganize python sources into 'plinth' package 2014-08-29 12:57:27 +05:30