Commit Graph

551 Commits (0e5630f33a1c50d2ef4faa6685e25eb0ffd689c8)
 

Author SHA1 Message Date
Laurent le Beau-Martin 1a3790c7b1
Only open external links in a new tab (#380) 3 years ago
සයුරි | Sayuri 8e91564600
Update translations (#373) 3 years ago
KokoTheBest a69ec74cfd
Make replit install all requirements first (#378)
* Make replit install all requirements first

This should install all requirements from requirements.txt. It makes this a one click experience, without the user having to run `pip install -r requirements.txt` and then tap the run button. I myself had to first run that command in my repl, so I have made this change so others don't have to do the same.

repl.it also runs on linux based systems, so `&&` is the correct bash syntax.

* Running in Bash

I applied the same change I made on onBoot to the run variable, and made the language bash as the syntax `./` and `&&` belong to bash.
3 years ago
Ben Busby 694642ccb3
Set bg color for "top stories" elements 3 years ago
Ben Busby 38c38a772f
Find valid parent element when collapsing result content
Previously if a result element marked for collapsing didn't have a valid
"parent" element, the collapsing was skipped altogether. This loops
through child elements until a valid parent is found (or if one isn't
found, the element will not be collapsed).
3 years ago
Ben Busby 958faed1b6
Set user ownership of static build dir 3 years ago
Ben Busby 13202cc6b1
Ensure existence of static build dir 3 years ago
Ben Busby 68fdd55482
Use cache busting for css/js files
On app init, short hashes are generated from file checksums to use for
cache busting. These hashes are added into the full file name and used
to symlink to the actual file contents. These symlinks are loaded in the
jinja templates for each page, and can tell the browser to load a new
file if the hash changes.

This is only in place for css and js files, but can be extended in the
future for other file types if needed.
3 years ago
Ben Busby c41e0fc239
Allow theme to mirror user system settings
Introduces a new config element and environment variable
(WHOOGLE_CONFIG_THEME) for setting the theme of the app. Rather than
just having either light or dark, this allows a user to have their
instance use their current system light/dark preference to determine the
theme to use.

As a result, the dark mode setting (and WHOOGLE_CONFIG_DARK) have been
deprecated, but will still work as expected until a system theme has
been chosen.
3 years ago
Ben Busby afd01820bb
Collapse long result sections into details/summary elements
Sections such as "People also asked" and "related searches" typically
take up a lot of room on the results page, and don't always have the
most useful information. This checks for result elements with more than
7 child divs, extracts the section title, and wraps all elements in a
"details" element that can be expanded/collapsed by the user.

Note that this functionality existed previously (albeit not implemented
as well), but due to changes in how Google returns searches (switching
from using <h2> elements for section headers to <span> or <div>
elements), the approach to collapsing these sections needed to be
updated.
3 years ago
Ben Busby d894bd347d
Handle error when parsing image result url 3 years ago
Ben Busby b21b4f4f57
Skip parsing user agent if absent from request 3 years ago
Ben Busby bcb1d8ecc9
Add lingva translation support in search (#360)
* Add support for Lingva translations in results

Searches that contain the word "translate" and are normal search queries
(i.e. not news/images/video/etc) now create an iframe to a Lingva url to
translate the user's search using their configured search language.

The Lingva url can be configured using the WHOOGLE_ALT_TL env var, or
will fall back to the official Lingva instance url (lingva.ml).

For more info, visit https://github.com/TheDavidDelta/lingva-translate

* Add basic test for lingva results

* Allow user specified lingva instances through csp frame-src

* Fix pep8 issue
3 years ago
deluxghost 82ccace647
Add zh-CN translation (#355) 3 years ago
Aikatsui a6b4252210
Add Sinhala translation (#353) 3 years ago
Ben Busby 83d19d7644
Update instructions for Firefox 89+
Also adds steps to take for allowing searches using Firefox Containers

Closes #352
3 years ago
Ben Busby 904091f440
Bump version to 0.5.4 3 years ago
Ben Busby 44b0fe519c
Revert changes to default language config
A recent issue brought up a good point about how the latest changes to
setting default language to english break functionality for bilingual
users. The change was likely not the best solution for users who were
being affected by IP geolocation on their instances -- the right
solution for that would be to configure the interface/search language to
their preference instead.
3 years ago
Ben Busby e7a604d428
Fix handling of http (vs https) proxy creation
The requests library requires both 'http' and 'https' values in any
included proxy dict, and whoogle was previously copying the http proxy
to https for simplicity. The assumption was that if the underlying
request wasn't able to connect via https, it would default to http
(otherwise why have the requirement to specify both?)

This led to connectivity issues for users with http only proxies as of
the latest urllib and requests package versions, which are a lot more
strict with connections over https. With the latest versions, if an
https connection cannot be made, the library returns an error.

As a result, the new proxy dict must look something like this for plain
http proxies:

{'http': 'http://domain.tld:port', 'https': 'http://domain.tld:port'}

where both http and https are identical, but both are still required.
3 years ago
Ben Busby a64a86efb6
Bump version to 0.5.3 3 years ago
Ricardo 9d024cffce
Add Portuguese translation (#345)
* Add Portuguese translation

* Update translations.json
3 years ago
Ben Busby 614dceeb70
Add fallback interface/search lang + cleanup
Since the interface language defaults to IP geolocation by google, the
default language is now set to english. Still not sure if this is the
best solution, but at least temporarily should clear up some confusion
for users with instances deployed in countries outside of their own.

Also performed some minor cleanup:
  - Updated name of strip_blocked_sites to clean_query
  - Added clean_query to list of jinja template functions
  - Ensured site block list doesn't contain duplicate filters
3 years ago
bruvv 3892355199
Add Dutch translation (#343) 3 years ago
Ben Busby e1a9ec03f0
Update requests version to 2.25.1
Resolves conflict between prior version of requests and the new patched
version of urllib3
3 years ago
dependabot[bot] fbbe658320
Bump urllib3 from 1.25.9 to 1.26.5 (#341)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.9 to 1.26.5.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.25.9...1.26.5)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years ago
Ben Busby 59479228bf
Add clarification note for Whoogle CSP headers
Fixes #336
3 years ago
Myzel394 7103d9eccb
Add German translation (#339)
* Added german language

* Fixed translations.json path

* Fixed German name
3 years ago
Ben Busby cbe32a081e
Hotfix: extract only 'q' element from query string
Occasionally the search results will contain links with arguments such
as 'dq', which was being erroneously used in attempts to extract the 'q'
element from query strings. This enforces that only links with '?q=' or
'&q=' (elements with a standalone 'q' arg) will have the element
extracted.

I also refactored the naming of this element once extracted to be just
'q'. Although this seems counterintuitive, it makes a little more sense
since this element is the one we're extracting. It's a vague url arg
name, but it is what it is.

Bump version to 0.5.2 for hotfix release
3 years ago
Jerome Gravel-Niquet e1e6e84649
Add instructions to deploy to Fly.io (#330)
* Add instructions to deploy to Fly.io

* Put Fly.io as #3 in the installation options
3 years ago
Ben Busby 43faaee77f
Hotfix: remove site filter for maps links
The new site filter breaks links to Maps results, so filter.py needed
to be updated to handle these links as a unique case. A new method was
introduced to easily remove any "-site:..." filters from the query,
which is now also used to format queries in the header template rather
than manually removing the blocked site list within the template itself.

Bumps version to 0.5.1 for releasing the bugfix

Fixes #329
3 years ago
Federico Torrielli cf55765933
Add italian localization (#327) 3 years ago
Ben Busby 4649d96dda
Support basic localization (#325)
* Replace hardcoded strings using translation json file

This introduces a new "translations.json" file under app/static/settings
that is loaded on app init and uses the user config value for interface
language to determine the appropriate strings to use in Whoogle-specific
elements of the UI (primarily only on the home page).

* Verify interface lang can be used for localization

Check the configured interface language against the available
localization dict before attempting to use, otherwise fall back to
english.

Also expanded language names in the languages json file.

* Add test for validating translation language keys

Also adds Spanish translation to json (the only non-English language I
can add and reasonably validate on my own).

* Validate all translations against original keyset, update readme

Readme has been updated to include basic contributing guidelines for
both code and translations.
3 years ago
Justin Goette 7c221b7f7f
Remove duplicate docker-compose restart (#324) 3 years ago
Oscar c2a76bd73a
Add new public instance to readme (#323)
https://whoogle.silkky.cloud
3 years ago
Ben Busby 75e7410981
Add WHOOGLE_CONFIG_DISABLE doc to readme 3 years ago
Joao A. Candido Ramos 448efb8f2a
Add "view image" functionality (#268)
* add view image option

* prevent whoogle links from opening in a new tab.

* remove view image template on mobile requests

* change loop values to be more robust to the number of images

* Update app/templates/imageresults.html

* fix "Basically the .cvifge class needs width: 100%; in order to expand the search input to fit the form width."

* Update app/templates/imageresults.html

* remove hardcoded string from template

* Add view image config var to app.json

* Add view image config var to whoogle.env

Co-authored-by: jacr13 <ramos.joao@protonmail.com>
Co-authored-by: Ben Busby <benbusby@protonmail.com>
3 years ago
Ben Busby fcfa3783e3
Bump version to 0.5.0 3 years ago
Ben Busby d5eebe9fe5
Add iframe-able search page for insertion into other sites
Introduces a new html template, search.html, which provides a very basic
form for submitting search queries.

Closes #319
3 years ago
Ben Busby 3f1096b05d
Remove search.whoogle.tech public instance
The instance is no longer maintained.
3 years ago
Ben Busby 373a466cb5
Use relative paths in readme toc
This change was needed to allow mirrored readmes to still link to the
correct section without redirecting to github.
3 years ago
Ben Busby 65d948368c
Add read-only mirrors to readme 3 years ago
Ben Busby 2bd17bef47
Expand readme toc, add chromium instructions 3 years ago
Exonip 45f7522e65
Add public instance "search.exonip.de" (#321) 3 years ago
Ben Busby 1fdf226802
Use curl-based healthcheck w/ new non-auth route
The wget method seemed to have a possible issue with creating endless
index.html copies (despite being specified to output to console only),
so this has been updated to use curl instead.

Also uses new non-authenticated "healthz" route to perform the
healthcheck.

Fix #316

Fix #313
3 years ago
bruvv 27b6d05b6a
Fix EU consent bug (#320)
* Update request.py

* Use current date to format EU consent cookie

Co-authored-by: Ben Busby <benbusby@protonmail.com>
3 years ago
Harsh Barsaiyan 4466bbc8f4
Add divider to user-defined CSS (#310) 3 years ago
Ben Busby 05995649f3
Hotfix: check for site filters before modifying query
The previous method of removing all site filters from the search query
removed the last letter of the search. This only applies the substring
filter if any site filters are present in the query.

Fixes #306
3 years ago
Ben Busby c8da53d4b0
Block websites from search results via user config (#304)
* Block websites in search results via user config

Adds a new config field "Block" to specify a comma separated list of
websites to block in search results. This is applied for all searches.

* Add test for blocking sites from search results

* Document WHOOGLE_CONFIG_BLOCK usage

* Strip '-site:' filters from query in header template

The 'behind the scenes' site filter applied for blocked sites was
appearing in the query field when navigating between search categories
(all -> images -> news, etc). This prevents the filter from appearing in
all except "images", since the image category uses a separate header.
This should eventually be addressed when the image page can begin using
the standard whoogle header, but until then, the filter will still
appear for image searches.
3 years ago
Ben Busby a7bf9728e3
Allow 'data:' for img src in app CSP
Disallowing base64 images in the app resulted in broken image
placeholders for things like pronunciation guides, business reviews,
etc.
3 years ago
Ben Busby 35aa02167c
Clarify how to enable whoogle.env for docker/docker-compose
The readme section on enabling whoogle.env needed to be updated to clarify
how it should work for "docker-compose" and "docker build" runs.
3 years ago