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": "",
|
||||
"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": {
|
||||
"description": "[CONFIG] Enable dark mode (set to 1 or leave blank)",
|
||||
"value": "",
|
||||
|
|
|
@ -129,6 +129,7 @@ def index():
|
|||
logo=render_template(
|
||||
'logo.html',
|
||||
dark=g.user_config.dark),
|
||||
config_disabled=os.getenv('WHOOGLE_CONFIG_DISABLE_CHANGE', ''),
|
||||
config=g.user_config,
|
||||
tor_available=int(os.environ.get('TOR_AVAILABLE')),
|
||||
version_number=app.config['VERSION_NUMBER'])
|
||||
|
@ -237,6 +238,7 @@ def search():
|
|||
@app.route('/config', methods=['GET', 'POST', 'PUT'])
|
||||
@auth_required
|
||||
def config():
|
||||
if os.getenv('WHOOGLE_CONFIG_DISABLE_CHANGE', '') != '':
|
||||
if request.method == 'GET':
|
||||
return json.dumps(g.user_config.__dict__)
|
||||
elif request.method == 'PUT':
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
<input type="submit" id="search-submit" value="Search">
|
||||
</div>
|
||||
</form>
|
||||
{% if config_disabled == '' %}
|
||||
<br/>
|
||||
<button id="config-collapsible" class="collapsible">Configuration</button>
|
||||
<div class="content">
|
||||
|
@ -142,6 +143,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<footer>
|
||||
<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_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_SAFE=1 # Safe searches
|
||||
#WHOOGLE_CONFIG_ALTS=1 # Use social media site alternatives
|
||||
|
|
Loading…
Reference in New Issue
Block a user