Merge branch 'main' into add-pref-url

This commit is contained in:
Joao Ramos 2022-09-21 13:24:43 +02:00
commit 0d31b1aeeb
6 changed files with 61 additions and 7 deletions

View File

@ -15,6 +15,8 @@ from dotenv import load_dotenv
from werkzeug.middleware.proxy_fix import ProxyFix
from app.utils.misc import read_config_bool
app = Flask(__name__, static_folder=os.path.dirname(
os.path.abspath(__file__)) + '/static')
@ -25,12 +27,12 @@ dot_env_path = (
'../whoogle.env'))
# Load .env file if enabled
if os.getenv('WHOOGLE_DOTENV', ''):
if read_config_bool('WHOOGLE_DOTENV'):
load_dotenv(dot_env_path)
app.default_key = generate_user_key()
if os.getenv('HTTPS_ONLY'):
if read_config_bool('HTTPS_ONLY'):
app.config['SESSION_COOKIE_NAME'] = '__Secure-session'
app.config['SESSION_COOKIE_SECURE'] = True

View File

@ -454,8 +454,11 @@ class Filter:
if any(url in link_netloc for url in unsupported_g_pages):
# FIXME: The "Shopping" tab requires further filtering (see #136)
# Temporarily removing all links to that tab for now.
# Replaces the /url google unsupported link to the direct url
link['href'] = link_netloc
parent = link.parent
if 'google.com/preferences?hl=' in link_netloc:
# Handle case where a search is performed in a different
# language than what is configured. This usually returns a

View File

@ -28,6 +28,7 @@
{"name": "Italian (Italiano)", "value": "lang_it"},
{"name": "Japanese (日本語)", "value": "lang_ja"},
{"name": "Korean (한국어)", "value": "lang_ko"},
{"name": "Kurdish (Kurdî)", "value": "lang_ku"},
{"name": "Latvian (Latvietis)", "value": "lang_lv"},
{"name": "Lithuanian (Lietuvis)", "value": "lang_lt"},
{"name": "Norwegian (Norwegian)", "value": "lang_no"},

View File

@ -783,5 +783,51 @@
"news": "뉴스",
"books": "도서",
"anon-view": "익명 보기"
},
"lang_ku": {
"search": "Lêgerîn",
"config": "Pevsazî",
"config-country": "Welat",
"config-lang": "Zimanê Navrûyê",
"config-lang-search": "Zimanê Lêgerînê",
"config-near": "Nêzîk",
"config-near-help": "Navê Bajêr",
"config-block": "Astengkirin",
"config-block-help": "Lîsteya malperê ya ji hev veqetandî bi rêya bêhnok",
"config-block-title": "Bi ya Sernavê Asteng bike",
"config-block-title-help": "regex bi kar bîne",
"config-block-url": "Bi ya URL asteng bike",
"config-block-url-help": "regex bi kar bîne",
"config-theme": "Rûkar",
"config-nojs": "Javascript Rake di Nîşandanên Nenenas de",
"config-anon-view": "Girêdanên Nenas Nîşan bide",
"config-dark": "Awaya Tarî",
"config-safe": "Lêgerîna Parastî",
"config-alts": "Girêdanên Medya Civakî Biguherîne",
"config-alts-help": "Girêdanên Twitter/YouTube/Instagram/hwd biguherîne bi alternatîvên ku ji taybetiyê re rêzê digrin.",
"config-new-tab": "Girêdanan di Rûgereke Nû de Veke",
"config-images": "Lêgerîna Wêne bi Mezinahiya Tevahî",
"config-images-help": "(Ezmûnî) Vebijêrka 'Wêneyê Nîşan bide' tevlî lêgerînên wêneyê yê sermaseyê bike. Ev ê bibe sedem ku encamê çareseriya wêneyn nîşanê kêmtir bibe.",
"config-tor": "Tor bi kar bîne",
"config-get-only": "Daxwazan bi Dest Bixe",
"config-url": "Reha URL",
"config-css": "CSS kesane bike",
"load": "Bar bike",
"apply": "Bisepîne",
"save-as": "Biparêze wekî...",
"github-link": "Li ser GitHub Nîşan bide",
"translate": "werger",
"light": "ronî",
"dark": "tarî",
"system": "pergal",
"ratelimit": "Mînak bi rêjeya sînorkirî ye",
"continue-search": "Lêgerîna xwe bi Farside bidomîne",
"all": "Hemû",
"images": "Wêne",
"maps": "Nexşe",
"videos": "Vîdyo",
"news": "Nûçe",
"books": "Pirtûk",
"anon-view": "Dîtina Nenas"
}
}

View File

@ -16,9 +16,11 @@ def gen_file_hash(path: str, static_file: str) -> str:
def read_config_bool(var: str) -> bool:
val = os.getenv(var, '0')
if val.isdigit():
return bool(int(val))
return False
# user can specify one of the following values as 'true' inputs (all
# variants with upper case letters will also work):
# ('true', 't', '1', 'yes', 'y')
val = val.lower() in ('true', 't', '1', 'yes', 'y')
return val
def get_client_ip(r: Request) -> str:

View File

@ -25,7 +25,7 @@ BLACKLIST = [
'Reklama', 'Реклама', 'Anunț', '광고', 'annons', 'Annonse', 'Iklan',
'広告', 'Augl.', 'Mainos', 'Advertentie', 'إعلان', 'Գովազդ', 'विज्ञापन',
'Reklam', 'آگهی', 'Reklāma', 'Reklaam', 'Διαφήμιση', 'מודעה', 'Hirdetés',
'Anúncio'
'Anúncio', 'Quảng cáo'
]
SITE_ALTS = {