mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +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 shutil
|
||||
|
||||
from plinth import action_utils
|
||||
from plinth import action_utils, cfg
|
||||
from plinth.utils import YAMLFile, gunzip
|
||||
|
||||
SETTINGS_FILE = '/etc/searx/settings.yml'
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
"""Return parsed command line arguments as dictionary."""
|
||||
@ -60,25 +62,33 @@ def _copy_uwsgi_configuration():
|
||||
|
||||
def _generate_secret_key():
|
||||
""" 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'
|
||||
gunzip(example_settings_file, settings_file)
|
||||
gunzip(example_settings_file, SETTINGS_FILE)
|
||||
|
||||
# Generate and set a secret key
|
||||
with YAMLFile(settings_file) as settings:
|
||||
with YAMLFile(SETTINGS_FILE) as settings:
|
||||
secret_key = secrets.token_hex(32)
|
||||
settings['server']['secret_key'] = secret_key
|
||||
|
||||
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(_):
|
||||
"""Post installation actions for Searx"""
|
||||
_copy_uwsgi_configuration()
|
||||
_generate_secret_key()
|
||||
_set_title()
|
||||
|
||||
|
||||
def subcommand_enable(_):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user