Relativization of search results
This commit is contained in:
parent
2fcfeacd44
commit
f60e132d3c
|
@ -104,6 +104,8 @@ class Filter:
|
||||||
input_form = soup.find('form')
|
input_form = soup.find('form')
|
||||||
if input_form is not None:
|
if input_form is not None:
|
||||||
input_form['method'] = 'GET' if self.config.get_only else 'POST'
|
input_form['method'] = 'GET' if self.config.get_only else 'POST'
|
||||||
|
# Use a relative URI for submissions
|
||||||
|
input_form['action'] = 'search'
|
||||||
|
|
||||||
# Ensure no extra scripts passed through
|
# Ensure no extra scripts passed through
|
||||||
for script in soup('script'):
|
for script in soup('script'):
|
||||||
|
@ -394,6 +396,16 @@ class Filter:
|
||||||
if href.startswith(MAPS_URL):
|
if href.startswith(MAPS_URL):
|
||||||
# Maps links don't work if a site filter is applied
|
# Maps links don't work if a site filter is applied
|
||||||
link['href'] = MAPS_URL + "?q=" + clean_query(q)
|
link['href'] = MAPS_URL + "?q=" + clean_query(q)
|
||||||
|
elif href.startswith('/?') or href.startswith('/search?'):
|
||||||
|
# make sure that tags can be clicked as relative URLs
|
||||||
|
link['href'] = href[1:]
|
||||||
|
elif href.startswith('/intl/'):
|
||||||
|
# do nothing, keep original URL for ToS
|
||||||
|
pass
|
||||||
|
elif href.startswith('/preferences'):
|
||||||
|
# there is no config specific URL, remove this
|
||||||
|
link.decompose()
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
link['href'] = href
|
link['href'] = href
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<form id="search-form" action="{{ url }}/search" method="post">
|
<form id="search-form" action="search" method="post">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="q"
|
name="q"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user