mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Implementing https rewrite support #71
* parsing XML-Files which contain target, exclusions and rules * convert regex if required (is a little hack, probably does not work for all rules) * check if target rule apply for http url, and use the rules to rewrite it * add pice of code, to check if domain name has not changed during rewrite (should be rewritten, using publicsuffix instead of little hack)
This commit is contained in:
parent
d1d55f2ca4
commit
9b9f097adb
3 changed files with 187 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from os import environ
|
||||
from os.path import realpath, dirname, join, abspath
|
||||
from searx.https_rewrite import load_https_rules
|
||||
try:
|
||||
from yaml import load
|
||||
except:
|
||||
|
|
@ -15,6 +16,13 @@ if 'SEARX_SETTINGS_PATH' in environ:
|
|||
else:
|
||||
settings_path = join(searx_dir, 'settings.yml')
|
||||
|
||||
if 'SEARX_HTTPS_REWRITE_PATH' in environ:
|
||||
https_rewrite_path = environ['SEARX_HTTPS_REWRITE_PATH']
|
||||
else:
|
||||
https_rewrite_path = join(searx_dir, 'https_rules')
|
||||
|
||||
with open(settings_path) as settings_yaml:
|
||||
settings = load(settings_yaml)
|
||||
|
||||
# loade https rules
|
||||
load_https_rules(https_rewrite_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue