mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add app settings to redirect request
This commit is contained in:
parent
6f5bac8eca
commit
d915628bd7
2 changed files with 11 additions and 7 deletions
|
@ -555,8 +555,7 @@ app:
|
||||||
action_help: List all web admin modules
|
action_help: List all web admin modules
|
||||||
api: GET /modules
|
api: GET /modules
|
||||||
configuration:
|
configuration:
|
||||||
authenticate:
|
authenticate: false
|
||||||
authenticator: ldap-anonymous
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# Backup #
|
# Backup #
|
||||||
|
|
13
app.py
13
app.py
|
@ -757,12 +757,15 @@ def app_setting(app, key, value=None, delete=False):
|
||||||
if app_settings is not None and key in app_settings:
|
if app_settings is not None and key in app_settings:
|
||||||
return app_settings[key]
|
return app_settings[key]
|
||||||
else:
|
else:
|
||||||
|
yaml_settings=['redirected_urls','redirected_regex']
|
||||||
# Set the value
|
# Set the value
|
||||||
if app_settings is None:
|
if app_settings is None:
|
||||||
app_settings = {}
|
app_settings = {}
|
||||||
if delete and key in app_settings:
|
if delete and key in app_settings:
|
||||||
del app_settings[key]
|
del app_settings[key]
|
||||||
else:
|
else:
|
||||||
|
if key in yaml_settings:
|
||||||
|
value=yaml.load(value)
|
||||||
app_settings[key] = value
|
app_settings[key] = value
|
||||||
|
|
||||||
with open(settings_file, 'w') as f:
|
with open(settings_file, 'w') as f:
|
||||||
|
@ -890,7 +893,7 @@ def app_ssowatconf(auth):
|
||||||
protected_urls = []
|
protected_urls = []
|
||||||
protected_regex = []
|
protected_regex = []
|
||||||
redirected_regex = { main_domain +'/yunohost[\/]?$': 'https://'+ main_domain +'/yunohost/sso/' }
|
redirected_regex = { main_domain +'/yunohost[\/]?$': 'https://'+ main_domain +'/yunohost/sso/' }
|
||||||
|
redirected_urls ={}
|
||||||
apps = {}
|
apps = {}
|
||||||
try:
|
try:
|
||||||
apps_list = app_list()['apps']
|
apps_list = app_list()['apps']
|
||||||
|
@ -922,9 +925,10 @@ def app_ssowatconf(auth):
|
||||||
if item[-1:] == '/':
|
if item[-1:] == '/':
|
||||||
item = item[:-1]
|
item = item[:-1]
|
||||||
protected_urls.append(app_settings['domain'] + app_settings['path'][:-1] + item)
|
protected_urls.append(app_settings['domain'] + app_settings['path'][:-1] + item)
|
||||||
if 'protected_regex' in app_settings:
|
if 'redirected_urls' in app_settings:
|
||||||
for item in app_settings['protected_regex'].split(','):
|
redirected_urls.update(app_settings['redirected_urls'])
|
||||||
protected_regex.append(item)
|
if 'redirected_regex' in app_settings:
|
||||||
|
redirected_regex.update(app_settings['redirected_regex'])
|
||||||
|
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
skipped_urls.extend(['/yunohost/admin', '/yunohost/api'])
|
skipped_urls.extend(['/yunohost/admin', '/yunohost/api'])
|
||||||
|
@ -945,6 +949,7 @@ def app_ssowatconf(auth):
|
||||||
'skipped_regex': skipped_regex,
|
'skipped_regex': skipped_regex,
|
||||||
'unprotected_regex': unprotected_regex,
|
'unprotected_regex': unprotected_regex,
|
||||||
'protected_regex': protected_regex,
|
'protected_regex': protected_regex,
|
||||||
|
'redirected_urls': redirected_urls,
|
||||||
'redirected_regex': redirected_regex,
|
'redirected_regex': redirected_regex,
|
||||||
'users': users,
|
'users': users,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue