Implements #455
This commit is contained in:
parent
ee6a27e541
commit
e2ada2684b
|
@ -57,6 +57,8 @@ ARG reddit_alt='libredd.it'
|
||||||
ENV WHOOGLE_ALT_RD=$reddit_alt
|
ENV WHOOGLE_ALT_RD=$reddit_alt
|
||||||
ARG translate_alt='lingva.ml'
|
ARG translate_alt='lingva.ml'
|
||||||
ENV WHOOGLE_ALT_TL=$translate_alt
|
ENV WHOOGLE_ALT_TL=$translate_alt
|
||||||
|
ARG medium_alt='scribe.rip'
|
||||||
|
ENV WHOOGLE_ALT_MD=$medium_alt
|
||||||
|
|
||||||
WORKDIR /whoogle
|
WORKDIR /whoogle
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,7 @@ Description=Whoogle
|
||||||
#Environment=WHOOGLE_ALT_IG=bibliogram.art/u
|
#Environment=WHOOGLE_ALT_IG=bibliogram.art/u
|
||||||
#Environment=WHOOGLE_ALT_RD=libredd.it
|
#Environment=WHOOGLE_ALT_RD=libredd.it
|
||||||
#Environment=WHOOGLE_ALT_TL=lingva.ml
|
#Environment=WHOOGLE_ALT_TL=lingva.ml
|
||||||
|
#Environment=WHOOGLE_ALT_MD=scribe.rip
|
||||||
# Load values from dotenv only
|
# Load values from dotenv only
|
||||||
#Environment=WHOOGLE_DOTENV=1
|
#Environment=WHOOGLE_DOTENV=1
|
||||||
Type=simple
|
Type=simple
|
||||||
|
@ -312,6 +313,7 @@ There are a few optional environment variables available for customizing a Whoog
|
||||||
| WHOOGLE_ALT_IG | The instagram.com alternative to use when site alternatives are enabled in the config. |
|
| WHOOGLE_ALT_IG | The instagram.com alternative to use when site alternatives are enabled in the config. |
|
||||||
| WHOOGLE_ALT_RD | The reddit.com alternative to use when site alternatives are enabled in the config. |
|
| WHOOGLE_ALT_RD | The reddit.com alternative to use when site alternatives are enabled in the config. |
|
||||||
| WHOOGLE_ALT_TL | The Google Translate alternative to use. This is used for all "translate ____" searches. |
|
| WHOOGLE_ALT_TL | The Google Translate alternative to use. This is used for all "translate ____" searches. |
|
||||||
|
| WHOOGLE_ALT_MD | The medium.com alternative to use when site alternatives are enabled in the config. |
|
||||||
| WHOOGLE_AUTOCOMPLETE | Controls visibility of autocomplete/search suggestions. Default on -- use '0' to disable |
|
| WHOOGLE_AUTOCOMPLETE | Controls visibility of autocomplete/search suggestions. Default on -- use '0' to disable |
|
||||||
|
|
||||||
### Config Environment Variables
|
### Config Environment Variables
|
||||||
|
|
5
app.json
5
app.json
|
@ -70,6 +70,11 @@
|
||||||
"value": "lingva.ml",
|
"value": "lingva.ml",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
"WHOOGLE_ALT_MD": {
|
||||||
|
"description": "The site to use as a replacement for medium.com when site alternatives are enabled in the config.",
|
||||||
|
"value": "scribe.rip",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
"WHOOGLE_CONFIG_COUNTRY": {
|
"WHOOGLE_CONFIG_COUNTRY": {
|
||||||
"description": "[CONFIG] The country to use for restricting search results (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/countries.json)",
|
"description": "[CONFIG] The country to use for restricting search results (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/countries.json)",
|
||||||
"value": "",
|
"value": "",
|
||||||
|
|
|
@ -26,7 +26,8 @@ SITE_ALTS = {
|
||||||
'twitter.com': os.getenv('WHOOGLE_ALT_TW', 'nitter.net'),
|
'twitter.com': os.getenv('WHOOGLE_ALT_TW', 'nitter.net'),
|
||||||
'youtube.com': os.getenv('WHOOGLE_ALT_YT', 'invidious.snopyta.org'),
|
'youtube.com': os.getenv('WHOOGLE_ALT_YT', 'invidious.snopyta.org'),
|
||||||
'instagram.com': os.getenv('WHOOGLE_ALT_IG', 'bibliogram.art/u'),
|
'instagram.com': os.getenv('WHOOGLE_ALT_IG', 'bibliogram.art/u'),
|
||||||
'reddit.com': os.getenv('WHOOGLE_ALT_RD', 'libredd.it')
|
'reddit.com': os.getenv('WHOOGLE_ALT_RD', 'libredd.it'),
|
||||||
|
'medium.com': os.getenv('WHOOGLE_ALT_MD','scribe.rip'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +78,12 @@ def get_site_alt(link: str) -> str:
|
||||||
if site_key not in link:
|
if site_key not in link:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
link = link.replace(site_key, SITE_ALTS[site_key])
|
# Need to replace full hostname with alternative to encapsulate
|
||||||
|
# subdomains as well
|
||||||
|
|
||||||
|
hostname = urlparse.urlparse(link).hostname
|
||||||
|
|
||||||
|
link = link.replace(hostname, SITE_ALTS[site_key])
|
||||||
for prefix in SKIP_PREFIX:
|
for prefix in SKIP_PREFIX:
|
||||||
link = link.replace(prefix, '//')
|
link = link.replace(prefix, '//')
|
||||||
break
|
break
|
||||||
|
|
|
@ -37,6 +37,7 @@ services:
|
||||||
#- WHOOGLE_ALT_IG=bibliogram.art/u
|
#- WHOOGLE_ALT_IG=bibliogram.art/u
|
||||||
#- WHOOGLE_ALT_RD=libredd.it
|
#- WHOOGLE_ALT_RD=libredd.it
|
||||||
#- WHOOGLE_ALT_TL=lingva.ml
|
#- WHOOGLE_ALT_TL=lingva.ml
|
||||||
|
#- WHOOGLE_ALT_MD=scribe.rip
|
||||||
#env_file: # Alternatively, load variables from whoogle.env
|
#env_file: # Alternatively, load variables from whoogle.env
|
||||||
#- whoogle.env
|
#- whoogle.env
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#WHOOGLE_ALT_IG=bibliogram.art/u
|
#WHOOGLE_ALT_IG=bibliogram.art/u
|
||||||
#WHOOGLE_ALT_RD=libredd.it
|
#WHOOGLE_ALT_RD=libredd.it
|
||||||
#WHOOGLE_ALT_TL=lingva.ml
|
#WHOOGLE_ALT_TL=lingva.ml
|
||||||
|
#WHOOGLE_ALT_MD=scribe.rip
|
||||||
#WHOOGLE_USER=""
|
#WHOOGLE_USER=""
|
||||||
#WHOOGLE_PASS=""
|
#WHOOGLE_PASS=""
|
||||||
#WHOOGLE_PROXY_USER=""
|
#WHOOGLE_PROXY_USER=""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user