From 7d443dfea389d8bfaaa90142d3c1a6c1a068d5a9 Mon Sep 17 00:00:00 2001 From: Julian Fairfax Date: Sat, 14 May 2022 14:12:55 +0200 Subject: [PATCH] Preferences URL in preferences Revert translation changes Auto-save preferences from URL Preferences URL in preferences Fix that Preferences URL in preferences --- searx/templates/simple/preferences.html | 5 +++++ searx/webapp.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html index 2278237b..4dde6fec 100644 --- a/searx/templates/simple/preferences.html +++ b/searx/templates/simple/preferences.html @@ -406,6 +406,11 @@
{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&q=%s{% endraw %}

{{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }}

+

{{ _('URL to restore your preferences in another browser') }} :

+
+
{{ url_for('preferences', _external=True) }}?preferences={{ preferences_url_params|e }}&save=1
+
+

{{ _('Specifying custom settings in the preferences URL can be used to sync preferences across devices.') }}

{{ tab_footer() }} {{ tabs_close() }} diff --git a/searx/webapp.py b/searx/webapp.py index 7eca0775..86de8840 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -971,6 +971,11 @@ def preferences(): # pylint: disable=too-many-locals, too-many-return-statements, too-many-branches # pylint: disable=too-many-statements + # save preferences using the link the /preferences?preferences=...&save=1 + if request.args.get('save') == '1': + resp = make_response(redirect(url_for('index', _external=True))) + return request.preferences.save(resp) + # save preferences if request.method == 'POST': resp = make_response(redirect(url_for('index', _external=True)))