Display verison of installed FreqUI
This commit is contained in:
parent
baf6bca34e
commit
dec523eef0
@ -18,6 +18,17 @@ async def fallback():
|
|||||||
return FileResponse(str(Path(__file__).parent / 'ui/fallback_file.html'))
|
return FileResponse(str(Path(__file__).parent / 'ui/fallback_file.html'))
|
||||||
|
|
||||||
|
|
||||||
|
@router_ui.get('/ui_version', include_in_schema=False)
|
||||||
|
async def ui_version():
|
||||||
|
from freqtrade.commands.deploy_commands import read_ui_version
|
||||||
|
uibase = Path(__file__).parent / 'ui/installed/'
|
||||||
|
version = read_ui_version(uibase)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"version": version if version else "not_installed",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@router_ui.get('/{rest_of_path:path}', include_in_schema=False)
|
@router_ui.get('/{rest_of_path:path}', include_in_schema=False)
|
||||||
async def index_html(rest_of_path: str):
|
async def index_html(rest_of_path: str):
|
||||||
"""
|
"""
|
||||||
|
@ -105,6 +105,15 @@ def test_api_ui_fallback(botclient):
|
|||||||
assert rc.status_code == 200
|
assert rc.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
|
def test_api_ui_version(botclient, mocker):
|
||||||
|
ftbot, client = botclient
|
||||||
|
|
||||||
|
mocker.patch('freqtrade.commands.deploy_commands.read_ui_version', return_value='0.1.2')
|
||||||
|
rc = client_get(client, "/ui_version")
|
||||||
|
assert rc.status_code == 200
|
||||||
|
assert rc.json()['version'] == '0.1.2'
|
||||||
|
|
||||||
|
|
||||||
def test_api_auth():
|
def test_api_auth():
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType")
|
create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType")
|
||||||
|
Loading…
Reference in New Issue
Block a user