From 8f70236403ccf2d563853bbf2390fcfe0aa19d2a Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Sat, 23 Oct 2021 23:23:37 -0600 Subject: [PATCH 1/5] Update domains used for scribe.rip replacements The levelup.gitconnected.com site is a Medium site that can also be replaced with scribe.rip whenever privacy respecting site alternatives are enabled in the config. Also modified how link descriptions are updated when that config is enabled (before it was missing replacements on quite a few descriptions). --- app/filter.py | 11 +++++++++-- app/utils/results.py | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/filter.py b/app/filter.py index 97d52db..8f241e5 100644 --- a/app/filter.py +++ b/app/filter.py @@ -331,8 +331,15 @@ class Filter: if len(link_desc) == 0: return - # Replace link destination - link_desc[0].replace_with(get_site_alt(link_desc[0])) + # Replace link description + link_desc = link_desc[0] + for site, alt in SITE_ALTS.items(): + if site not in link_desc: + continue + new_desc = BeautifulSoup(features='html.parser').new_tag('div') + new_desc.string = str(link_desc).replace(site, alt) + link_desc.replace_with(new_desc) + break def view_image(self, soup) -> BeautifulSoup: """Replaces the soup with a new one that handles mobile results and diff --git a/app/utils/results.py b/app/utils/results.py index a199427..8141074 100644 --- a/app/utils/results.py +++ b/app/utils/results.py @@ -27,7 +27,10 @@ SITE_ALTS = { 'youtube.com': os.getenv('WHOOGLE_ALT_YT', 'invidious.snopyta.org'), 'instagram.com': os.getenv('WHOOGLE_ALT_IG', 'bibliogram.art/u'), 'reddit.com': os.getenv('WHOOGLE_ALT_RD', 'libredd.it'), - 'medium.com': os.getenv('WHOOGLE_ALT_MD', 'scribe.rip'), + **dict.fromkeys([ + 'medium.com', + 'levelup.gitconnected.com' + ], os.getenv('WHOOGLE_ALT_MD', 'scribe.rip')) } From 91002ec6bea1795b2ba60d4ab89925a48e23db4d Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Sat, 23 Oct 2021 23:54:05 -0600 Subject: [PATCH 2/5] Update default theme css I've gotten a bit bored of the current light/dark themes, so I'm switching the default theme over to the Doppelganger theme, which is a better template/jumping off point for users to use when creating custom themes since it also provides examples for coloring each of the Whoogle logo letters. --- app/static/css/variables.css | 52 +++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/app/static/css/variables.css b/app/static/css/variables.css index 1a531a0..e53d157 100644 --- a/app/static/css/variables.css +++ b/app/static/css/variables.css @@ -3,7 +3,7 @@ /* LIGHT THEME COLORS */ --whoogle-logo: #685e79; --whoogle-page-bg: #ffffff; - --whoogle-element-bg: #685e79; + --whoogle-element-bg: #4285f4; --whoogle-text: #000000; --whoogle-contrast-text: #ffffff; --whoogle-secondary-text: #70757a; @@ -11,18 +11,44 @@ --whoogle-result-title: #1967d2; --whoogle-result-url: #0d652d; --whoogle-result-visited: #4b11a8; - --whoogle-divider: #dfe1e5; /* DARK THEME COLORS */ - --whoogle-dark-logo: #888888; - --whoogle-dark-page-bg: #080808; - --whoogle-dark-element-bg: #111111; - --whoogle-dark-text: #dddddd; - --whoogle-dark-contrast-text: #aaaaaa; - --whoogle-dark-secondary-text: #8a8b8c; - --whoogle-dark-result-bg: #111111; - --whoogle-dark-result-title: #dddddd; - --whoogle-dark-result-url: #eceff4; - --whoogle-dark-result-visited: #959595; - --whoogle-dark-divider: #111111; + --whoogle-dark-logo: #685e79; + --whoogle-dark-page-bg: #101020; + --whoogle-dark-element-bg: #4285f4; + --whoogle-dark-text: #ffffff; + --whoogle-dark-contrast-text: #ffffff; + --whoogle-dark-secondary-text: #bbbbbb; + --whoogle-dark-result-bg: #212131; + --whoogle-dark-result-title: #64a7f6; + --whoogle-dark-result-url: #34a853; + --whoogle-dark-result-visited: #bbbbff; +} + +#whoogle-w { + fill: #4285f4; +} + +#whoogle-h { + fill: #ea4335; +} + +#whoogle-o-1 { + fill: #fbbc05; +} + +#whoogle-o-2 { + fill: #4285f4; +} + +#whoogle-g { + fill: #34a853; +} + +#whoogle-l { + fill: #ea4335; +} + +#whoogle-e { + fill: #fbbc05; } From 19e89de5d914ded63e25d64118243fd9299b6ad5 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Sun, 24 Oct 2021 00:17:38 -0600 Subject: [PATCH 3/5] Expand on "features" section of readme The "no JS" and "no cookies" portions of the readme warranted further explanation. Since Whoogle uses JS and server-side cookies, it might be confusing to a passerby what is actually meant by this. Note that both JS and cookies can be blocked and Whoogle will still be able to perform searches perfectly well. Also updated the "theme" feature description --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8522da8..e8ff31e 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ Contents ## Features - No ads or sponsored content -- No JavaScript -- No cookies -- No tracking/linking of your personal IP address\* +- No JavaScript\* +- No cookies\*\* +- No tracking/linking of your personal IP address\*\*\* - No AMP links - No URL tracking tags (i.e. utm=%s) - No referrer header @@ -49,14 +49,18 @@ Contents - Autocomplete/search suggestions - POST request search and suggestion queries (when possible) - View images at full res without site redirect (currently mobile only) -- Dark mode +- Light/Dark/System theme modes (with support for [custom CSS theming](https://github.com/benbusby/whoogle-search/wiki/User-Contributed-CSS-Themes)) - Randomly generated User Agent - Easy to install/deploy - DDG-style bang (i.e. `! `) searches - Optional location-based searching (i.e. results near \) -- Optional NoJS mode to disable all Javascript in results +- Optional NoJS mode to view search results in a separate window with JavaScript blocked -*If deployed to a remote server, or configured to send requests through a VPN, Tor, proxy, etc. +*No third party JavaScript. Whoogle can be used with JavaScript disabled, but if enabled, uses JavaScript for things like presenting search suggestions. + +**No third party cookies. Whoogle uses server side cookies (sessions) to store non-sensitive configuration settings such as theme, language, etc. Just like with JavaScript, cookies can be disabled and not affect Whoogle's search functionality. + +***If deployed to a remote server, or configured to send requests through a VPN, Tor, proxy, etc. ## Dependencies If using Heroku Quick Deploy, **you can skip this section**. From 999248d71b957460ec1e8269b8a9bc83a9c43dac Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Sun, 24 Oct 2021 18:41:13 -0600 Subject: [PATCH 4/5] Use externally accessible links for images in readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e8ff31e..94a81c5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Whoogle Search](docs/banner.png) +![Whoogle Search](https://raw.githubusercontent.com/benbusby/whoogle-search/main/docs/banner.png) [![Latest Release](https://img.shields.io/github/v/release/benbusby/whoogle-search)](https://github.com/benbusby/shoogle/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -505,7 +505,7 @@ A lot of the app currently piggybacks on Google's existing support for fetching ## Screenshots #### Desktop -![Whoogle Desktop](docs/screenshot_desktop.jpg) +![Whoogle Desktop](https://raw.githubusercontent.com/benbusby/whoogle-search/main/docs/screenshot_desktop.jpg) #### Mobile -![Whoogle Mobile](docs/screenshot_mobile.jpg) +![Whoogle Mobile](https://raw.githubusercontent.com/benbusby/whoogle-search/main/docs/screenshot_mobile.jpg) From 5118ddb8b8c70e42a01b39187d41afa3579e2379 Mon Sep 17 00:00:00 2001 From: Vansh Comar <69755265+vacom13@users.noreply.github.com> Date: Tue, 26 Oct 2021 03:19:09 +0530 Subject: [PATCH 5/5] Allow setting "Accept-Language" header (#483) Closes #445 --- app/models/config.py | 1 + app/request.py | 13 ++++++++++++- app/templates/index.html | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/models/config.py b/app/models/config.py index 1902009..ef4204f 100644 --- a/app/models/config.py +++ b/app/models/config.py @@ -28,6 +28,7 @@ class Config: self.new_tab = read_config_bool('WHOOGLE_CONFIG_NEW_TAB') self.view_image = read_config_bool('WHOOGLE_CONFIG_VIEW_IMAGE') self.get_only = read_config_bool('WHOOGLE_CONFIG_GET_ONLY') + self.accept_language = False self.safe_keys = [ 'lang_search', diff --git a/app/request.py b/app/request.py index 68e30d8..9bb9bd0 100644 --- a/app/request.py +++ b/app/request.py @@ -157,6 +157,12 @@ class Request: self.language = ( config.lang_search if config.lang_search else '' ) + + # For setting Accept-language Header + self.lang_interface = '' + if config.accept_language: + self.lang_interface = config.lang_interface + self.mobile = bool(normal_ua) and ('Android' in normal_ua or 'iPhone' in normal_ua) self.modified_user_agent = gen_user_agent(self.mobile) @@ -243,7 +249,12 @@ class Request: 'User-Agent': modified_user_agent } - # FIXME: Should investigate this further to ensure the consent + # Adding the Accept-Language to the Header if possible + if self.lang_interface: + headers.update({'Accept-Language': + self.lang_interface.replace('lang_', '') + + ';q=1.0'}) + # view is suppressed correctly now = datetime.now() cookies = { diff --git a/app/templates/index.html b/app/templates/index.html index 435dcf3..27b1f1b 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -177,6 +177,10 @@
+
+
+ +