Merge branch 'develop' into develop
This commit is contained in:
commit
a97bbc5475
|
@ -4,6 +4,7 @@ from app.utils.bangs import gen_bangs_json
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_session import Session
|
from flask_session import Session
|
||||||
import json
|
import json
|
||||||
|
import logging.config
|
||||||
import os
|
import os
|
||||||
from stem import Signal
|
from stem import Signal
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
@ -21,7 +22,7 @@ app.default_key = generate_user_key()
|
||||||
app.no_cookie_ips = []
|
app.no_cookie_ips = []
|
||||||
app.config['SECRET_KEY'] = os.urandom(32)
|
app.config['SECRET_KEY'] = os.urandom(32)
|
||||||
app.config['SESSION_TYPE'] = 'filesystem'
|
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.config['APP_ROOT'] = os.getenv(
|
||||||
'APP_ROOT',
|
'APP_ROOT',
|
||||||
os.path.dirname(os.path.abspath(__file__)))
|
os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
@ -74,3 +75,9 @@ Session(app)
|
||||||
send_tor_signal(Signal.HEARTBEAT)
|
send_tor_signal(Signal.HEARTBEAT)
|
||||||
|
|
||||||
from app import routes # noqa
|
from app import routes # noqa
|
||||||
|
|
||||||
|
# Disable logging from imported modules
|
||||||
|
logging.config.dictConfig({
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': True,
|
||||||
|
})
|
||||||
|
|
|
@ -153,7 +153,9 @@ class Filter:
|
||||||
|
|
||||||
if src.startswith(LOGO_URL):
|
if src.startswith(LOGO_URL):
|
||||||
# Re-brand with Whoogle logo
|
# Re-brand with Whoogle logo
|
||||||
element.replace_with(BeautifulSoup(render_template('logo.html')))
|
element.replace_with(BeautifulSoup(
|
||||||
|
render_template('logo.html', dark=self.dark),
|
||||||
|
features='html.parser'))
|
||||||
return
|
return
|
||||||
elif src.startswith(GOOG_IMG) or GOOG_STATIC in src:
|
elif src.startswith(GOOG_IMG) or GOOG_STATIC in src:
|
||||||
element['src'] = BLANK_B64
|
element['src'] = BLANK_B64
|
||||||
|
@ -164,7 +166,6 @@ class Filter:
|
||||||
is_element=True) + '&type=' + urlparse.quote(mime)
|
is_element=True) + '&type=' + urlparse.quote(mime)
|
||||||
|
|
||||||
def update_styling(self, soup) -> None:
|
def update_styling(self, soup) -> None:
|
||||||
""""""
|
|
||||||
# Remove unnecessary button(s)
|
# Remove unnecessary button(s)
|
||||||
for button in soup.find_all('button'):
|
for button in soup.find_all('button'):
|
||||||
button.decompose()
|
button.decompose()
|
||||||
|
|
|
@ -49,14 +49,13 @@ def send_tor_signal(signal: Signal) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def gen_user_agent(is_mobile) -> str:
|
def gen_user_agent(is_mobile) -> str:
|
||||||
mozilla = random.choice(['Moo', 'Woah', 'Bro', 'Slow']) + 'zilla'
|
|
||||||
firefox = random.choice(['Choir', 'Squier', 'Higher', 'Wire']) + 'fox'
|
firefox = random.choice(['Choir', 'Squier', 'Higher', 'Wire']) + 'fox'
|
||||||
linux = random.choice(['Win', 'Sin', 'Gin', 'Fin', 'Kin']) + 'ux'
|
linux = random.choice(['Win', 'Sin', 'Gin', 'Fin', 'Kin']) + 'ux'
|
||||||
|
|
||||||
if is_mobile:
|
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:
|
def gen_query(query, args, config, near_city=None) -> str:
|
||||||
|
|
|
@ -128,7 +128,7 @@ def index():
|
||||||
countries=app.config['COUNTRIES'],
|
countries=app.config['COUNTRIES'],
|
||||||
logo=render_template(
|
logo=render_template(
|
||||||
'logo.html',
|
'logo.html',
|
||||||
config=g.user_config),
|
dark=g.user_config.dark),
|
||||||
config=g.user_config,
|
config=g.user_config,
|
||||||
tor_available=int(os.environ.get('TOR_AVAILABLE')),
|
tor_available=int(os.environ.get('TOR_AVAILABLE')),
|
||||||
version_number=app.config['VERSION_NUMBER'])
|
version_number=app.config['VERSION_NUMBER'])
|
||||||
|
@ -227,7 +227,7 @@ def search():
|
||||||
search_header=(render_template(
|
search_header=(render_template(
|
||||||
'header.html',
|
'header.html',
|
||||||
config=g.user_config,
|
config=g.user_config,
|
||||||
logo=render_template('logo.html'),
|
logo=render_template('logo.html', dark=g.user_config.dark),
|
||||||
query=urlparse.unquote(query),
|
query=urlparse.unquote(query),
|
||||||
search_type=search_util.search_type,
|
search_type=search_util.search_type,
|
||||||
mobile=g.user_request.mobile)
|
mobile=g.user_request.mobile)
|
||||||
|
|
|
@ -86,11 +86,11 @@ select {
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible {
|
.collapsible {
|
||||||
color: var(--whoogle-dark-element-bg) !important;
|
color: var(--whoogle-dark-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible:after {
|
.collapsible:after {
|
||||||
color: var(--whoogle-dark-element-bg) !important;
|
color: var(--whoogle-dark-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
|
@ -104,11 +104,11 @@ select {
|
||||||
}
|
}
|
||||||
|
|
||||||
.active:after {
|
.active:after {
|
||||||
color: var(--whoogle-dark-contrast-text);
|
color: var(--whoogle-dark-contrast-text) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#gh-link {
|
#gh-link {
|
||||||
color: var(--whoogle-dark-element-bg);
|
color: var(--whoogle-dark-contrast-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.autocomplete-items {
|
.autocomplete-items {
|
||||||
|
|
|
@ -86,11 +86,11 @@ input {
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible {
|
.collapsible {
|
||||||
color: var(--whoogle-element-bg) !important;
|
color: var(--whoogle-text) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible:after {
|
.collapsible:after {
|
||||||
color: var(--whoogle-element-bg) !important;
|
color: var(--whoogle-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
--whoogle-result-visited: #4b11a8;
|
--whoogle-result-visited: #4b11a8;
|
||||||
|
|
||||||
/* DARK THEME COLORS */
|
/* DARK THEME COLORS */
|
||||||
--whoogle-dark-logo: #685e79;
|
--whoogle-dark-logo: #888888;
|
||||||
--whoogle-dark-page-bg: #222222;
|
--whoogle-dark-page-bg: #080808;
|
||||||
--whoogle-dark-element-bg: #685e79;
|
--whoogle-dark-element-bg: #111111;
|
||||||
--whoogle-dark-text: #ffffff;
|
--whoogle-dark-text: #dddddd;
|
||||||
--whoogle-dark-contrast-text: #000000;
|
--whoogle-dark-contrast-text: #aaaaaa;
|
||||||
--whoogle-dark-secondary-text: #bbbbbb;
|
--whoogle-dark-secondary-text: #8a8b8c;
|
||||||
--whoogle-dark-result-bg: #000000;
|
--whoogle-dark-result-bg: #111111;
|
||||||
--whoogle-dark-result-title: #1967d2;
|
--whoogle-dark-result-title: #dddddd;
|
||||||
--whoogle-dark-result-url: #4b11a8;
|
--whoogle-dark-result-url: #eceff4;
|
||||||
--whoogle-dark-result-visited: #bbbbff;
|
--whoogle-dark-result-visited: #959595;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
{{ response|safe }}
|
{{ response|safe }}
|
||||||
</body>
|
</body>
|
||||||
<footer>
|
<footer>
|
||||||
<p style="color: {{ '#fff' if config.dark else '#000' }};">
|
<p style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};">
|
||||||
Whoogle Search v{{ version_number }} ||
|
Whoogle Search v{{ version_number }} ||
|
||||||
<a style="color: #685e79" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>
|
<a id="gh-link" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="static/js/autocomplete.js"></script>
|
<script src="static/js/autocomplete.js"></script>
|
||||||
|
|
|
@ -150,10 +150,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<p style="color: {{ '#fff' if config.dark else '#000' }};">
|
<p style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};">
|
||||||
Whoogle Search v{{ version_number }} ||
|
Whoogle Search v{{ version_number }} ||
|
||||||
<a id="gh-link" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>
|
<a id="gh-link" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<svg id="Layer_1" class="whoogle-svg" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1028 254">
|
<svg id="Layer_1" class="whoogle-svg" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1028 254">
|
||||||
<style>
|
<style>
|
||||||
path {
|
path {
|
||||||
fill: {{ 'var(--whoogle-dark-logo)' if config.dark else 'var(--whoogle-logo)' }};
|
fill: {{ 'var(--whoogle-dark-logo)' if dark else 'var(--whoogle-logo)' }};
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<defs>
|
<defs>
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -8,7 +8,7 @@ setuptools.setup(
|
||||||
author='Ben Busby',
|
author='Ben Busby',
|
||||||
author_email='benbusby@protonmail.com',
|
author_email='benbusby@protonmail.com',
|
||||||
name='whoogle-search',
|
name='whoogle-search',
|
||||||
version='0.4.0',
|
version='0.4.1',
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=requirements,
|
install_requires=requirements,
|
||||||
description='Self-hosted, ad-free, privacy-respecting metasearch engine',
|
description='Self-hosted, ad-free, privacy-respecting metasearch engine',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user