diff options
| -rw-r--r-- | client/simple/src/less/toolkit.less | 9 | ||||
| -rw-r--r-- | searx/templates/simple/base.html | 6 | ||||
| -rw-r--r-- | searx/templates/simple/preferences.html | 10 | ||||
| -rwxr-xr-x | searx/webapp.py | 7 |
4 files changed, 29 insertions, 3 deletions
diff --git a/client/simple/src/less/toolkit.less b/client/simple/src/less/toolkit.less index 223ab9571..364eb73c5 100644 --- a/client/simple/src/less/toolkit.less +++ b/client/simple/src/less/toolkit.less @@ -193,6 +193,15 @@ div.selectable_url { border-color: var(--color-warning); } +.dialog-warning-block { + .dialog(); + + display: block; + color: var(--color-warning); + background: var(--color-warning-background); + border-color: var(--color-warning); +} + .dialog-modal { .dialog(); diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index 3ddc62ace..c8e75b713 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -51,7 +51,11 @@ {%- endif -%} {%- endblock -%} {%- block linkto_preferences -%} - <a href="{{ url_for('preferences') }}" class="link_on_top_preferences">{{ icon_big('settings') }}<span>{{ _('Preferences') }}</span></a> + {%- if request.args.get('preferences') -%} + <a href="{{ url_for('preferences') }}?preferences={{ request.args.get('preferences') }}&preferences_preview_only=true" class="link_on_top_preferences">{{ icon_big('settings') }}<span>{{ _('Preferences') }}</span></a> + {%- else -%} + <a href="{{ url_for('preferences') }}" class="link_on_top_preferences">{{ icon_big('settings') }}<span>{{ _('Preferences') }}</span></a> + {%- endif -%} {%- endblock -%} </nav> {% block header %} diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html index e86e926cc..87bd99c45 100644 --- a/searx/templates/simple/preferences.html +++ b/searx/templates/simple/preferences.html @@ -155,6 +155,16 @@ <h1>{{ _('Preferences') }}</h1> + {%- if request.args.get('preferences_preview_only') == 'true' -%} + <div class="dialog-warning-block"> + <p>{{ _("This is a preview of the settings used by the 'Search URL' you used to get here.") }}</p> + <ul> + <li>{{ _('Press save to copy these preferences to your browser.') }}</li> + <li>{{ _('Click here to view your browser preferences instead:') }} <a href="{{ url_for('preferences') }}">/preferences</a></li> + </ul> + </div> + {%- endif -%} + <form id="search_form" method="post" action="{{ url_for('preferences') }}" autocomplete="off"> {{- tabs_open() -}} diff --git a/searx/webapp.py b/searx/webapp.py index 4be087a09..218959a9c 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -861,8 +861,11 @@ def preferences(): # save preferences using the link the /preferences?preferences=... if sxng_request.args.get('preferences') or sxng_request.form.get('preferences'): - resp = make_response(redirect(url_for('index', _external=True))) - return sxng_request.preferences.save(resp) + # if preferences_preview_only is 'true', the prefs from the 'preferences' query are + # shown in the settings page, but they're not applied unless the user presses 'save' + if sxng_request.args.get('preferences_preview_only') != 'true': + resp = make_response(redirect(url_for('index', _external=True))) + return sxng_request.preferences.save(resp) # save preferences if sxng_request.method == 'POST': |