diff options
| author | Marc Abonce Seguin <marc-abonce@mailbox.org> | 2019-07-29 21:25:05 -0700 |
|---|---|---|
| committer | Marc Abonce Seguin <marc-abonce@mailbox.org> | 2020-11-02 20:04:03 -0700 |
| commit | 8d71420b4511fdac63c39f33d93c7add1ea7716d (patch) | |
| tree | 14f3e1e9cf815cf5cc301fb1699cd54816adfc25 /searx/templates/simple | |
| parent | 45f58a4a2a0b89f4b416c28ea769139b16f6436d (diff) | |
[mod] separate index and search routes
This makes it easier to separately handle search and index requests
from a web server or from a reverse proxy.
If a request to index contains a query, a permanent redirect HTTP response
is returned. This should give some level of backwards compatibility
for users that have set a searx instance in their browser's search bar.
Diffstat (limited to 'searx/templates/simple')
| -rw-r--r-- | searx/templates/simple/infobox.html | 2 | ||||
| -rw-r--r-- | searx/templates/simple/results.html | 14 | ||||
| -rw-r--r-- | searx/templates/simple/search.html | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/searx/templates/simple/infobox.html b/searx/templates/simple/infobox.html index 08daa5038..56c51af77 100644 --- a/searx/templates/simple/infobox.html +++ b/searx/templates/simple/infobox.html @@ -33,7 +33,7 @@ <div> <h3><bdi>{{ topic.name }}</bdi></h3> {% for suggestion in topic.suggestions %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <input type="hidden" name="q" value="{{ suggestion }}"> <input type="hidden" name="time_range" value="{{ time_range }}"> <input type="hidden" name="language" value="{{ current_language }}"> diff --git a/searx/templates/simple/results.html b/searx/templates/simple/results.html index 2e393193f..936de8831 100644 --- a/searx/templates/simple/results.html +++ b/searx/templates/simple/results.html @@ -1,7 +1,7 @@ {% extends "simple/base.html" %} {% from 'simple/macros.html' import icon, icon_small %} {% block title %}{% if method == 'GET' %}{{- q|e -}} -{% endif %}{% endblock %} -{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&categories={{ selected_categories|join(",") | replace(' ','+') }}&pageno={{ pageno }}&time_range={{ time_range }}&language={{ current_language }}&safesearch={{ safesearch }}&format=rss">{% endblock %} +{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('search', _external=True) }}?q={{ q|urlencode }}&categories={{ selected_categories|join(",") | replace(' ','+') }}&pageno={{ pageno }}&time_range={{ time_range }}&language={{ current_language }}&safesearch={{ safesearch }}&format=rss">{% endblock %} {% block content %} <nav id="linkto_preferences"><a href="{{ url_for('preferences') }}">{{ icon('navicon-round') }}</a></nav> {% include 'simple/search.html' %} @@ -55,7 +55,7 @@ <h4 class="title">{{ _('Suggestions') }} : </h4> <div class="wrapper"> {% for suggestion in suggestions %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <input type="hidden" name="q" value="{{ suggestion.url }}"> <input type="hidden" name="time_range" value="{{ time_range }}"> <input type="hidden" name="language" value="{{ current_language }}"> @@ -71,13 +71,13 @@ <div id="search_url"> <h4 class="title">{{ _('Search URL') }} :</h4> - <div class="selectable_url"><pre>{{ base_url }}?q={{ q|urlencode }}&language={{ current_language }}&time_range={{ time_range }}&safesearch={{ safesearch }}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if timeout_limit %}&timeout_limit={{ timeout_limit|urlencode }}{% endif %}</pre></div> + <div class="selectable_url"><pre>{{ url_for('search', _external=True) }}?q={{ q|urlencode }}&language={{ current_language }}&time_range={{ time_range }}&safesearch={{ safesearch }}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if timeout_limit %}&timeout_limit={{ timeout_limit|urlencode }}{% endif %}</pre></div> </div> <div id="apis"> <h4 class="title">{{ _('Download results') }}</h4> {% for output_type in ('csv', 'json', 'rss') %} <div class="left"> - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <input type="hidden" name="q" value="{{ q|e }}"> {% for category in selected_categories %} <input type="hidden" name="category_{{ category }}" value="1"> @@ -100,7 +100,7 @@ <h4>{{ _('Try searching for:') }}</h4> {% for correction in corrections %} <div class="left"> - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="navigation"> <input type="hidden" name="q" value="{{ correction.url }}"> <input type="hidden" name="time_range" value="{{ time_range }}"> <input type="hidden" name="language" value="{{ current_language }}"> @@ -133,7 +133,7 @@ {% if paging %} <nav id="pagination"> {% if pageno > 1 %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <div class="{% if rtl %}right{% else %}left{% endif %}"> <input type="hidden" name="q" value="{{ q|e }}" > {% for category in selected_categories %} @@ -149,7 +149,7 @@ </div> </form> {% endif %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <div class="{% if rtl %}left{% else %}right{% endif %}"> <input type="hidden" name="q" value="{{ q|e }}" > {% for category in selected_categories %} diff --git a/searx/templates/simple/search.html b/searx/templates/simple/search.html index 61d52dbc7..176e7909e 100644 --- a/searx/templates/simple/search.html +++ b/searx/templates/simple/search.html @@ -1,4 +1,4 @@ -<form id="search" method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> +<form id="search" method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <div id="search_wrapper"> <div class="search_box"> <input id="q" autofocus name="q" type="text" placeholder="{{ _('Search for...') }}" tabindex="1" autocomplete="off" spellcheck="false" dir="auto" {% if q %}value="{{ q }}"{% endif %} > |