diff --git a/app/models/config.py b/app/models/config.py index 2419fe0..3c33af4 100644 --- a/app/models/config.py +++ b/app/models/config.py @@ -17,7 +17,7 @@ class Config: self.block = os.getenv('WHOOGLE_CONFIG_BLOCK', '') self.block_title = os.getenv('WHOOGLE_CONFIG_BLOCK_TITLE', '') self.block_url = os.getenv('WHOOGLE_CONFIG_BLOCK_URL', '') - self.ctry = os.getenv('WHOOGLE_CONFIG_COUNTRY', 'US') + self.country = os.getenv('WHOOGLE_CONFIG_COUNTRY', 'US') self.theme = os.getenv('WHOOGLE_CONFIG_THEME', 'system') self.safe = read_config_bool('WHOOGLE_CONFIG_SAFE') self.dark = read_config_bool('WHOOGLE_CONFIG_DARK') # deprecated @@ -33,9 +33,11 @@ class Config: self.safe_keys = [ 'lang_search', 'lang_interface', - 'ctry', - 'dark', - 'theme' + 'country', + 'theme', + 'alts', + 'new_tab', + 'safe' ] # Skip setting custom config if there isn't one @@ -107,3 +109,17 @@ class Config: continue self[param_key] = params.get(param_key) return self + + def to_params(self) -> str: + """Generates a set of safe params for using in Whoogle URLs + + Returns: + str -- a set of URL parameters + """ + param_str = '' + for safe_key in self.safe_keys: + if not self[safe_key]: + continue + param_str = param_str + f'&{safe_key}={self[safe_key]}' + + return param_str diff --git a/app/request.py b/app/request.py index ae36824..efba21e 100644 --- a/app/request.py +++ b/app/request.py @@ -120,7 +120,7 @@ def gen_query(query, args, config, near_city=None) -> str: if 'chips' in args: param_dict['chips'] = '&chips=' + args.get('chips') - param_dict['gl'] = ('&gl=' + config.ctry) if config.ctry else '' + param_dict['gl'] = ('&gl=' + config.country) if config.country else '' param_dict['hl'] = '&hl=' + ( config.lang_interface.replace('lang_', '') if config.lang_interface else '' diff --git a/app/static/css/main.css b/app/static/css/main.css index 9801657..a4179be 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -176,3 +176,10 @@ details summary { padding: 10px; font-weight: bold; } + +/* Mobile styles */ +@media (max-width: 1000px) { + select { + width: 100%; + } +} diff --git a/app/templates/index.html b/app/templates/index.html index 6957d2d..079b440 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -85,15 +85,15 @@
-
- - + {% for country in countries %} + {% endfor %} diff --git a/test/conftest.py b/test/conftest.py index 3068b32..64e49f5 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -9,7 +9,7 @@ demo_config = { 'nojs': str(random.getrandbits(1)), 'lang_interface': random.choice(app.config['LANGUAGES'])['value'], 'lang_search': random.choice(app.config['LANGUAGES'])['value'], - 'ctry': random.choice(app.config['COUNTRIES'])['value'] + 'country': random.choice(app.config['COUNTRIES'])['value'] }