forked from open-webui/open-webui
Do not use hardcoded manifest.json
Generate manifest.json dynamically, using MANIFEST_NAME and MANIFEST_SHORT_NAME from the environment.
This commit is contained in:
parent
5558514ff1
commit
83ad488e31
5 changed files with 39 additions and 17 deletions
|
@ -9,4 +9,7 @@ OPENAI_API_KEY=''
|
|||
|
||||
# DO NOT TRACK
|
||||
SCARF_NO_ANALYTICS=true
|
||||
DO_NOT_TRACK=true
|
||||
DO_NOT_TRACK=true
|
||||
|
||||
MANIFEST_NAME='Open WebUI'
|
||||
MANIFEST_SHORT_NAME='Open WebUI'
|
||||
|
|
|
@ -30,6 +30,9 @@ ENV WEBUI_SECRET_KEY ""
|
|||
ENV SCARF_NO_ANALYTICS true
|
||||
ENV DO_NOT_TRACK true
|
||||
|
||||
ENV MANIFEST_NAME "Open WebUI"
|
||||
ENV MANIFEST_SHORT_NAME "Open WebUI"
|
||||
|
||||
######## Preloaded models ########
|
||||
# whisper TTS Settings
|
||||
ENV WHISPER_MODEL="base"
|
||||
|
|
|
@ -424,3 +424,11 @@ WHISPER_MODEL_DIR = os.getenv("WHISPER_MODEL_DIR", f"{CACHE_DIR}/whisper/models"
|
|||
|
||||
AUTOMATIC1111_BASE_URL = os.getenv("AUTOMATIC1111_BASE_URL", "")
|
||||
COMFYUI_BASE_URL = os.getenv("COMFYUI_BASE_URL", "")
|
||||
|
||||
|
||||
####################################
|
||||
# Manifest
|
||||
####################################
|
||||
|
||||
MANIFEST_NAME = os.getenv("MANIFEST_NAME", "Open WebUI")
|
||||
MANIFEST_SHORT_NAME = os.getenv("MANIFEST_SHORT_NAME", "Open WebUI")
|
||||
|
|
|
@ -43,6 +43,8 @@ from config import (
|
|||
GLOBAL_LOG_LEVEL,
|
||||
SRC_LOG_LEVELS,
|
||||
WEBHOOK_URL,
|
||||
MANIFEST_NAME,
|
||||
MANIFEST_SHORT_NAME
|
||||
)
|
||||
from constants import ERROR_MESSAGES
|
||||
|
||||
|
@ -69,6 +71,8 @@ app.state.MODEL_FILTER_LIST = MODEL_FILTER_LIST
|
|||
|
||||
app.state.WEBHOOK_URL = WEBHOOK_URL
|
||||
|
||||
app.state.MANIFEST_NAME = MANIFEST_NAME
|
||||
app.state.MANIFEST_SHORT_NAME = MANIFEST_SHORT_NAME
|
||||
|
||||
origins = ["*"]
|
||||
|
||||
|
@ -268,6 +272,26 @@ async def get_app_latest_release_version():
|
|||
)
|
||||
|
||||
|
||||
@app.get("/manifest.json")
|
||||
async def get_manifest_json():
|
||||
return {
|
||||
"name": app.state.MANIFEST_NAME,
|
||||
"short_name": app.state.MANIFEST_SHORT_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("/cache", StaticFiles(directory="data/cache"), name="cache")
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue