Replace error query params w/ preferences param (#867)

main
João 2022-10-26 18:26:14 +02:00 committed by GitHub
parent 75682de892
commit 2a37619028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -158,14 +158,17 @@ class Config:
self[param_key] = param_val self[param_key] = param_val
return self return self
def to_params(self) -> str: def to_params(self, keys: list = []) -> str:
"""Generates a set of safe params for using in Whoogle URLs """Generates a set of safe params for using in Whoogle URLs
Returns: Returns:
str -- a set of URL parameters str -- a set of URL parameters
""" """
if not len(keys):
keys = self.safe_keys
param_str = '' param_str = ''
for safe_key in self.safe_keys: for safe_key in keys:
if not self[safe_key]: if not self[safe_key]:
continue continue
param_str = param_str + f'&{safe_key}={self[safe_key]}' param_str = param_str + f'&{safe_key}={self[safe_key]}'

View File

@ -326,7 +326,7 @@ def search():
farside='https://farside.link', farside='https://farside.link',
config=g.user_config, config=g.user_config,
query=urlparse.unquote(query), query=urlparse.unquote(query),
params=g.user_config.to_params()), 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

View File

@ -25,7 +25,7 @@
Whoogle: Whoogle:
<br> <br>
<a class="link-color" href="{{farside}}/whoogle/search?q={{query}}{{params}}"> <a class="link-color" href="{{farside}}/whoogle/search?q={{query}}{{params}}">
{{farside}}/whoogle/search?q={{query}}{{params}} {{farside}}/whoogle/search?q={{query}}
</a> </a>
<br><br> <br><br>
Searx: Searx: