Merge pull request #1401 from theasp/add-dynamic-manifest

feat: Allow overriding application name in manifest.json
This commit is contained in:
Timothy Jaeryang Baek 2024-04-03 20:45:51 -07:00 committed by GitHub
commit 9404b6135a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 18 deletions

View File

@ -25,7 +25,7 @@ try:
except ImportError: except ImportError:
log.warning("dotenv not installed, skipping...") log.warning("dotenv not installed, skipping...")
WEBUI_NAME = "Open WebUI" WEBUI_NAME = os.environ.get("WEBUI_NAME", "Open WebUI")
WEBUI_FAVICON_URL = "https://openwebui.com/favicon.png" WEBUI_FAVICON_URL = "https://openwebui.com/favicon.png"
shutil.copyfile("../build/favicon.png", "./static/favicon.png") shutil.copyfile("../build/favicon.png", "./static/favicon.png")

View File

@ -84,7 +84,6 @@ app.state.MODEL_FILTER_LIST = MODEL_FILTER_LIST
app.state.WEBHOOK_URL = WEBHOOK_URL app.state.WEBHOOK_URL = WEBHOOK_URL
origins = ["*"] origins = ["*"]
@ -284,6 +283,20 @@ async def get_app_latest_release_version():
) )
@app.get("/manifest.json")
async def get_manifest_json():
return {
"name": WEBUI_NAME,
"short_name": WEBUI_NAME,
"start_url": "/",
"display": "standalone",
"background_color": "#343541",
"theme_color": "#343541",
"orientation": "portrait-primary",
"icons": [{"src": "/favicon.png", "type": "image/png", "sizes": "844x884"}],
}
app.mount("/static", StaticFiles(directory="static"), name="static") app.mount("/static", StaticFiles(directory="static"), name="static")
app.mount("/cache", StaticFiles(directory="data/cache"), name="cache") app.mount("/cache", StaticFiles(directory="data/cache"), name="cache")

View File

@ -1,16 +0,0 @@
{
"name": "Open WebUI",
"short_name": "Open WebUI",
"start_url": "/",
"display": "standalone",
"background_color": "#343541",
"theme_color": "#343541",
"orientation": "portrait-primary",
"icons": [
{
"src": "/favicon.png",
"type": "image/png",
"sizes": "844x884"
}
]
}