mirror of
https://github.com/searxng/searxng.git
synced 2026-01-01 00:20:02 +00:00
[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.
This commit is contained in:
@@ -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 }}">
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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 %} >
|
||||
|
||||
Reference in New Issue
Block a user