mirror of
https://github.com/hanxi/xiaomusic.git
synced 2026-03-26 09:59:45 +08:00
feat: 新增更新提醒
This commit is contained in:
@@ -25,6 +25,7 @@ from xiaomusic import __version__
|
||||
from xiaomusic.utils import (
|
||||
deepcopy_data_no_sensitive_info,
|
||||
downloadfile,
|
||||
get_latest_version,
|
||||
)
|
||||
|
||||
xiaomusic = None
|
||||
@@ -358,6 +359,15 @@ async def debug_play_by_music_url(request: Request, Verifcation=Depends(verifica
|
||||
raise HTTPException(status_code=400, detail="Invalid JSON") from err
|
||||
|
||||
|
||||
@app.get("/latestversion")
|
||||
async def latest_version(Verifcation=Depends(verification)):
|
||||
version = await get_latest_version("xiaomusic")
|
||||
if version:
|
||||
return {"ret": "OK", "version": version}
|
||||
else:
|
||||
return {"ret": "Fetch version failed"}
|
||||
|
||||
|
||||
async def file_iterator(file_path, start, end):
|
||||
async with aiofiles.open(file_path, mode="rb") as file:
|
||||
await file.seek(start)
|
||||
|
||||
Reference in New Issue
Block a user