mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
searx: Styling fixes
- Internet is used instead of 'internet' in Plinth elsewhere. - Use common error messages instead of specific errors to reduce l10n effort. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
0e9d10bff5
commit
f054703d3a
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- mode: python -*-
|
|
||||||
#
|
#
|
||||||
# This file is part of Plinth.
|
# This file is part of Plinth.
|
||||||
#
|
#
|
||||||
@ -38,10 +37,10 @@ def parse_arguments():
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||||
|
|
||||||
subparsers.add_parser('enable', help='Enable searx')
|
subparsers.add_parser('enable', help='Enable Searx')
|
||||||
subparsers.add_parser('disable', help='Disable searx')
|
subparsers.add_parser('disable', help='Disable Searx')
|
||||||
subparsers.add_parser(
|
subparsers.add_parser(
|
||||||
'setup', help="Perform post-installation operations for Searx")
|
'setup', help='Perform post-installation operations for Searx')
|
||||||
|
|
||||||
safe_search = subparsers.add_parser(
|
safe_search = subparsers.add_parser(
|
||||||
'set-safe-search',
|
'set-safe-search',
|
||||||
@ -106,11 +105,13 @@ def subcommand_get_safe_search(_):
|
|||||||
|
|
||||||
|
|
||||||
def read_settings():
|
def read_settings():
|
||||||
|
"""Load settings as dictionary from YAML config file."""
|
||||||
with open(SETTINGS_FILE, 'rb') as settings_file:
|
with open(SETTINGS_FILE, 'rb') as settings_file:
|
||||||
return yaml.load(settings_file)
|
return yaml.load(settings_file)
|
||||||
|
|
||||||
|
|
||||||
def write_settings(settings):
|
def write_settings(settings):
|
||||||
|
"""Write settings from dictionary to YAML config file."""
|
||||||
with open(SETTINGS_FILE, 'w') as settings_file:
|
with open(SETTINGS_FILE, 'w') as settings_file:
|
||||||
yaml.dump(settings, settings_file)
|
yaml.dump(settings, settings_file)
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
FreedomBox module to configure Searx
|
FreedomBox app to configure Searx.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -44,7 +44,7 @@ name = _('Searx')
|
|||||||
short_description = _('Web Search')
|
short_description = _('Web Search')
|
||||||
|
|
||||||
description = [
|
description = [
|
||||||
_('Searx is a privacy-respecting internet metasearch engine. '
|
_('Searx is a privacy-respecting Internet metasearch engine. '
|
||||||
'It aggregrates and displays results from multiple search engines.'),
|
'It aggregrates and displays results from multiple search engines.'),
|
||||||
_('Searx can be used to avoid tracking and profiling by search engines. '
|
_('Searx can be used to avoid tracking and profiling by search engines. '
|
||||||
'It stores no cookies by default.')
|
'It stores no cookies by default.')
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
Plinth form for configuring Searx.
|
Django form for configuring Searx.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
Plinth views for Searx.
|
Django views for Searx.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
@ -51,13 +51,10 @@ class SearxServiceView(views.ServiceView):
|
|||||||
if str(old_data['safe_search']) != form_data['safe_search']:
|
if str(old_data['safe_search']) != form_data['safe_search']:
|
||||||
try:
|
try:
|
||||||
actions.superuser_run(
|
actions.superuser_run(
|
||||||
'searx',
|
'searx', ['set-safe-search', form_data['safe_search']])
|
||||||
['set-safe-search',
|
messages.success(self.request, _('Configuration updated.'))
|
||||||
str(form_data['safe_search'])])
|
|
||||||
messages.success(self.request,
|
|
||||||
_('Safe search setting updated'))
|
|
||||||
except ActionError as e:
|
except ActionError as e:
|
||||||
messages.error(self.request,
|
messages.error(self.request,
|
||||||
_('Failed to update safe search setting'))
|
_('An error occurred during configuration.'))
|
||||||
|
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user