Added opensearch setup
parent
137f92d432
commit
20fce34db3
@ -1,14 +1,13 @@
|
|||||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
|
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
|
||||||
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
|
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
|
||||||
<ShortName>[SNK]</ShortName>
|
<ShortName>Shoogle</ShortName>
|
||||||
<Description>[Search engine full name and summary]</Description>
|
<Description>Shoogle: A lightweight, deployable Google search proxy for desktop/mobile that removes Javascript, AMP links, and ads</Description>
|
||||||
<InputEncoding>[UTF-8]</InputEncoding>
|
<InputEncoding>UTF-8</InputEncoding>
|
||||||
<Image width="16" height="16" type="image/x-icon">[https://example.com/favicon.ico]</Image>
|
<Image width="16" height="16" type="image/x-icon">/static/img/favicon.ico</Image>
|
||||||
<Url type="text/html" template="[searchURL]">
|
<Url type="text/html" template="SHOOGLE_URL">
|
||||||
<Param name="[key name]" value="{searchTerms}"/>
|
<Param name="q" value="{searchTerms}"/>
|
||||||
<!-- other Params if you need them… -->
|
|
||||||
<Param name="[other key name]" value="[parameter value]"/>
|
|
||||||
</Url>
|
</Url>
|
||||||
<Url type="application/x-suggestions+json" template="[suggestionURL]"/>
|
<Url type="application/x-suggestions+json" template="SHOOGLE_URL"/>
|
||||||
<moz:SearchForm>[https://example.com/search]</moz:SearchForm>
|
<moz:SearchForm>SHOOGLE_URL</moz:SearchForm>
|
||||||
</OpenSearchDescription>
|
</OpenSearchDescription>
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
template_path = './app/static/opensearch.template'
|
||||||
|
opensearch_path = './app/static/opensearch.xml'
|
||||||
|
replace_tag = 'SHOOGLE_URL'
|
||||||
|
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print('You must provide the url as an argument for this script.')
|
||||||
|
print('Example: python opensearch.py "https://my-app-1776.herokuapps.com"')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
app_url = sys.argv[1]
|
||||||
|
opensearch_template = open(template_path, 'r').read()
|
||||||
|
|
||||||
|
with open(opensearch_path, 'w') as opensearch_xml:
|
||||||
|
opensearch_xml.write(opensearch_template.replace(replace_tag, app_url))
|
||||||
|
opensearch_xml.close()
|
||||||
|
|
||||||
|
print('\nDone - you may now set Shoogle as your primary search engine')
|
Loading…
Reference in New Issue