24 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
f9b186e14f
*: Add type hints for app init methods
- This is so that the methods will be checked by mypy. This should help identify
any incorrect initialization of components.

- Remove unused self.repos in GitwebApp.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-03-09 14:22:14 -05:00
Sunil Mohan Adapa
f6ef0135d2
*: 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>
2022-08-15 10:36:19 -04:00
Sunil Mohan Adapa
bc3a879ead
first_boot: Drop use of loaded_modules and use App.list
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:38:34 -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
b609abe7e5
*: Use the App's state management API
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:37:40 -05:00
Joseph Nuthalapati
d92ca09e19
framework: Remove module init() functions
Fixes #1906

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-08-03 18:06:48 -04: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
Joseph Nuthalapati
ba9af6ddff
firstboot: Prompt for secret during firstboot welcome
- A freshly installed FreedomBox can be hijacked by a third party and an admin
  account can be created which can be used to inject malware or simply take over
  the instance. Password protecting the firstboot step is a good way to avoid
  this. A secret will be displayed to the user as soon as the Plinth package
  is installed, which they have to enter during firstboot welcome step. Also,
  writing this to a file in plinth's home in case the user loses it.
- This protection is not applicable for images built by freedom-maker and for
  Amazon Machine Images.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-07-04 20:22:54 -04:00
Sunil Mohan Adapa
8f0e2d6381
Rename Plinth to FreedomBox in module doc strings
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:25 -05: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
4826f70343
firstboot: Fix caching issue in collecting first_boot steps
- Created a django singal to indicate that a setup happened

- Clearing the cached list of firstboot_steps each time the above signal is sent

Closes #1193.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2018-01-30 10:48:48 +05:30
James Valleroy
e5b32aa6b4
Add TODO for confusing firstboot step id
Update changelog.
2017-01-02 15:05:27 -05:00
fonfon
e1aa78d25a
Firstboot, KVStore: merge old firstboot state fields
- use a migration to merge the old 'firstboot_state' and 'setup_state'
  fields into 'firstboot_completed' which is a more accurate name
- introduce kvstore.delete()
2017-01-02 15:05:24 -05:00
fonfon
3af82ab14e
Firstboot: minor variable renaming and cleanup 2017-01-02 15:05:20 -05:00
James Valleroy
9da23fa560
firstboot: Only add steps from modules if they have completed setup 2016-12-04 15:24:54 -05:00
Sunil Mohan Adapa
f457a0bdd3
first_boot: Fix various issues and refactor
- Fix major regression so that steps can submitted multiple times in
  case of errors.

- Don't serve the welcome page (and other pages) only once.  Show it
  until action is an taken.  This does not apply to the final step.

- Eliminate all coupling of one first boot step on another.

- Move first boot helper methods to __init__.py instead of middleware as
  it is more generic than middleware.

- Implement caching the first boot state to avoid an SQL query on every
  page load.  The down side is that if first boot state is modified in
  the backend DB outside Plinth, Plinth will need to be restarted to
  catch the modified value.

- Mark some methods as private.

- Refactor middleware code for slightly more simplicity.

- Don't show sidebar in pagekite first boot step.  Set width like other
  pages.
2016-12-04 15:24:48 -05:00
Sunil Mohan Adapa
56686b7148
firstboot: Rename views/urls to be non-numeric 2016-12-04 15:24:36 -05:00
Sunil Mohan Adapa
c37aa0fbd5
firstboot: Indentation & styling fixes
pycodestyle version used is 2.1.0 with default arguments.
2016-12-04 15:24:31 -05:00
Hemanth Kumar Veeranki
0290f68ae6
Removed redirection for login and help urls
Changed the redirection in state0 template
2016-11-03 22:06:05 -04:00
Hemanth Kumar Veeranki
0332d4489e
Added code for modules to register for first_boot #529 2016-11-03 22:06:00 -04:00
Sunil Mohan Adapa
60c4c17f94
firstboot: Use new setup mechanism 2016-02-13 13:52:29 +05:30
fonfon
94040e402a refactored first boot module; user is now logged in automatically after an account is created 2014-10-20 00:15:49 +05:30
Sunil Mohan Adapa
65fa648d9f Reorganize python sources into 'plinth' package 2014-08-29 12:57:27 +05:30