|
@@ -38,6 +38,7 @@ app.config.update({
|
|
|
'SWAGGER_JS_URL': os.getenv('APP_SWAGGER_JS_URL', SWAGGER_JS_URL),
|
|
'SWAGGER_JS_URL': os.getenv('APP_SWAGGER_JS_URL', SWAGGER_JS_URL),
|
|
|
'SWAGGER_CSS_URL': os.getenv('APP_SWAGGER_CSS_URL', SWAGGER_CSS_URL),
|
|
'SWAGGER_CSS_URL': os.getenv('APP_SWAGGER_CSS_URL', SWAGGER_CSS_URL),
|
|
|
'STATE_CALLBACK_URL': os.getenv('APP_STATE_CALLBACK_URL', None),
|
|
'STATE_CALLBACK_URL': os.getenv('APP_STATE_CALLBACK_URL', None),
|
|
|
|
|
+ 'EXTRA_API_URL': os.getenv('APP_EXTRA_API_URL', None),
|
|
|
'STATE_CACHE': {'user':{},
|
|
'STATE_CACHE': {'user':{},
|
|
|
'presence':{}}})
|
|
'presence':{}}})
|
|
|
|
|
|
|
@@ -118,6 +119,8 @@ async def openapi():
|
|
|
schema['servers'] = [{'url':'{}://{}:{}'.format(app.config['SCHEME'],
|
|
schema['servers'] = [{'url':'{}://{}:{}'.format(app.config['SCHEME'],
|
|
|
app.config['FQDN'],
|
|
app.config['FQDN'],
|
|
|
app.config['PORT'])}]
|
|
app.config['PORT'])}]
|
|
|
|
|
+ if app.config['EXTRA_API_URL'] is not None:
|
|
|
|
|
+ schema['servers'].append({'url':app.config['EXTRA_API_URL']})
|
|
|
schema['components'] = {'securitySchemes':{'ApiKey':{'type': 'apiKey',
|
|
schema['components'] = {'securitySchemes':{'ApiKey':{'type': 'apiKey',
|
|
|
'name': app.config['AUTH_HEADER'],
|
|
'name': app.config['AUTH_HEADER'],
|
|
|
'in': 'header'}}}
|
|
'in': 'header'}}}
|
|
@@ -450,11 +453,14 @@ def getUserStateCombined(user):
|
|
|
if user not in app.config['STATE_CACHE']['user']:
|
|
if user not in app.config['STATE_CACHE']['user']:
|
|
|
return None
|
|
return None
|
|
|
_state = app.config['STATE_CACHE']['user'][user]
|
|
_state = app.config['STATE_CACHE']['user'][user]
|
|
|
- if (_state == 'idle') and (user in app.config['STATE_CACHE']['presence']):
|
|
|
|
|
- if app.config['STATE_CACHE']['presence'][user] in ('not_set','available', 'xa', 'chat'):
|
|
|
|
|
- return 'available'
|
|
|
|
|
|
|
+ if (_state == 'idle'):
|
|
|
|
|
+ if (user in app.config['STATE_CACHE']['presence']):
|
|
|
|
|
+ if app.config['STATE_CACHE']['presence'][user] in ('not_set','available', 'xa', 'chat'):
|
|
|
|
|
+ return 'available'
|
|
|
|
|
+ else:
|
|
|
|
|
+ return app.config['STATE_CACHE']['presence'][user]
|
|
|
else:
|
|
else:
|
|
|
- return app.config['STATE_CACHE']['presence'][user]
|
|
|
|
|
|
|
+ return 'available'
|
|
|
else:
|
|
else:
|
|
|
if _state in ('unavailable', 'ringing'):
|
|
if _state in ('unavailable', 'ringing'):
|
|
|
return _state
|
|
return _state
|