searx: Show status of public access irrespective of enabled state

- When the app is disabled, configuration can still be updated. Attempts to
enable the setting while app is disabled seemingly fail.

Tests:

- Functional tests pass.

- When public access is enabled and app is disabled, the page still shows public
access as enabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-09-29 17:11:10 -07:00 committed by James Valleroy
parent 52f42a4f74
commit 1e30b4c8fc
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 4 additions and 5 deletions

View File

@ -480,8 +480,9 @@ def _update_searx(reenable=False):
Re-enable if previously enabled."""
if pathlib.Path('/etc/searx/settings.yml').exists():
print('Updating searx search engines list...', flush=True)
subprocess.run(['/usr/share/plinth/actions/searx', 'setup'],
check=True)
subprocess.run([
'/usr/share/plinth/actions/actions', 'searx', 'setup', '--no-args'
], check=True)
if reenable:
print('Re-enabling searx after upgrade...', flush=True)
subprocess.run([

View File

@ -4,7 +4,6 @@
from django.contrib import messages
from django.utils.translation import gettext as _
from plinth import app as app_module
from plinth import views
from plinth.modules import searx
@ -22,8 +21,7 @@ class SearxAppView(views.AppView):
"""Return the status of the service to fill in the form."""
initial = super().get_initial()
initial['safe_search'] = privileged.get_safe_search()
initial['public_access'] = searx.is_public_access_enabled() and \
app_module.App.get('searx').is_enabled()
initial['public_access'] = searx.is_public_access_enabled()
return initial
def form_valid(self, form):