Commit Graph

423 Commits

Author SHA1 Message Date
Ben Busby
b39ba0533a
Suppress spurious warnings from bs4
More MarkupResemblesLocatorWarning warnings have been appearing. This
seems to be caused by parsing HTML content that contains a URL.

This new change suppresses the warning at the root level of the app
before any content has been parsed, so this error shouldn't appear
again.

Fixes #968
2023-03-22 12:29:05 -06:00
xatier
f970b62f12
Update zh-tw translation (#973)
* Add translation for new strings from 7041b43db9
  Use same terms as Google's zh-tw interface.
* Fix missing period
* Sync string order with en (easier for future updates)
2023-03-20 13:08:18 -06:00
xatier
b1e468ff01
Fix bug in title/url blocking regex (#969)
Fix the exception `AttributeError: 'Filter' object has no attribute 'block_url'`
introduced in this commit [1].

`self.block_title` and `self.block_url` were members of the Filter
object[2], but not anymore after commit [1].

This bug can be reproduced with setting WHOOGLE_CONFIG_BLOCK_URL to a
non-empty string.

[1] 10a15e06e1
[2] 284a8102c8
2023-03-14 11:22:53 -06:00
Ben Busby
8c426ab180
Suppress invalid warning from bs4, add 404 handler
An invalid parsing warning was being thrown by the latest version of the
bs4 library. This suppresses that warning from being shown in the
console.

A 404 handler was added to move logging from the console to the error
template, since a lot of users assumed that 404 errors from the result
page were problems with Whoogle itself.

Fixes #967
2023-03-07 11:28:55 -07:00
Ben Busby
f7c4381ba6
Remove preferences arg from opensearch template
When a browser adds a search engine using the opensearch template, it
does not have the correct context necessary to autofill the
`preferences` arg with the user's session prefs. As a result, queries
made using the browser bar will have the instance's default preferences
filled into the template.

Removing this shouldn't have any side effects, since queries made on the
same machine will have the correct session associated with the user.

Fixes #929
2023-03-06 15:33:28 -07:00
João
baa8bd0eb4
Add auth to cookie (#964)
When authenticated, the cookie set will allow the user to stay connected even
if the browser is restarted.

Fixes #951
2023-03-01 09:58:59 -07:00
Ben Busby
1759c119a8
Replace Python 3.10 match with if/else
Some distributions require manually installing Python 3.10, which makes
it less convenient than just using whatever version of Python3.X the
package manager supports. Since the only 3.10 feature being used was
"match", and it was a very small change, it's been replaced with an
if/else statement to ensure compatibility with older versions of Python
3.
2023-03-01 09:42:30 -07:00
Ben Busby
fb8a2ea325
Include prefs arg in footer navigation
Navigating between pages of results now includes the user's preferences
string, which allows them to retain their config for a particular
instance between result pages.

Fixes #960
2023-02-21 09:57:44 -07:00
Ben Busby
6b56dab4c1
Remove ig->bibliogram redirects
Bibliogram has been discontinued, and the remaining instances aren't
very reliable. As a result, all instagram redirects have been removed.

Fixes #955
2023-02-21 09:42:42 -07:00
elliot
7ca69e752d
Add calculator widget (#956)
This adds a simple calculator widget, somewhat similar to the one presented
when searching calculator on Google.

Also, it adds somewhat of a template for making the addition of new widgets
easier via the app/utils/widgets.py file. My eventual plan is to use this to
create more widgets that appear in Google, such as a color picker, timer, etc.

---------

Co-authored-by: Ben Busby <contact@benbusby.com>
2023-02-21 09:36:38 -07:00
Ben Busby
991fe6d910
Exclude subdomain in Medium->Scribe redirects
Medium redirects needed further cleanup to account for instances where a
link contains a subdomain that would not make sense in a Farside
redirect link.

Fixes #947
2023-02-04 16:36:16 -07:00
test2user-aqil
09db4ff730
Add Azerbaijani translation (#944)
* Add Azerbaijani translation

Co-authored-by: Ben Busby <contact@benbusby.com>
2023-01-30 12:46:10 -07:00
Ahmad Alkadri
16794df68d
Add Indonesian translation (#940) 2023-01-30 12:33:17 -07:00
George T
94b208dd3f
Update greek translations (#943)
Add Hellenic Language

Co-authored-by: Ben Busby <contact@benbusby.com>
2023-01-30 12:32:01 -07:00
Ben Busby
12ce174b9a
Include url prefix for reverse proxied instances
The url prefix was not included when reconstructing the root url using
X-Forwarded-* headers, causing some elements to fail to load properly.

Fixes #937
2023-01-30 12:13:46 -07:00
Ahmad Alkadri
e5a5aad997
Always bold CN/JA/KO search terms (#928)
Add a function to check if target_word contains CJK characters

If a search term contains Chinese, Japanese, or Korean characters,
the term is bolded in search results regardless of whitespace.

CJK characters: Chinese, Japanese (hiragana, katakana, kanji), 
and Korean (hangul syllables, hangul jamo)

Co-authored-by: Ben Busby <contact@benbusby.com>
2023-01-09 12:54:41 -07:00
Ben Busby
fdc63b862e
Autoload whoogle.env if it exists
The whoogle.env file previously needed to be created and enabled using
the WHOOGLE_DOTENV var. This removes the second step and loads the env
file if it's found during app init.

The Dockerfile has also been updated to copy in whoogle.env if it
exists.

Fixes #909
2023-01-04 10:35:42 -07:00
Ben Busby
aa54491ae0
Log rate-limiting errors
Rate limiting is now reported to the console as an error message.

Fixes #914
2023-01-04 10:21:16 -07:00
Charles Zawacki
cec10e81d3
Don't prepend to services that have schemes with '//' (#925) 2023-01-04 10:10:32 -07:00
Charles Zawacki
a760476d1b
Omit 'mobile.' and 'm.' in site alt replacements (#922)
Resolves #921
2023-01-03 10:19:39 -07:00
fiestasiesta
253ea62f8f
[Mobile] Add line break between header options (#918)
Fixes an issue where "Time Period" shows up on a separate
line from its dropdown
2022-12-30 12:01:47 -07:00
Ben Busby
c24caceb03
Omit "www." in site alt replacements
Fixes #913
2022-12-29 16:16:29 -07:00
Ahmad Alkadri
3dda8b25ef
Escape html text in result body (#912)
Moved the cleaner functions to app/utils/escaper.py

Removed unused import 're'

Moved the cleaner functionalities to the "search.py" and "routes.py"

Making sure escaped chars stay escaped during process

Replaced "&lt;" and "&gt;" with "andlt;" and "andgt;", respectively. This way,
when the 'response' object get loaded to bsoup (which happens several times
throughout the process between search.py and routes.py), bsoup will not
unescape them.
2022-12-29 15:19:28 -07:00
MoistCat
08aa1ab8f1
Handle missing result div in filter (#911)
Changed "find_all()[0]" for find; which yields only one result.

Added check to ensure result_div exists before searching
for results.
2022-12-29 15:17:34 -07:00
fiestasiesta
7041b43db9
Add time constraint to search options (#888)
Introduces the ability to refine searches by time period:
- Past hour
- Past 24 hours
- Past week
- Past month
- Past year

Co-authored-by: Ben Busby <contact@benbusby.com>
2022-12-21 13:24:27 -07:00
Ben Busby
c9c197bb5f
Bump version to 0.8.1 2022-12-19 10:52:02 -07:00
Ben Busby
7a852aa876
Allow HTTP-exclusive proxies for all requests
Proxies that only support HTTP were causing request timeouts due to an
invalid upgrade to HTTPS when creating the request. This update restores
the ability to have an HTTP-only proxy for all requests.

Fixes #906
2022-12-12 16:40:15 -07:00
Cx
8fbbdf2cec
Update Kurdish translation (#903) 2022-12-09 14:14:11 -07:00
Ben Busby
3dc6d14377
Only extract domain+ext when using site alts
Parent sites using a 'www' subdomain or something similar were not
redirecting properly. This updates the hostname check to only validate
against the primary domain, except for Wikipedia since the subdomain is
used for interface translation in that case.

Fixes #901
2022-12-08 10:54:21 -07:00
Ben Busby
fd85f1573a
Refactor site alt link replacement
Replacing result links and text when site alts are enabled is now part
of its own function, and handles replacement of link location and link
description separately.

Fixes #880
2022-12-05 13:28:29 -07:00
Ben Busby
0310f0f542
Use app init enc key by default for all queries
This can be updated later to allow users with cookies enabled to use a
key that is unique to their session (if they want, not mandatory), but
for now it makes more sense to just use a single key for all queries
from all users. This should eliminate a lot of issues that users have
reported where they are unable to decrypt queries or page elements due
to an expired/renewed session key.
2022-12-05 12:14:14 -07:00
Ben Busby
3bd785b9b7
Update sponsored result filter for german results
Adds 'gesponsert' to ad keyword blacklist

Fixes #892
2022-11-28 10:18:10 -07:00
Ben Busby
33742ce247
Revert change to light theme contrast text color
The change made to whoogle-contrast-text in #873 wasn't the right
decision, since whoogle-contrast-text is meant to contrast with darker
UI elements. whoogle-text already contrasts with the default white
background.
2022-11-25 16:38:46 -07:00
Anna
08b16f5a0c
Switch to PEP517 standard for builds (#887)
* Sync setup.cfg with requirements.txt

* Include tests in PyPI tarballs

And exclude them from setuptools

* Set version number only once

Switch to PEP517 standard (pyproject.toml) for builds
2022-11-25 16:24:38 -07:00
Ben Busby
d099b46336
Bump version to 0.8.0 2022-11-23 11:43:42 -07:00
Ben Busby
09a90ec46a
Match only "//medium" and ".medium.com" for scribe links
Closes #885
2022-11-22 17:34:25 -07:00
Xabi
6bd48e40a7
Include new ad filter keyword (#879)
Adds "sponsored" result keyword for Spanish language
2022-11-07 20:50:27 -07:00
curlpipe
2d23e0e952
Add Welsh translation (#876) 2022-11-04 11:51:30 -06:00
xatier
1a66b195d4
Update zh-tw translation (#875) 2022-11-02 10:26:25 -06:00
Ben Busby
06fd29f663
Update ad filter keywords
New changes to google search now include ads prefixed with the keyword
"sponsored". This update should remove these from appearing in search
results.

Fixes #871
2022-10-31 13:02:20 -06:00
Ben Busby
6696f2b12b
Escape word in term-bolding regex
Fixes #869
2022-10-31 12:45:44 -06:00
João
77884d05f2
Fix color for light contrast text (#873)
The color for the variable whoogle-contrast-text should be black or gray;
otherwise it will not be shown with white background.
2022-10-31 12:39:52 -06:00
João
3e39e0e041
Fix missing args in docstring [skip ci] (#872)
Update docstring with new arg
2022-10-31 12:36:50 -06:00
João
2a37619028
Replace error query params w/ preferences param (#867) 2022-10-26 10:26:14 -06:00
Abir10101
75682de892
Fix regex for bolding search terms (#865)
Updated regex to not remove chinese letters in bolding regex
2022-10-26 10:23:39 -06:00
João
e99db8db26
Add country and interface lang to autocomplete (#866) 2022-10-26 10:20:21 -06:00
watchakorn-18k
4b2b0bf3c9
Include thai keyword in ads blacklist (#857) 2022-10-03 11:21:17 -06:00
watchakorn-18k
3943b2bc2c
Add thai translations (#856) 2022-10-03 11:20:40 -06:00
João
219fc58401
Fix handling of bangs (#851)
Changed the implementation to work if the bang is at anyplace in the query.

Added a check to not spend time looking for an operator if a "!" is not present
in the query.

No longer allowed to have the bang at the "!" char at the end, since this may
cause some conflicts like the issue cited before, where the ! is after a word
in the query, which is natural in most languages.
2022-09-30 14:39:13 -06:00
João
74503d542e
Encode config params in URL (#842)
Adds support for encoding (and optionally encrypting) user config values as
a single string that can be passed to any endpoint with the "preferences" url
param.

Co-authored-by: Ben Busby <contact@benbusby.com>
2022-09-22 14:14:56 -06:00