Add fallback file
This commit is contained in:
parent
f05f2c45e8
commit
e928d2991d
@ -146,7 +146,7 @@ def clean_ui_subdir(directory: Path):
|
|||||||
logger.info("Removing UI directory content.")
|
logger.info("Removing UI directory content.")
|
||||||
|
|
||||||
for p in reversed(list(directory.glob('**/*'))): # iterate contents from leaves to root
|
for p in reversed(list(directory.glob('**/*'))): # iterate contents from leaves to root
|
||||||
if p.name == '.gitkeep':
|
if p.name in ('.gitkeep', 'fallback_file.html'):
|
||||||
continue
|
continue
|
||||||
if p.is_file():
|
if p.is_file():
|
||||||
p.unlink()
|
p.unlink()
|
||||||
|
31
freqtrade/rpc/api_server/ui/fallback_file.html
Normal file
31
freqtrade/rpc/api_server/ui/fallback_file.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Freqtrade UI</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #3c3c3c;
|
||||||
|
color: #dedede;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.main-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
margin-top: 10rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="main-container">
|
||||||
|
<h1>Freqtrade UI not installed.</h1>
|
||||||
|
<p>Please run `freqtrade install-ui` in your terminal to install the UI files and restart your bot.</p>
|
||||||
|
<p>You can then refresh this page and you should see the UI.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -24,5 +24,8 @@ async def index_html(rest_of_path: str):
|
|||||||
if (uibase / rest_of_path).is_file():
|
if (uibase / rest_of_path).is_file():
|
||||||
return FileResponse(uibase / rest_of_path)
|
return FileResponse(uibase / rest_of_path)
|
||||||
|
|
||||||
|
index_file = uibase / 'index.html'
|
||||||
|
if not index_file.is_file():
|
||||||
|
return FileResponse(uibase / 'fallback_file.html')
|
||||||
# Fall back to index.html, as indicated by vue router docs
|
# Fall back to index.html, as indicated by vue router docs
|
||||||
return FileResponse(uibase / 'index.html')
|
return FileResponse(index_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user