mirror of
https://github.com/searxng/searxng.git
synced 2025-12-30 07:30:02 +00:00
Merge branch 'master' into about-opensearch
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
GIT_URL = 'https://github.com/asciimoo/searx'
|
||||
GIT_BRANCH = 'master'
|
||||
ISSUE_URL = 'https://github.com/asciimoo/searx/issues'
|
||||
SEARX_URL = 'https://searx.me'
|
||||
DOCS_URL = 'https://asciimoo.github.io/searx'
|
||||
|
||||
@@ -6,19 +6,37 @@ $(document).ready(function() {
|
||||
});
|
||||
$(document.getElementById($(this).attr("for"))).prop('checked', true);
|
||||
if($('#q').val()) {
|
||||
if (getHttpRequest() == "GET") {
|
||||
$('#search_form').attr('action', $('#search_form').serialize());
|
||||
}
|
||||
$('#search_form').submit();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('#time-range').change(function(e) {
|
||||
if($('#q').val()) {
|
||||
if (getHttpRequest() == "GET") {
|
||||
$('#search_form').attr('action', $('#search_form').serialize());
|
||||
}
|
||||
$('#search_form').submit();
|
||||
}
|
||||
});
|
||||
$('#language').change(function(e) {
|
||||
if($('#q').val()) {
|
||||
if (getHttpRequest() == "GET") {
|
||||
$('#search_form').attr('action', $('#search_form').serialize());
|
||||
}
|
||||
$('#search_form').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function getHttpRequest() {
|
||||
httpRequest = "POST";
|
||||
urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has('method')) {
|
||||
httpRequest = urlParams.get('method');
|
||||
}
|
||||
return httpRequest;
|
||||
}
|
||||
|
||||
@@ -6,23 +6,13 @@
|
||||
<Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
|
||||
<LongName>searx metasearch</LongName>
|
||||
{% if opensearch_method == 'get' %}
|
||||
<Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>
|
||||
{% if autocomplete %}
|
||||
<Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter">
|
||||
<Param name="format" value="x-suggestions" />
|
||||
<Param name="q" value="{searchTerms}" />
|
||||
</Url>
|
||||
{% endif %}
|
||||
<Url rel="results" type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>
|
||||
{% else %}
|
||||
<Url type="text/html" method="post" template="{{ host }}">
|
||||
<Url rel="results" type="text/html" method="post" template="{{ host }}">
|
||||
<Param name="q" value="{searchTerms}" />
|
||||
</Url>
|
||||
{% if autocomplete %}
|
||||
<!-- TODO, POST REQUEST doesn't work -->
|
||||
<Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter">
|
||||
<Param name="format" value="x-suggestions" />
|
||||
<Param name="q" value="{searchTerms}" />
|
||||
</Url>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if autocomplete %}
|
||||
<Url rel="suggestions" type="application/json" template="{{ host }}autocompleter"/>
|
||||
{% endif %}
|
||||
</OpenSearchDescription>
|
||||
|
||||
@@ -949,7 +949,7 @@ def opensearch():
|
||||
|
||||
resp = Response(response=ret,
|
||||
status=200,
|
||||
mimetype="text/xml")
|
||||
mimetype="application/opensearchdescription+xml")
|
||||
return resp
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user