summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 999b4f64b..5263aaf1b 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -56,8 +56,9 @@ from searx import (
get_setting,
settings,
searx_debug,
- user_help,
)
+
+from searx import infopage
from searx.data import ENGINE_DESCRIPTIONS
from searx.results import Timing, UnresponsiveEngine
from searx.settings_defaults import OUTPUT_FORMATS
@@ -660,6 +661,7 @@ def index():
# fmt: off
'index.html',
selected_categories=get_selected_categories(request.preferences, request.form),
+ current_locale = request.preferences.get_value("locale"),
# fmt: on
)
@@ -864,6 +866,7 @@ def search():
unresponsive_engines = __get_translated_errors(
result_container.unresponsive_engines
),
+ current_locale = request.preferences.get_value("locale"),
current_language = match_language(
search_query.lang,
settings['search']['languages'],
@@ -898,19 +901,29 @@ def __get_translated_errors(unresponsive_engines: Iterable[UnresponsiveEngine]):
@app.route('/about', methods=['GET'])
def about():
"""Redirect to about page"""
- return redirect(url_for('help_page', pagename='about'))
+ locale = request.preferences.get_value('locale')
+ return redirect(url_for('info', pagename='about', locale=locale))
-@app.route('/help/en/<pagename>', methods=['GET'])
-def help_page(pagename):
- """Render help page"""
- page = user_help.PAGES.get(pagename)
+_INFO_PAGES = infopage.InfoPageSet(infopage.MistletoePage)
+
+@app.route('/info/<locale>/<pagename>', methods=['GET'])
+def info(pagename, locale):
+ """Render page of online user documentation"""
+
+ locale = locale or request.preferences.get_value('locale')
+ page = _INFO_PAGES.get_page(pagename, locale)
+ if page is None:
+ page = _INFO_PAGES.get_page(pagename)
if page is None:
flask.abort(404)
return render(
- 'help.html', page=user_help.PAGES[pagename], all_pages=user_help.PAGES.items(), page_filename=pagename
+ 'info.html',
+ all_pages=_INFO_PAGES.all_pages,
+ active_page=page,
+ active_pagename=pagename,
)
@@ -1411,7 +1424,6 @@ werkzeug_reloader = flask_run_development or (searx_debug and __name__ == "__mai
if not werkzeug_reloader or (werkzeug_reloader and os.environ.get("WERKZEUG_RUN_MAIN") == "true"):
plugin_initialize(app)
search_initialize(enable_checker=True, check_network=True, enable_metrics=settings['general']['enable_metrics'])
- user_help.render(app)
def run():