diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2020-11-03 15:09:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-03 15:09:44 +0100 |
| commit | 9c3382d12afa22fcd63c84c0d1a2b506d043fab4 (patch) | |
| tree | 14f3e1e9cf815cf5cc301fb1699cd54816adfc25 /searx/webapp.py | |
| parent | 45f58a4a2a0b89f4b416c28ea769139b16f6436d (diff) | |
| parent | 8d71420b4511fdac63c39f33d93c7add1ea7716d (diff) | |
Merge pull request #1681 from MarcAbonce/index_refactor
[mod] Separate index and search routes
Diffstat (limited to 'searx/webapp.py')
| -rwxr-xr-x | searx/webapp.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 609669b85..46d547d52 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -531,10 +531,22 @@ def index_error(output_format, error_message): ) -@app.route('/search', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST']) def index(): - """Render index page. + """Render index page.""" + + # redirect to search if there's a query in the request + if request.form.get('q'): + return redirect(url_for('search'), 308) + + return render( + 'index.html', + ) + + +@app.route('/search', methods=['GET', 'POST']) +def search(): + """Search query in q and return results. Supported outputs: html, json, csv, rss. """ |