Skip to content

Commit

Permalink
Hotfix: Send generic "Mozilla" in user agent
Browse files Browse the repository at this point in the history
Randomizing the "Mozilla" portion of the user agent changed the
character encoding to GB2312. Setting it to plain "Mozilla" enforces
UTF-8 encoding.

Bump to version 0.4.1 for release of bug fix

Fixes #267
  • Loading branch information
benbusby committed Apr 8, 2021
1 parent 0baba58 commit a321d55
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
app.no_cookie_ips = []
app.config['SECRET_KEY'] = os.urandom(32)
app.config['SESSION_TYPE'] = 'filesystem'
app.config['VERSION_NUMBER'] = '0.4.0'
app.config['VERSION_NUMBER'] = '0.4.1'
app.config['APP_ROOT'] = os.getenv(
'APP_ROOT',
os.path.dirname(os.path.abspath(__file__)))
Expand Down
5 changes: 2 additions & 3 deletions app/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ def send_tor_signal(signal: Signal) -> bool:


def gen_user_agent(is_mobile) -> str:
mozilla = random.choice(['Moo', 'Woah', 'Bro', 'Slow']) + 'zilla'
firefox = random.choice(['Choir', 'Squier', 'Higher', 'Wire']) + 'fox'
linux = random.choice(['Win', 'Sin', 'Gin', 'Fin', 'Kin']) + 'ux'

if is_mobile:
return MOBILE_UA.format(mozilla, firefox)
return MOBILE_UA.format("Mozilla", firefox)

return DESKTOP_UA.format(mozilla, linux, firefox)
return DESKTOP_UA.format("Mozilla", linux, firefox)


def gen_query(query, args, config, near_city=None) -> str:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
author='Ben Busby',
author_email='benbusby@protonmail.com',
name='whoogle-search',
version='0.4.0',
version='0.4.1',
include_package_data=True,
install_requires=requirements,
description='Self-hosted, ad-free, privacy-respecting metasearch engine',
Expand Down

0 comments on commit a321d55

Please sign in to comment.