feat: add OpenSearch XML endpoint

- Serve /opensearch.xml with configurable base URL
- Browsers can now add gosearch as a search engine from the address bar
- Configurable via [server] base_url or BASE_URL env var
- XML template embedded in the binary via go:embed
- Added base_url to config.example.toml
This commit is contained in:
Franz Kafka 2026-03-21 17:40:05 +00:00
parent 3caf702c4f
commit 4ec600f6c0
6 changed files with 51 additions and 0 deletions

View file

@ -9,6 +9,11 @@ port = 8080
# HTTP timeout for engine and upstream calls (env: HTTP_TIMEOUT)
http_timeout = "10s"
# Public base URL for OpenSearch XML (env: BASE_URL)
# Set this so browsers can add gosearch as a search engine.
# Example: "https://search.example.com"
base_url = ""
[upstream]
# URL of an upstream SearXNG instance for unported engines (env: UPSTREAM_SEARXNG_URL)
# Leave empty to run without an upstream proxy.