mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
searx: Set page title to 'FreedomBox Web Search'
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
d42492d4df
commit
314f95d562
@ -25,9 +25,11 @@ import os
|
|||||||
import secrets
|
import secrets
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from plinth import action_utils
|
from plinth import action_utils, cfg
|
||||||
from plinth.utils import YAMLFile, gunzip
|
from plinth.utils import YAMLFile, gunzip
|
||||||
|
|
||||||
|
SETTINGS_FILE = '/etc/searx/settings.yml'
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
"""Return parsed command line arguments as dictionary."""
|
"""Return parsed command line arguments as dictionary."""
|
||||||
@ -60,25 +62,33 @@ def _copy_uwsgi_configuration():
|
|||||||
|
|
||||||
def _generate_secret_key():
|
def _generate_secret_key():
|
||||||
""" Generate a secret key for the Searx installation."""
|
""" Generate a secret key for the Searx installation."""
|
||||||
settings_file = '/etc/searx/settings.yml'
|
|
||||||
|
|
||||||
# Create settings file if not exists
|
if not os.path.exists(SETTINGS_FILE):
|
||||||
if not os.path.exists(settings_file):
|
|
||||||
example_settings_file = '/usr/share/doc/searx/examples/settings.yml.gz'
|
example_settings_file = '/usr/share/doc/searx/examples/settings.yml.gz'
|
||||||
gunzip(example_settings_file, settings_file)
|
gunzip(example_settings_file, SETTINGS_FILE)
|
||||||
|
|
||||||
# Generate and set a secret key
|
# Generate and set a secret key
|
||||||
with YAMLFile(settings_file) as settings:
|
with YAMLFile(SETTINGS_FILE) as settings:
|
||||||
secret_key = secrets.token_hex(32)
|
secret_key = secrets.token_hex(32)
|
||||||
settings['server']['secret_key'] = secret_key
|
settings['server']['secret_key'] = secret_key
|
||||||
|
|
||||||
action_utils.service_restart('uwsgi')
|
action_utils.service_restart('uwsgi')
|
||||||
|
|
||||||
|
|
||||||
|
def _set_title():
|
||||||
|
"""Set the page title to '{box_name} Web Search'."""
|
||||||
|
with YAMLFile(SETTINGS_FILE) as settings:
|
||||||
|
title = 'FreedomBox Web Search'
|
||||||
|
settings['general']['instance_name'] = title
|
||||||
|
|
||||||
|
action_utils.service_restart('uwsgi')
|
||||||
|
|
||||||
|
|
||||||
def subcommand_setup(_):
|
def subcommand_setup(_):
|
||||||
"""Post installation actions for Searx"""
|
"""Post installation actions for Searx"""
|
||||||
_copy_uwsgi_configuration()
|
_copy_uwsgi_configuration()
|
||||||
_generate_secret_key()
|
_generate_secret_key()
|
||||||
|
_set_title()
|
||||||
|
|
||||||
|
|
||||||
def subcommand_enable(_):
|
def subcommand_enable(_):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user