From bf92944b956ac270019eccbd929d9d3935918ae7 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Mon, 1 Aug 2022 11:49:09 -0600 Subject: [PATCH] Support quora and imdb alts through Farside Farside can now redirect quora links to querte instances and imdb links to libremdb instances. This updates Whoogle to perform link replacements for both services when site alts are configured. --- Dockerfile | 6 +++++- README.md | 20 ++++++++++++-------- app.json | 26 ++++++++++++++++++-------- app/utils/results.py | 4 +++- charts/whoogle/values.yaml | 6 ++++-- docker-compose-traefik.yaml | 2 ++ docker-compose.yml | 2 ++ whoogle.template.env | 2 ++ 8 files changed, 48 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2d89e16..6178dc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,8 @@ ARG medium_alt='farside.link/scribe' ARG translate_alt='farside.link/lingva' ARG imgur_alt='farside.link/rimgo' ARG wikipedia_alt='farside.link/wikiless' +ARG imdb_alt='farside.link/libremdb' +ARG quora_alt='farside.link/quetre' ENV CONFIG_VOLUME=$config_dir \ WHOOGLE_URL_PREFIX=$url_prefix \ @@ -63,7 +65,9 @@ ENV CONFIG_VOLUME=$config_dir \ WHOOGLE_ALT_MD=$medium_alt \ WHOOGLE_ALT_TL=$translate_alt \ WHOOGLE_ALT_IMG=$imgur_alt \ - WHOOGLE_ALT_WIKI=$wikipedia_alt + WHOOGLE_ALT_WIKI=$wikipedia_alt \ + WHOOGLE_ALT_IMDB=$imdb_alt \ + WHOOGLE_ALT_QUORA=$quora_alt WORKDIR /whoogle diff --git a/README.md b/README.md index c7344a0..5cb63db 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,8 @@ Description=Whoogle #Environment=WHOOGLE_ALT_TL=farside.link/lingva #Environment=WHOOGLE_ALT_IMG=farside.link/rimgo #Environment=WHOOGLE_ALT_WIKI=farside.link/wikiless +#Environment=WHOOGLE_ALT_IMDB=farside.link/libremdb +#Environment=WHOOGLE_ALT_QUORA=farside.link/quetre # Load values from dotenv only #Environment=WHOOGLE_DOTENV=1 Type=simple @@ -367,14 +369,16 @@ There are a few optional environment variables available for customizing a Whoog | WHOOGLE_PROXY_LOC | The location of the proxy server (host or ip). | | EXPOSE_PORT | The port where Whoogle will be exposed. | | HTTPS_ONLY | Enforce HTTPS. (See [here](https://github.com/benbusby/whoogle-search#https-enforcement)) | -| WHOOGLE_ALT_TW | The twitter.com alternative to use when site alternatives are enabled in the config. | -| WHOOGLE_ALT_YT | The youtube.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_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_ALT_IMG | The imgur.com alternative to use when site alternatives are enabled in the config. | -| WHOOGLE_ALT_WIKI | The wikipedia.com alternative to use when site alternatives are enabled in the config. | +| WHOOGLE_ALT_TW | The twitter.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_YT | The youtube.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_IG | The instagram.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_RD | The reddit.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_TL | The Google Translate alternative to use. This is used for all "translate ____" searches. Set to "" to disable. | +| WHOOGLE_ALT_MD | The medium.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_IMG | The imgur.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_WIKI | The wikipedia.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_IMDB | The imdb.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | +| WHOOGLE_ALT_QUORA | The quora.com alternative to use when site alternatives are enabled in the config. Set to "" to disable. | | WHOOGLE_AUTOCOMPLETE | Controls visibility of autocomplete/search suggestions. Default on -- use '0' to disable. | | WHOOGLE_MINIMAL | Remove everything except basic result cards from all search queries. | | WHOOGLE_CSP | Sets a default set of 'Content-Security-Policy' headers | diff --git a/app.json b/app.json index 64042c8..d1a3f94 100644 --- a/app.json +++ b/app.json @@ -81,15 +81,25 @@ "required": false }, "WHOOGLE_ALT_IMG": { - "description": "The site to use as a replacement for imgur.com when site alternatives are enabled in the config.", - "value": "farside.link/rimgo", - "required": false - }, + "description": "The site to use as a replacement for imgur.com when site alternatives are enabled in the config.", + "value": "farside.link/rimgo", + "required": false + }, "WHOOGLE_ALT_WIKI": { - "description": "The site to use as a replacement for wikipedia.com when site alternatives are enabled in the config.", - "value": "farside.link/wikiless", - "required": false - }, + "description": "The site to use as a replacement for wikipedia.com when site alternatives are enabled in the config.", + "value": "farside.link/wikiless", + "required": false + }, + "WHOOGLE_ALT_IMDB": { + "description": "The site to use as a replacement for imdb.com when site alternatives are enabled in the config.", + "value": "farside.link/libremdb", + "required": false + }, + "WHOOGLE_ALT_QUORA": { + "description": "The site to use as a replacement for quora.com when site alternatives are enabled in the config.", + "value": "farside.link/quetre", + "required": false + }, "WHOOGLE_MINIMAL": { "description": "Remove everything except basic result cards from all search queries (set to 1 or leave blank)", "value": "", diff --git a/app/utils/results.py b/app/utils/results.py index edfbbd9..ead9e37 100644 --- a/app/utils/results.py +++ b/app/utils/results.py @@ -38,7 +38,9 @@ SITE_ALTS = { 'levelup.gitconnected.com' ], os.getenv('WHOOGLE_ALT_MD', 'farside.link/scribe')), 'imgur.com': os.getenv('WHOOGLE_ALT_IMG', 'farside.link/rimgo'), - 'wikipedia.org': os.getenv('WHOOGLE_ALT_WIKI', 'farside.link/wikiless') + 'wikipedia.org': os.getenv('WHOOGLE_ALT_WIKI', 'farside.link/wikiless'), + 'imdb.com': os.getenv('WHOOGLE_ALT_IMDB', 'farside.link/libremdb'), + 'quora.com': os.getenv('WHOOGLE_ALT_QUORA', 'farside.link/quetre') } diff --git a/charts/whoogle/values.yaml b/charts/whoogle/values.yaml index 9adbd86..877adb2 100644 --- a/charts/whoogle/values.yaml +++ b/charts/whoogle/values.yaml @@ -40,8 +40,10 @@ conf: {} # 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_MD: "" # The medium.com alternative to use when site alternatives are enabled in the config. - # WHOOGLE_ALT_IMG: "" # The imgur.com alternative to use when site alternatives are enabled in the config. - # WHOOGLE_ALT_WIKI: "" # The wikipedia.com alternative to use when site alternatives are enabled in the config. + # WHOOGLE_ALT_IMG: "" # The imgur.com alternative to use when site alternatives are enabled in the config. + # WHOOGLE_ALT_WIKI: "" # The wikipedia.com alternative to use when site alternatives are enabled in the config. + # WHOOGLE_ALT_IMDB: "" # The imdb.com alternative to use. Set to "" to continue using imdb.com when site alternatives are enabled. + # WHOOGLE_ALT_QUORA: "" # The quora.com alternative to use. Set to "" to continue using quora.com when site alternatives are enabled. # WHOOGLE_AUTOCOMPLETE: "" # Controls visibility of autocomplete/search suggestions. Default on -- use '0' to disable # WHOOGLE_MINIMAL: "" # Remove everything except basic result cards from all search queries. diff --git a/docker-compose-traefik.yaml b/docker-compose-traefik.yaml index b1f5c9d..53680c9 100644 --- a/docker-compose-traefik.yaml +++ b/docker-compose-traefik.yaml @@ -66,6 +66,8 @@ services: #- WHOOGLE_ALT_TL=farside.link/lingva #- WHOOGLE_ALT_IMG=farside.link/rimgo #- WHOOGLE_ALT_WIKI=farside.link/wikiless + #- WHOOGLE_ALT_IMDB=farside.link/libremdb + #- WHOOGLE_ALT_QUORA=farside.link/quetre # - WHOOGLE_CONFIG_DISABLE=1 # - WHOOGLE_CONFIG_SEARCH_LANGUAGE=lang_en # - WHOOGLE_CONFIG_GET_ONLY=1 diff --git a/docker-compose.yml b/docker-compose.yml index f38cfdc..8e1428c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,6 +40,8 @@ services: #- WHOOGLE_ALT_TL=farside.link/lingva #- WHOOGLE_ALT_IMG=farside.link/rimgo #- WHOOGLE_ALT_WIKI=farside.link/wikiless + #- WHOOGLE_ALT_IMDB=farside.link/libremdb + #- WHOOGLE_ALT_QUORA=farside.link/quetre #env_file: # Alternatively, load variables from whoogle.env #- whoogle.env ports: diff --git a/whoogle.template.env b/whoogle.template.env index fc87f27..d0bc440 100644 --- a/whoogle.template.env +++ b/whoogle.template.env @@ -15,6 +15,8 @@ #WHOOGLE_ALT_TL=farside.link/lingva #WHOOGLE_ALT_IMG=farside.link/rimgo #WHOOGLE_ALT_WIKI=farside.link/wikiless +#WHOOGLE_ALT_IMDB=farside.link/libremdb +#WHOOGLE_ALT_QUORA=farside.link/quetre #WHOOGLE_USER="" #WHOOGLE_PASS="" #WHOOGLE_PROXY_USER=""