searx: Add option to allow public access to the application

[jvalleroy] Resolved merge conflict to use shortcut component.

Fixes #1590

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati authored and James Valleroy committed 2019-06-09 10:37:16 -04:00
1 parent 6a9133c305
commit 2d85b61199
10 files changed
+138 -22

No files matched your search

+21 -2
View File
@@ -20,11 +20,11 @@ Configuration helper for searx.
"""
import argparse
import augeas
import os
import secrets
import shutil
import augeas
import yaml
from plinth import action_utils
@@ -45,6 +45,12 @@ def parse_arguments():
subparsers.add_parser(
'setup', help='Perform post-installation operations for Searx')
subparsers.add_parser('enable-public-access',
help='Enable public access to the Searx application')
subparsers.add_parser(
'disable-public-access',
help='Disable public access to the Searx application')
safe_search = subparsers.add_parser(
'set-safe-search',
help='Set the default filter for safe search on Searx')
@@ -81,7 +87,8 @@ def _update_uwsgi_configuration():
aug.set('/augeas/load/inifile/lens', 'Puppet.lns')
aug.set('/augeas/load/inifile/incl[last() + 1]', UWSGI_FILE)
aug.load()
aug.set('/files/etc/uwsgi/apps-available/searx.ini/uwsgi/autoload', 'false')
aug.set('/files/etc/uwsgi/apps-available/searx.ini/uwsgi/autoload',
'false')
aug.save()
@@ -153,14 +160,26 @@ def subcommand_enable(_):
"""Enable web configuration and reload."""
action_utils.uwsgi_enable('searx')
action_utils.webserver_enable('searx-freedombox')
action_utils.webserver_enable('searx-freedombox-auth')
def subcommand_disable(_):
"""Disable web configuration and reload."""
action_utils.webserver_disable('searx-freedombox')
action_utils.webserver_disable('searx-freedombox-auth')
action_utils.uwsgi_disable('searx')
def subcommand_enable_public_access(_):
"""Enable public access to the SearX application."""
action_utils.webserver_disable('searx-freedombox-auth')
def subcommand_disable_public_access(_):
"""Disable public access to the SearX application."""
action_utils.webserver_enable('searx-freedombox-auth')
def main():
"""Parse arguments and perform all duties."""
arguments = parse_arguments()