Merge branch 'main' into disable-client-config
This commit is contained in:
commit
45f1f1e857
25
README.md
25
README.md
|
@ -258,18 +258,19 @@ There are a few optional environment variables available for customizing a Whoog
|
||||||
### Config Environment Variables
|
### Config Environment Variables
|
||||||
These environment variables allow setting default config values, but can be overwritten manually by using the home page config menu. These allow a shortcut for destroying/rebuilding an instance to the same config state every time.
|
These environment variables allow setting default config values, but can be overwritten manually by using the home page config menu. These allow a shortcut for destroying/rebuilding an instance to the same config state every time.
|
||||||
|
|
||||||
| Variable | Description |
|
| Variable | Description |
|
||||||
| ----------------------- | --------------------------------------------------------------- |
|
| ------------------------------ | --------------------------------------------------------------- |
|
||||||
| WHOOGLE_CONFIG_COUNTRY | Filter results by hosting country |
|
| WHOOGLE_CONFIG_COUNTRY | Filter results by hosting country |
|
||||||
| WHOOGLE_CONFIG_LANGUAGE | Set interface and search result language |
|
| WHOOGLE_CONFIG_LANGUAGE | Set interface language |
|
||||||
| WHOOGLE_CONFIG_DARK | Enable dark theme |
|
| WHOOGLE_CONFIG_SEARCH_LANGUAGE | Set search result language |
|
||||||
| WHOOGLE_CONFIG_SAFE | Enable safe searches |
|
| WHOOGLE_CONFIG_DARK | Enable dark theme |
|
||||||
| WHOOGLE_CONFIG_ALTS | Use social media site alternatives (nitter, invidious, etc) |
|
| WHOOGLE_CONFIG_SAFE | Enable safe searches |
|
||||||
| WHOOGLE_CONFIG_TOR | Use Tor routing (if available) |
|
| WHOOGLE_CONFIG_ALTS | Use social media site alternatives (nitter, invidious, etc) |
|
||||||
| WHOOGLE_CONFIG_NEW_TAB | Always open results in new tab |
|
| WHOOGLE_CONFIG_TOR | Use Tor routing (if available) |
|
||||||
| WHOOGLE_CONFIG_GET_ONLY | Search using GET requests only |
|
| WHOOGLE_CONFIG_NEW_TAB | Always open results in new tab |
|
||||||
| WHOOGLE_CONFIG_URL | The root url of the instance (`https://<your url>/`) |
|
| WHOOGLE_CONFIG_GET_ONLY | Search using GET requests only |
|
||||||
| WHOOGLE_CONFIG_STYLE | The custom CSS to use for styling (must be single line) |
|
| WHOOGLE_CONFIG_URL | The root url of the instance (`https://<your url>/`) |
|
||||||
|
| WHOOGLE_CONFIG_STYLE | The custom CSS to use for styling (should be single line) |
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Same as most search engines, with the exception of filtering by time range.
|
Same as most search engines, with the exception of filtering by time range.
|
||||||
|
|
7
app.json
7
app.json
|
@ -71,7 +71,12 @@
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"WHOOGLE_CONFIG_LANGUAGE": {
|
"WHOOGLE_CONFIG_LANGUAGE": {
|
||||||
"description": "[CONFIG] The language to use for search results and interface (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/languages.json)",
|
"description": "[CONFIG] The language to use for the interface (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/languages.json)",
|
||||||
|
"value": "",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"WHOOGLE_CONFIG_SEARCH_LANGUAGE": {
|
||||||
|
"description": "[CONFIG] The language to use for search results (use values from https://raw.githubusercontent.com/benbusby/whoogle-search/develop/app/static/settings/languages.json)",
|
||||||
"value": "",
|
"value": "",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Config:
|
||||||
|
|
||||||
app_config = current_app.config
|
app_config = current_app.config
|
||||||
self.url = os.getenv('WHOOGLE_CONFIG_URL', '')
|
self.url = os.getenv('WHOOGLE_CONFIG_URL', '')
|
||||||
self.lang_search = os.getenv('WHOOGLE_CONFIG_LANGUAGE', '')
|
self.lang_search = os.getenv('WHOOGLE_CONFIG_SEARCH_LANGUAGE', '')
|
||||||
self.lang_interface = os.getenv('WHOOGLE_CONFIG_LANGUAGE', '')
|
self.lang_interface = os.getenv('WHOOGLE_CONFIG_LANGUAGE', '')
|
||||||
self.style = os.getenv(
|
self.style = os.getenv(
|
||||||
'WHOOGLE_CONFIG_STYLE',
|
'WHOOGLE_CONFIG_STYLE',
|
||||||
|
@ -36,11 +36,12 @@ class Config:
|
||||||
|
|
||||||
# Skip setting custom config if there isn't one
|
# Skip setting custom config if there isn't one
|
||||||
if kwargs:
|
if kwargs:
|
||||||
for attr in self.get_mutable_attrs():
|
mutable_attrs = self.get_mutable_attrs()
|
||||||
if attr not in kwargs.keys():
|
for attr in mutable_attrs:
|
||||||
setattr(self, attr, '')
|
if attr in kwargs.keys():
|
||||||
else:
|
|
||||||
setattr(self, attr, kwargs[attr])
|
setattr(self, attr, kwargs[attr])
|
||||||
|
elif attr not in kwargs.keys() and mutable_attrs[attr] == bool:
|
||||||
|
setattr(self, attr, False)
|
||||||
|
|
||||||
def __getitem__(self, name):
|
def __getitem__(self, name):
|
||||||
return getattr(self, name)
|
return getattr(self, name)
|
||||||
|
@ -55,7 +56,7 @@ class Config:
|
||||||
return hasattr(self, name)
|
return hasattr(self, name)
|
||||||
|
|
||||||
def get_mutable_attrs(self):
|
def get_mutable_attrs(self):
|
||||||
return {name: attr for name, attr in self.__dict__.items()
|
return {name: type(attr) for name, attr in self.__dict__.items()
|
||||||
if not name.startswith("__")
|
if not name.startswith("__")
|
||||||
and (type(attr) is bool or type(attr) is str)}
|
and (type(attr) is bool or type(attr) is str)}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ select {
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-bar {
|
#search-bar {
|
||||||
border: 2px solid var(--whoogle-dark-element-bg) !important;
|
border-color: var(--whoogle-dark-element-bg) !important;
|
||||||
color: var(--whoogle-dark-text) !important;
|
color: var(--whoogle-dark-text) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@ header {
|
||||||
font-smoothing: antialiased;
|
font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-bar-desktop {
|
||||||
|
border-radius: 8px 8px 0 0;
|
||||||
|
height: 40px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.search-div {
|
.search-div {
|
||||||
border-radius: 8px 8px 0 0;
|
border-radius: 8px 8px 0 0;
|
||||||
box-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
|
box-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
|
||||||
|
@ -37,6 +42,7 @@ header {
|
||||||
height: 39px;
|
height: 39px;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
|
@ -61,7 +67,6 @@ header {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#main>div:focus-within {
|
#main>div:focus-within {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: 0 0 6px 1px #2375e8;
|
box-shadow: 0 0 6px 1px #2375e8;
|
||||||
|
|
|
@ -64,5 +64,6 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
resetBtn.addEventListener("click", event => {
|
resetBtn.addEventListener("click", event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
search.value = "";
|
search.value = "";
|
||||||
|
search.focus();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% if mobile %}
|
{% if mobile %}
|
||||||
<header>
|
<header>
|
||||||
<div class="bz1lBb">
|
<div style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important;" class="bz1lBb">
|
||||||
<form class="Pg70bf" id="search-form" method="POST">
|
<form class="search-form Pg70bf" id="search-form" method="POST">
|
||||||
<a class="logo-link mobile-logo"
|
<a class="logo-link mobile-logo"
|
||||||
href="/"
|
href="/"
|
||||||
style="display:flex; justify-content:center; align-items:center;">
|
style="display:flex; justify-content:center; align-items:center;">
|
||||||
|
@ -21,7 +21,6 @@
|
||||||
name="q"
|
name="q"
|
||||||
style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important;
|
style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important;
|
||||||
color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};
|
color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};
|
||||||
border: {{ '2px solid var(--whoogle-dark-element-bg)' if config.dark else '' }}; border-radius: 8px;"
|
|
||||||
type="text"
|
type="text"
|
||||||
value="{{ query }}">
|
value="{{ query }}">
|
||||||
<input style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }}" id="search-reset" type="reset" value="x">
|
<input style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }}" id="search-reset" type="reset" value="x">
|
||||||
|
@ -51,14 +50,14 @@
|
||||||
autocapitalize="none"
|
autocapitalize="none"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
autocorrect="off"
|
autocorrect="off"
|
||||||
class="noHIxc"
|
class="search-bar-desktop noHIxc"
|
||||||
name="q"
|
name="q"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
type="text"
|
type="text"
|
||||||
value="{{ query }}"
|
value="{{ query }}"
|
||||||
style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important;
|
style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important;
|
||||||
color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};
|
color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};
|
||||||
border: {{ '2px solid var(--whoogle-dark-element-bg)' if config.dark else '0px' }}; border-radius: 8px;">
|
border-bottom: {{ '2px solid var(--whoogle-dark-element-bg)' if config.dark else '0px' }};">
|
||||||
<input name="tbm" value="{{ search_type }}" style="display: none">
|
<input name="tbm" value="{{ search_type }}" style="display: none">
|
||||||
<input type="submit" style="display: none;">
|
<input type="submit" style="display: none;">
|
||||||
<div class="sc"></div>
|
<div class="sc"></div>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#WHOOGLE_CONFIG_COUNTRY=countryUK # See app/static/settings/countries.json for values
|
#WHOOGLE_CONFIG_COUNTRY=countryUK # See app/static/settings/countries.json for values
|
||||||
#WHOOGLE_CONFIG_LANGUAGE=lang_en # See app/static/settings/languages.json for values
|
#WHOOGLE_CONFIG_LANGUAGE=lang_en # See app/static/settings/languages.json for values
|
||||||
|
#WHOOGLE_CONFIG_SEARCH_LANGUAGE=lang_en # See app/static/settings/languages.json for values
|
||||||
#WHOOGLE_CONFIG_DISABLE=1 # Disables changing of config from client
|
#WHOOGLE_CONFIG_DISABLE=1 # Disables changing of config from client
|
||||||
#WHOOGLE_CONFIG_DARK=1 # Dark mode
|
#WHOOGLE_CONFIG_DARK=1 # Dark mode
|
||||||
#WHOOGLE_CONFIG_SAFE=1 # Safe searches
|
#WHOOGLE_CONFIG_SAFE=1 # Safe searches
|
||||||
|
|
Loading…
Reference in New Issue
Block a user