Search query is now also a post request (possible fix for Forward Auth Search Redirect Issue #2681)
This commit is contained in:
		
							parent
							
								
									907606295d
								
							
						
					
					
						commit
						275675b48a
					
				|  | @ -35,12 +35,13 @@ search = Blueprint('search', __name__) | ||||||
| log = logger.create() | log = logger.create() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @search.route("/search", methods=["GET"]) | @search.route("/search", methods=["POST"]) | ||||||
| @login_required_if_no_ano | @login_required_if_no_ano | ||||||
| def simple_search(): | def simple_search(): | ||||||
|     term = request.args.get("query") |     term = dict(request.form).get("query") | ||||||
|     if term: |     if term: | ||||||
|         return redirect(url_for('web.books_list', data="search", sort_param='stored', query=term.strip())) |         flask_session['query'] = json.dumps(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="", | ||||||
|  |  | ||||||
|  | @ -41,7 +41,8 @@ | ||||||
|             <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="GET"> |           <form class="navbar-form navbar-left" role="search" action="{{url_for('search.simple_search')}}" method="POST"> | ||||||
|  |             <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}}"> | ||||||
|  |  | ||||||
|  | @ -392,7 +392,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 = (request.args.get('query') or '') |         term = json.loads(flask_session.get('query', '')) | ||||||
|         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": | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user