@ -284,7 +284,6 @@ def autocomplete():
g . user_request . autocomplete ( q ) if not g . user_config . tor else [ ]
g . user_request . autocomplete ( q ) if not g . user_config . tor else [ ]
] )
] )
@app.route ( f ' / { Endpoint . search } ' , methods = [ ' GET ' , ' POST ' ] )
@app.route ( f ' / { Endpoint . search } ' , methods = [ ' GET ' , ' POST ' ] )
@session_required
@session_required
@auth_required
@auth_required
@ -323,6 +322,7 @@ def search():
soup = bsoup ( response , " html.parser " ) ;
soup = bsoup ( response , " html.parser " ) ;
for x in soup . find_all ( attrs = { " id " : " st-card " } ) :
for x in soup . find_all ( attrs = { " id " : " st-card " } ) :
x . replace_with ( " " )
x . replace_with ( " " )
response = str ( soup )
response = str ( soup )
# Return 503 if temporarily blocked by captcha
# Return 503 if temporarily blocked by captcha
@ -336,6 +336,7 @@ def search():
config = g . user_config ,
config = g . user_config ,
query = urlparse . unquote ( query ) ,
query = urlparse . unquote ( query ) ,
params = g . user_config . to_params ( keys = [ ' preferences ' ] ) ) , 503
params = g . user_config . to_params ( keys = [ ' preferences ' ] ) ) , 503
response = bold_search_terms ( response , query )
response = bold_search_terms ( response , query )
# Feature to display IP address
# Feature to display IP address
@ -358,6 +359,7 @@ def search():
preferences = g . user_config . preferences
preferences = g . user_config . preferences
home_url = f " home?preferences= { preferences } " if preferences else " home "
home_url = f " home?preferences= { preferences } " if preferences else " home "
cleanresponse = str ( response ) . replace ( " andlt; " , " < " ) . replace ( " andgt; " , " > " )
return render_template (
return render_template (
' display.html ' ,
' display.html ' ,
@ -378,7 +380,7 @@ def search():
is_translation = any (
is_translation = any (
_ in query . lower ( ) for _ in [ translation [ ' translate ' ] , ' translate ' ]
_ in query . lower ( ) for _ in [ translation [ ' translate ' ] , ' translate ' ]
) and not search_util . search_type , # Standard search queries only
) and not search_util . search_type , # Standard search queries only
response = response,
response = clean response,
version_number = app . config [ ' VERSION_NUMBER ' ] ,
version_number = app . config [ ' VERSION_NUMBER ' ] ,
search_header = render_template (
search_header = render_template (
' header.html ' ,
' header.html ' ,