forked from Archives/searxng
Merge branch 'master' into flask_perimeter
commit
e67dfaaac7
@ -0,0 +1,32 @@
|
||||
'''
|
||||
searx is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
searx is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with searx. If not, see < http://www.gnu.org/licenses/ >.
|
||||
|
||||
(C) 2017- by Alexandre Flament, <alex@al-f.net>
|
||||
'''
|
||||
|
||||
|
||||
class SearxException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class SearxParameterException(SearxException):
|
||||
|
||||
def __init__(self, name, value):
|
||||
if value == '' or value is None:
|
||||
message = 'Empty ' + name + ' parameter'
|
||||
else:
|
||||
message = 'Invalid value "' + value + '" for parameter ' + name
|
||||
super(SearxParameterException, self).__init__(message)
|
||||
self.parameter_name = name
|
||||
self.parameter_value = value
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,28 +1,20 @@
|
||||
.menu {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
border: 0;
|
||||
z-index: 1000000000;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
li {
|
||||
padding: 0 0.6em;
|
||||
margin: 0;
|
||||
float: left;
|
||||
list-style: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.searx-navbar {
|
||||
background: #eee;
|
||||
color: #aaa;
|
||||
height: 2.3rem;
|
||||
font-size: 1.3rem;
|
||||
line-height: 1.3rem;
|
||||
padding: 0.5rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 1.3rem;
|
||||
|
||||
.menu-right {
|
||||
right: 2em;
|
||||
}
|
||||
a, a:hover {
|
||||
margin-right: 2.0rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.menu-left {
|
||||
left: 2em;
|
||||
.instance a {
|
||||
color: #444;
|
||||
margin-left: 2.0rem;
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<ShortName>{{ instance_name }}</ShortName>
|
||||
<Description>a privacy-respecting, hackable metasearch engine</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<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 %}
|
||||
{% else %}
|
||||
<Url 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 %}
|
||||
</OpenSearchDescription>
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0"
|
||||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Searx search: {{ q|e }}</title>
|
||||
<link>{{ base_url }}?q={{ q|e }}</link>
|
||||
<description>Search results for "{{ q|e }}" - searx</description>
|
||||
<opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults>
|
||||
<opensearch:startIndex>1</opensearch:startIndex>
|
||||
<opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage>
|
||||
<atom:link rel="search" type="application/opensearchdescription+xml" href="{{ base_url }}opensearch.xml"/>
|
||||
<opensearch:Query role="request" searchTerms="{{ q|e }}" startPage="1" />
|
||||
{% for r in results %}
|
||||
<item>
|
||||
<title>{{ r.title }}</title>
|
||||
<link>{{ r.url }}</link>
|
||||
<description>{{ r.content }}</description>
|
||||
{% if r.pubdate %}<pubDate>{{ r.pubdate }}</pubDate>{% endif %}
|
||||
</item>
|
||||
{% endfor %}
|
||||
</channel>
|
||||
</rss>
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<ShortName>{{ instance_name }}</ShortName>
|
||||
<Description>a privacy-respecting, hackable metasearch engine</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<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 %}
|
||||
{% else %}
|
||||
<Url 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 %}
|
||||
</OpenSearchDescription>
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0"
|
||||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Searx search: {{ q|e }}</title>
|
||||
<link>{{ base_url }}?q={{ q|e }}</link>
|
||||
<description>Search results for "{{ q|e }}" - searx</description>
|
||||
<opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults>
|
||||
<opensearch:startIndex>1</opensearch:startIndex>
|
||||
<opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage>
|
||||
<atom:link rel="search" type="application/opensearchdescription+xml" href="{{ base_url }}opensearch.xml"/>
|
||||
<opensearch:Query role="request" searchTerms="{{ q|e }}" startPage="1" />
|
||||
{% for r in results %}
|
||||
<item>
|
||||
<title>{{ r.title }}</title>
|
||||
<link>{{ r.url }}</link>
|
||||
<description>{{ r.content }}</description>
|
||||
{% if r.pubdate %}<pubDate>{{ r.pubdate }}</pubDate>{% endif %}
|
||||
</item>
|
||||
{% endfor %}
|
||||
</channel>
|
||||
</rss>
|
@ -1,12 +1,24 @@
|
||||
{% from 'oscar/macros.html' import icon %}
|
||||
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
|
||||
<div class="input-group col-sm-12">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-8">
|
||||
<div class="input-group search-margin">
|
||||
<input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group col-sm-12 advanced">
|
||||
{% include 'oscar/advanced.html' %}
|
||||
<div class="col-xs-6 col-md-2 search-margin">
|
||||
{% include 'oscar/time-range.html' %}
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-2 search-margin">
|
||||
{% include 'oscar/languages.html' %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{% include 'oscar/categories.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</form><!-- / #search_form_full -->
|
||||
|
Loading…
Reference in New Issue