1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-04 20:30:11 +01:00

Merge pull request #1202 from julianfairfax/master

Preferences URL in preferences
This commit is contained in:
Alexandre Flament 2022-05-15 20:42:37 +02:00 committed by GitHub
commit f814ac703b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -406,6 +406,11 @@
<pre>{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}</pre> <pre>{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}</pre>
</div> </div>
<p class="small_font">{{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }}</p> <p class="small_font">{{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }}</p>
<h4>{{ _('URL to restore your preferences in another browser') }} :</h4>
<div class="selectable_url">
<pre>{{ url_for('preferences', _external=True) }}?preferences={{ preferences_url_params|e }}&amp;save=1</pre>
</div>
<p class="small_font">{{ _('Specifying custom settings in the preferences URL can be used to sync preferences across devices.') }}</p>
{{ tab_footer() }} {{ tab_footer() }}
{{ tabs_close() }} {{ tabs_close() }}

View File

@ -971,6 +971,11 @@ def preferences():
# pylint: disable=too-many-locals, too-many-return-statements, too-many-branches # pylint: disable=too-many-locals, too-many-return-statements, too-many-branches
# pylint: disable=too-many-statements # 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 # save preferences
if request.method == 'POST': if request.method == 'POST':
resp = make_response(redirect(url_for('index', _external=True))) resp = make_response(redirect(url_for('index', _external=True)))