fix: non-http templates

This commit is contained in:
s3lph 2024-12-11 00:12:33 +01:00
parent 418d7ffea9
commit e23ba65c71
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5

View file

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