Made some changes
This commit is contained in:
parent
e7be6c4156
commit
6b38c2b6cf
2
app.json
2
app.json
|
@ -75,7 +75,7 @@
|
|||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"WHOOGLE_CONFIG_DISABLE_CHANGE": {
|
||||
"WHOOGLE_CONFIG_DISABLE": {
|
||||
"description": "[CONFIG] Disable ability for client to change config (set to 1 or leave blank)",
|
||||
"value": "",
|
||||
"required": false
|
||||
|
|
|
@ -39,6 +39,7 @@ app.config['CONFIG_PATH'] = os.getenv(
|
|||
app.config['DEFAULT_CONFIG'] = os.path.join(
|
||||
app.config['CONFIG_PATH'],
|
||||
'config.json')
|
||||
app.config['CONFIG_DISABLE'] = os.getenv('WHOOGLE_CONFIG_DISABLE', '')
|
||||
app.config['SESSION_FILE_DIR'] = os.path.join(
|
||||
app.config['CONFIG_PATH'],
|
||||
'session')
|
||||
|
|
|
@ -129,7 +129,7 @@ def index():
|
|||
logo=render_template(
|
||||
'logo.html',
|
||||
dark=g.user_config.dark),
|
||||
config_disabled=os.getenv('WHOOGLE_CONFIG_DISABLE_CHANGE', ''),
|
||||
config_disabled=app.config['CONFIG_DISABLE'],
|
||||
config=g.user_config,
|
||||
tor_available=int(os.environ.get('TOR_AVAILABLE')),
|
||||
version_number=app.config['VERSION_NUMBER'])
|
||||
|
@ -238,9 +238,10 @@ def search():
|
|||
@app.route('/config', methods=['GET', 'POST', 'PUT'])
|
||||
@auth_required
|
||||
def config():
|
||||
config_disabled = app.config['CONFIG_DISABLE']
|
||||
if request.method == 'GET':
|
||||
return json.dumps(g.user_config.__dict__)
|
||||
elif request.method == 'PUT' and os.getenv('WHOOGLE_CONFIG_DISABLE_CHANGE', '') == '':
|
||||
elif request.method == 'PUT' and not config_disabled:
|
||||
if 'name' in request.args:
|
||||
config_pkl = os.path.join(
|
||||
app.config['CONFIG_PATH'],
|
||||
|
@ -251,7 +252,7 @@ def config():
|
|||
return json.dumps(session['config'])
|
||||
else:
|
||||
return json.dumps({})
|
||||
elif os.getenv('WHOOGLE_CONFIG_DISABLE_CHANGE', '') == '':
|
||||
elif not config_disabled:
|
||||
config_data = request.form.to_dict()
|
||||
if 'url' not in config_data or not config_data['url']:
|
||||
config_data['url'] = g.user_config.url
|
||||
|
|
|
@ -15,7 +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_DISABLE=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