Merge remote-tracking branch 'origin/main' into heroku-app
This commit is contained in:
commit
dcd546d13f
|
@ -183,7 +183,7 @@ Description=Whoogle
|
||||||
# Proxy configuration, uncomment to enable
|
# Proxy configuration, uncomment to enable
|
||||||
#Environment=WHOOGLE_PROXY_USER=<proxy username>
|
#Environment=WHOOGLE_PROXY_USER=<proxy username>
|
||||||
#Environment=WHOOGLE_PROXY_PASS=<proxy password>
|
#Environment=WHOOGLE_PROXY_PASS=<proxy password>
|
||||||
#Environment=WHOOGLE_PROXY_TYPE=<proxy type (http|proxy4|proxy5)
|
#Environment=WHOOGLE_PROXY_TYPE=<proxy type (http|https|proxy4|proxy5)
|
||||||
#Environment=WHOOGLE_PROXY_LOC=<proxy host/ip>
|
#Environment=WHOOGLE_PROXY_LOC=<proxy host/ip>
|
||||||
# Site alternative configurations, uncomment to enable
|
# Site alternative configurations, uncomment to enable
|
||||||
# Note: If not set, the feature will still be available
|
# Note: If not set, the feature will still be available
|
||||||
|
|
|
@ -166,17 +166,26 @@ class Request:
|
||||||
self.modified_user_agent_mobile = gen_user_agent(True)
|
self.modified_user_agent_mobile = gen_user_agent(True)
|
||||||
|
|
||||||
# Set up proxy, if previously configured
|
# Set up proxy, if previously configured
|
||||||
if os.environ.get('WHOOGLE_PROXY_LOC'):
|
proxy_path = os.environ.get('WHOOGLE_PROXY_LOC', '')
|
||||||
|
if proxy_path:
|
||||||
|
proxy_type = os.environ.get('WHOOGLE_PROXY_TYPE', '')
|
||||||
|
proxy_user = os.environ.get('WHOOGLE_PROXY_USER', '')
|
||||||
|
proxy_pass = os.environ.get('WHOOGLE_PROXY_PASS', '')
|
||||||
auth_str = ''
|
auth_str = ''
|
||||||
if os.environ.get('WHOOGLE_PROXY_USER', ''):
|
if proxy_user:
|
||||||
auth_str = os.environ.get('WHOOGLE_PROXY_USER', '') + \
|
auth_str = proxy_user + ':' + proxy_pass
|
||||||
':' + os.environ.get('WHOOGLE_PROXY_PASS', '')
|
|
||||||
self.proxies = {
|
self.proxies = {
|
||||||
'http': os.environ.get('WHOOGLE_PROXY_TYPE', '') + '://' +
|
'https': proxy_type + '://' +
|
||||||
auth_str + '@' + os.environ.get('WHOOGLE_PROXY_LOC', ''),
|
((auth_str + '@') if auth_str else '') + proxy_path,
|
||||||
}
|
}
|
||||||
self.proxies['https'] = self.proxies['http'].replace('http',
|
|
||||||
'https')
|
# Need to ensure both HTTP and HTTPS are in the proxy dict,
|
||||||
|
# regardless of underlying protocol
|
||||||
|
if proxy_type == 'https':
|
||||||
|
self.proxies['http'] = self.proxies['https'].replace(
|
||||||
|
'https', 'http')
|
||||||
|
else:
|
||||||
|
self.proxies['http'] = self.proxies['https']
|
||||||
else:
|
else:
|
||||||
self.proxies = {
|
self.proxies = {
|
||||||
'http': 'socks5://127.0.0.1:9050',
|
'http': 'socks5://127.0.0.1:9050',
|
||||||
|
|
|
@ -28,7 +28,7 @@ services:
|
||||||
# Proxy configuration, uncomment to enable
|
# Proxy configuration, uncomment to enable
|
||||||
#- WHOOGLE_PROXY_USER=<proxy username>
|
#- WHOOGLE_PROXY_USER=<proxy username>
|
||||||
#- WHOOGLE_PROXY_PASS=<proxy password>
|
#- WHOOGLE_PROXY_PASS=<proxy password>
|
||||||
#- WHOOGLE_PROXY_TYPE=<proxy type (http|socks4|socks5)
|
#- WHOOGLE_PROXY_TYPE=<proxy type (http|https|socks4|socks5)
|
||||||
#- WHOOGLE_PROXY_LOC=<proxy host/ip>
|
#- WHOOGLE_PROXY_LOC=<proxy host/ip>
|
||||||
# Site alternative configurations, uncomment to enable
|
# Site alternative configurations, uncomment to enable
|
||||||
# Note: If not set, the feature will still be available
|
# Note: If not set, the feature will still be available
|
||||||
|
|
Loading…
Reference in New Issue
Block a user