Add option to disable changing of configuration
This commit is contained in:
parent
d2fac809ca
commit
447a415e16
6
app.json
6
app.json
|
@ -75,6 +75,12 @@
|
||||||
"value": "",
|
"value": "",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
"WHOOGLE_CONFIG_DISABLE_CHANGE": {
|
||||||
|
"description": "[CONFIG] Disable ability for client to change config (set to 1 or leave blank)",
|
||||||
|
"value": "",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
|
||||||
"WHOOGLE_CONFIG_DARK": {
|
"WHOOGLE_CONFIG_DARK": {
|
||||||
"description": "[CONFIG] Enable dark mode (set to 1 or leave blank)",
|
"description": "[CONFIG] Enable dark mode (set to 1 or leave blank)",
|
||||||
"value": "",
|
"value": "",
|
||||||
|
|
|
@ -129,6 +129,7 @@ def index():
|
||||||
logo=render_template(
|
logo=render_template(
|
||||||
'logo.html',
|
'logo.html',
|
||||||
dark=g.user_config.dark),
|
dark=g.user_config.dark),
|
||||||
|
config_disabled=os.getenv('WHOOGLE_CONFIG_DISABLE_CHANGE', ''),
|
||||||
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'])
|
||||||
|
@ -237,6 +238,7 @@ def search():
|
||||||
@app.route('/config', methods=['GET', 'POST', 'PUT'])
|
@app.route('/config', methods=['GET', 'POST', 'PUT'])
|
||||||
@auth_required
|
@auth_required
|
||||||
def config():
|
def config():
|
||||||
|
if os.getenv('WHOOGLE_CONFIG_DISABLE_CHANGE', '') != '':
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return json.dumps(g.user_config.__dict__)
|
return json.dumps(g.user_config.__dict__)
|
||||||
elif request.method == 'PUT':
|
elif request.method == 'PUT':
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
<input type="submit" id="search-submit" value="Search">
|
<input type="submit" id="search-submit" value="Search">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{% if config_disabled == '' %}
|
||||||
<br/>
|
<br/>
|
||||||
<button id="config-collapsible" class="collapsible">Configuration</button>
|
<button id="config-collapsible" class="collapsible">Configuration</button>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -142,6 +143,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<p style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};">
|
<p style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};">
|
||||||
|
|
|
@ -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_DISABLE_CHANGE=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
|
||||||
#WHOOGLE_CONFIG_ALTS=1 # Use social media site alternatives
|
#WHOOGLE_CONFIG_ALTS=1 # Use social media site alternatives
|
||||||
|
|
Loading…
Reference in New Issue
Block a user