Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
6bfe2a63
Commit
6bfe2a63
authored
Feb 25, 2024
by
Timothy J. Baek
Browse files
feat: latest release check api
parent
b82ac66c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
backend/main.py
backend/main.py
+25
-1
No files found.
backend/main.py
View file @
6bfe2a63
...
...
@@ -4,8 +4,9 @@ import markdown
import
time
import
os
import
sys
import
requests
from
fastapi
import
FastAPI
,
Request
,
Depends
from
fastapi
import
FastAPI
,
Request
,
Depends
,
status
from
fastapi.staticfiles
import
StaticFiles
from
fastapi
import
HTTPException
from
fastapi.responses
import
JSONResponse
...
...
@@ -26,6 +27,8 @@ from apps.web.main import app as webui_app
from
config
import
WEBUI_NAME
,
ENV
,
VERSION
,
CHANGELOG
,
FRONTEND_BUILD_DIR
from
constants
import
ERROR_MESSAGES
from
utils.utils
import
get_http_authorization_cred
,
get_current_user
...
...
@@ -127,6 +130,27 @@ async def get_app_changelog():
return
CHANGELOG
@
app
.
get
(
"/api/version/updates"
)
async
def
get_app_latest_release_version
():
try
:
response
=
requests
.
get
(
f
"https://api.github.com/repos/open-webui/open-webui/releases/latest"
)
response
.
raise_for_status
()
latest_version
=
response
.
json
()[
"tag_name"
]
# Compare versions
return
{
"current"
:
VERSION
,
"latest"
:
latest_version
[
1
:],
}
except
Exception
as
e
:
raise
HTTPException
(
status_code
=
status
.
HTTP_503_SERVICE_UNAVAILABLE
,
detail
=
ERROR_MESSAGES
.
NOT_FOUND
,
)
app
.
mount
(
"/static"
,
StaticFiles
(
directory
=
"static"
),
name
=
"static"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment