21 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
e8ea6fff17
pagekite: Use privileged decorator for actions
Tests:

- Functional tests work
- Initial setup succeeds
- Configuration can be set and new configuration is properly reflected in app
  page and configuration files.
- A new service can be added and reflects in configuration files.
- Service can be deleted and reflects in configuration files.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:52:44 -04:00
Sunil Mohan Adapa
900c0d30b9
*: Drop module level app property
module.app property usage is greatly reduced because setup() and force_upgrade()
method are now part of App class instead of at the module level. Remove the
remaining minor cases of usage and drop the property altogether.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:29 -04:00
Sunil Mohan Adapa
74214c18ae
*: Use Django gettext functions instead of ugettext
- ugettext functions will be removed in Django 4.0. Each use emits a warning
when running with Django 3.2. Since we have warnings enabled in developer mode,
we see quite a few messages because of this.

- ugettext is already a simple alias of gettext. So, no regressions are
expected.

Tests:

- Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine.

- Using Django 3.2 there are no warnings related to removal of ugettext
functions.

- Ran regular unit tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:16 -04:00
Sunil Mohan Adapa
ec5f994068
pagekite: Don't announce unconfigured kite as a valid domain
Closes: #1891.

As soon as the app is installed, the default configuration has NAME.pagekite.me.
This is incorrectly announced as a valid domain to the system. Avoid this
behavior by never announcing this default configured kite name.

Tests:

- Install Pagekite. Observe that the default kite name is not announced as a
domain (confirmed in Name Services). With the patch, it will.

- Change the domain to anything other than default. It is announced. LE tries to
obtain cert. Name Services list the domain.

- Change the domain back to default kite name. It is not announced. Old domain
is removed.

- Start FreedomBox with Pagekite configured with default domain. It is not
announced.

- Start FreedomBox with Pagekite configured with non-default domain. It is
announced.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-09-27 09:54:14 -04:00
Sunil Mohan Adapa
66b03a943b
pagekite: Remove app enabled checking from getting configuration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-03-15 09:27:47 +02:00
Sunil Mohan Adapa
67e4b28aee
pagekite: Simplify code notifying domain name changes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-03-15 09:27:26 +02:00
Sunil Mohan Adapa
b99472409c
pagekite: Don't signal new domain on init if app is disabled
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-03-15 09:27:15 +02:00
Sunil Mohan Adapa
4247a0bd5d
pagekite: Merge all the configuration retrieval actions
- Merge actions is-disabled, get-frontend, get-kite and get-services into
get-config. This improves the initial startup time for FreedomBox service and
also the page load time for pagekite app. This also significantly simplifies the
code.

- Only use the pagekite service enabled status determine if pagekite is enabled.
Don't use the configuration setting.

- For custom services, provide additional data such as display URL from
get-config action. This removes the need for additional processing
prepare_service_for_display() and template tag create_pagekite_service_url.

- Also reduce the number of times configuration is retrieved to 1 when loading
the app view page and during startup of FreedomBox service.

- Ensure that all keys of the configuration always present and use that to
simplify some code.

- Remove ContextMixin from view DeleteServiceView that does not need it. Use
AppView and drop ContextMixin.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-03-15 09:26:30 +02: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
5b2df956e8
pagekite: Use the new app toggle button
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
2019-11-20 06:26:54 +05:30
Sunil Mohan Adapa
ba4afd2a09
names: Use new API in all apps
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:39:56 -04:00
Sunil Mohan Adapa
e4351b6b97
Introduce daemon component to handle systemd units
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:18:02 -04: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
fonfon
1dbc566515 names module, pagekite: moved updating names to utils 2015-11-25 15:22:27 +01:00
Sunil Mohan Adapa
3df1a88824 Switch to Django i18n for code strings
Django i18n layer is on top of gettext and provide may crucial features
such as per-request locales, lazy translations etc.
2015-11-13 22:08:43 +05:30
Sunil Mohan Adapa
670be77b9a pagekite: Fix issue with setting port
- When the current configuration does not contain a port and we try to
  set the port for the frontend server, it fails.  This patch fixes
  that.

- Minor styling and spelling fixes.

- Make sure that if port is not set for frontend, it will be set on
  saving the form.
2015-10-11 17:54:26 +05:30
fonfon
aad69deb6e Display correctly if service is PageKite is enabled 2015-10-11 17:19:35 +05:30
fonfon
96a272b3b0 Added explicit port setting to pagekite configuration 2015-10-11 17:19:35 +05:30
Sean Alexandre
21b9a5b02a Passwords now sent over stdin instead of command line.
Fixes Issue #166:
Don't pass passwords on command line
https://github.com/freedombox/Plinth/issues/166

This issue was for 4 modules: Transmission, Pagekite, DynamicDNS, and Ikiwiki.
2015-08-23 15:20:08 +05:30
Sunil Mohan Adapa
07e2c0ce14 Don't use actions to check if service is running
- To check whether a service is running does not require root
  privileges.  This can directly be done from a module without any
  action.

- Since actions are allowed to be run using sudo, introducing
  unnecessary sub-commands increases attack surface.

- Simple functions calls are unnecessarily being converted to command
  line invocations and involve parsing response.

- There is a lot of repeated code because of this that can be
  eliminated.

- To generalize this, we need to make all non-root system operations
  directly from module instead of delegating to action commands.
2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa
517c364559 pagekite: Move to using python3-augeas
- Merge actions/pagekite_util.py into plinth/modules/pagekite/util.py.

- Rename plinth/modules/pagekite/util.py to utils.py.

- Add python-augeus as dependency.

- Move actions/util.py to plinth/action_utils.py and update services
  that use it.

- Rename _run() method to run() as it is being used publicly.

- Import the utils in a more conventional manner.

- Move all python2 bits to python3.
2015-07-19 15:37:43 -04:00