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:
parent
3caf702c4f
commit
4ec600f6c0
6 changed files with 51 additions and 0 deletions
16
internal/views/templates/opensearch.xml
Normal file
16
internal/views/templates/opensearch.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<ShortName>gosearch</ShortName>
|
||||
<Description>A privacy-respecting, open metasearch engine</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<OutputEncoding>UTF-8</OutputEncoding>
|
||||
<LongName>gosearch — Privacy-respecting metasearch</LongName>
|
||||
<Image width="16" height="16" type="image/svg+xml">/static/img/favicon.svg</Image>
|
||||
<Contact>https://git.ashisgreat.xyz/penal-colony/gosearch</Contact>
|
||||
<Url type="text/html" method="GET" template="{baseUrl}/search?q={searchTerms}&format=html">
|
||||
<Param name="pageno" value="{startPage?}" />
|
||||
<Param name="language" value="{language?}" />
|
||||
</Url>
|
||||
<Url type="application/json" method="GET" template="{baseUrl}/search?q={searchTerms}&format=json" />
|
||||
<Query role="example" searchTerms="golang" />
|
||||
</OpenSearchDescription>
|
||||
Loading…
Add table
Add a link
Reference in a new issue