1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 12:30:00 +00:00

Revert "post" as search request. Search request is now get again (fix for #2741)

Revert "Auxiliary commit to revert individual files from 275675b48add79d2bbce06426cc1224c5e2c1bfb"

This reverts commit 6c920bc49f133d5c7451230448121f1f8b3cd9f2.
This commit is contained in:
Ozzie Isaacs 2023-04-12 18:24:33 +02:00
parent 13c0d30a8f
commit 592216588c
3 changed files with 5 additions and 7 deletions

View File

@ -35,13 +35,12 @@ search = Blueprint('search', __name__)
log = logger.create() log = logger.create()
@search.route("/search", methods=["POST"]) @search.route("/search", methods=["GET"])
@login_required_if_no_ano @login_required_if_no_ano
def simple_search(): def simple_search():
term = dict(request.form).get("query") term = request.args.get("query")
if term: if term:
flask_session['query'] = json.dumps(term.strip()) return redirect(url_for('web.books_list', data="search", sort_param='stored', query=term.strip()))
return redirect(url_for('web.books_list', data="search", sort_param='stored', query="")) # term.strip()
else: else:
return render_title_template('search.html', return render_title_template('search.html',
searchterm="", searchterm="",

View File

@ -41,8 +41,7 @@
<div class="plexBack"><a href="{{url_for('web.index')}}"></a></div> <div class="plexBack"><a href="{{url_for('web.index')}}"></a></div>
{% endif %} {% endif %}
{% if current_user.is_authenticated or g.allow_anonymous %} {% if current_user.is_authenticated or g.allow_anonymous %}
<form class="navbar-form navbar-left" role="search" action="{{url_for('search.simple_search')}}" method="POST"> <form class="navbar-form navbar-left" role="search" action="{{url_for('search.simple_search')}}" method="GET">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="form-group input-group input-group-sm"> <div class="form-group input-group input-group-sm">
<label for="query" class="sr-only">{{_('Search')}}</label> <label for="query" class="sr-only">{{_('Search')}}</label>
<input type="text" class="form-control" id="query" name="query" placeholder="{{_('Search Library')}}" value="{{searchterm}}"> <input type="text" class="form-control" id="query" name="query" placeholder="{{_('Search Library')}}" value="{{searchterm}}">

View File

@ -396,7 +396,7 @@ def render_books_list(data, sort_param, book_id, page):
elif data == "archived": elif data == "archived":
return render_archived_books(page, order) return render_archived_books(page, order)
elif data == "search": elif data == "search":
term = json.loads(flask_session.get('query', '')) term = (request.args.get('query') or '')
offset = int(int(config.config_books_per_page) * (page - 1)) offset = int(int(config.config_books_per_page) * (page - 1))
return render_search_results(term, offset, order, config.config_books_per_page) return render_search_results(term, offset, order, config.config_books_per_page)
elif data == "advsearch": elif data == "advsearch":