summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorRuben D. <ruben@winterrific.net>2026-03-13 21:33:06 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2026-03-24 20:21:27 +0100
commit3dc4d5daa88830595c1c42bf5dc722b6d3565767 (patch)
tree7f3ce924ba1342b44cdacf67a1767719be094b9d /searx/webapp.py
parent924fc52f545602d33d9cad843f99387718fcb6c8 (diff)
[mod] add manifest.json template and route (#5859)
URLs, name and colors are automatically rendered into manifest.json. Furthermore user preference of theme (light, dark, black) and theme colors are respected. Theme colors can be set in settings.yml
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index ed2deeabb..b0820c753 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -1215,6 +1215,29 @@ def opensearch():
return resp
+@app.route('/manifest.json', methods=['GET'])
+def manifest():
+ theme = sxng_request.preferences.get_value('simple_style')
+ if theme not in ("light", "dark", "black"):
+ theme = "light"
+
+ theme_color = get_setting(f'brand.pwa_colors.theme_color_{theme}')
+ background_color = get_setting(f'brand.pwa_colors.background_color_{theme}')
+ ret = render('manifest.json', theme_color=theme_color, background_color=background_color)
+ resp = Response(response=ret, status=200, mimetype="application/json")
+ return resp
+
+
+@app.route('/logo/<resolution>')
+def manifest_logo(resolution=0):
+ theme = sxng_request.preferences.get_value("theme")
+ return send_from_directory(
+ os.path.join(app.root_path, settings['ui']['static_path'], 'themes', theme, 'img', 'logos'), # type: ignore
+ resolution,
+ mimetype='image/vnd.microsoft.icon',
+ )
+
+
@app.route('/favicon.ico')
def favicon():
theme = sxng_request.preferences.get_value("theme")