1
0
Fork 0
forked from s3lph/matemat

fix: default values of config options SignupKioskMode and BarcodeWebsocketAcl did not work

This commit is contained in:
s3lph 2024-12-11 01:35:32 +01:00
parent d163cfda05
commit 2fdc73c35b
Signed by untrusted user: s3lph
GPG key ID: 0AA29A52FB33CFB5
2 changed files with 4 additions and 2 deletions

View file

@ -70,7 +70,8 @@ def signup():
elif request.method != 'GET':
abort(405, 'Method not allowed')
acl = netaddr.IPSet([addr.strip() for addr in config.get('SignupKioskMode', '').split(',')])
acl_addrs = [s.strip() for s in config.get('SignupKioskMode', '').split(',') if s.strip()]
acl = netaddr.IPSet(acl_addrs)
if request.remote_addr in acl:
return template.render('signup_kiosk.html',
signup=(config.get('SignupEnabled', '0') == '1'),

View file

@ -29,7 +29,8 @@ def render(name: str, **kwargs):
global __jinja_env
config = get_app_config()
template: jinja2.Template = __jinja_env.get_template(name)
wsacl = netaddr.IPSet([addr.strip() for addr in config.get('BarcodeWebsocketAcl', '').split(',')])
wsacl_addrs = [s.strip() for s in config.get('BarcodeWebsocketAcl', '').split(',') if s.strip()]
wsacl = netaddr.IPSet(wsacl_addrs)
if config.get('BarcodeWebsocketUrl', '') and hasattr(request, 'remote_addr') and request.remote_addr in wsacl:
bcwebsocket = config.get('BarcodeWebsocketUrl')
else: