logo

searx

Unnamed repository; edit this file 'description' to name the repository.
commit: 1184f45ca52f2b906587d089cbbb3d8cb16c954b
parent: 54f1bc0425355b54785da6e711babb881f4dd0d5
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Tue,  7 Apr 2015 11:07:48 +0200

[enh] reset default preferences

Diffstat:

searx/templates/courgette/preferences.html | 3++-
searx/templates/default/preferences.html | 3++-
searx/templates/oscar/preferences.html | 1+
searx/webapp.py | 8++++++++
4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/searx/templates/courgette/preferences.html b/searx/templates/courgette/preferences.html @@ -125,7 +125,8 @@ </p> <input type="submit" value="{{ _('save') }}" /> + <div class="right preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div> <div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> - </form> + </form> </div> {% endblock %} diff --git a/searx/templates/default/preferences.html b/searx/templates/default/preferences.html @@ -113,7 +113,8 @@ </p> <input type="submit" value="{{ _('save') }}" /> + <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div> <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> - </form> + </form> </div> {% endblock %} diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html @@ -184,6 +184,7 @@ <input type="submit" class="btn btn-primary" value="{{ _('save') }}" /> <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a> + <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a> </form> </div> {% endblock %} diff --git a/searx/webapp.py b/searx/webapp.py @@ -715,6 +715,14 @@ def favicon(): mimetype='image/vnd.microsoft.icon') +@app.route('/clear_cookies') +def clear_cookies(): + resp = make_response(redirect(url_for('index'))) + for cookie_name in request.cookies: + resp.delete_cookie(cookie_name) + return resp + + def run(): app.run( debug=settings['server']['debug'],