lock safesearch preference when level is moderate or strict

SearXNG's preferences.lock list prevents users from changing a setting
via the UI — it greys out the option. Without this, safe_search in
settings.yml was only a server default that users could still override
in their preferences page.

For moderate/strict, add:
  preferences:
    lock:
      - safesearch

For none, the lock is omitted so users can freely adjust it.

https://claude.ai/code/session_012gDnantBmFTWZGCiKyjazx
This commit is contained in:
Claude
2026-03-21 06:02:25 +00:00
parent 07f8c83acb
commit 0eac82e06e
+4
View File
@@ -190,6 +190,10 @@ set -u
printf 'general:\n instance_name: "Local Search"\n'
printf 'server:\n secret_key: "%s"\n limiter: false\n' "$SECRET_KEY"
printf 'search:\n safe_search: %d\n default_lang: "en"\n formats: [html, json]\n' "$SAFE_INT"
# Lock the safe-search preference so users cannot override it via the UI
if [[ "$LEVEL" != "none" ]]; then
printf 'preferences:\n lock:\n - safesearch\n'
fi
if [[ -n "$ENGINE_BLOCK" ]]; then
printf 'engines:\n'
printf '%b' "$ENGINE_BLOCK"