Polish customer update flow and prepare ZIP installation

This commit is contained in:
Jony
2026-09-24 21:52:01 +08:00
parent ba920f2b66
commit 0cf99740c0
8 changed files with 740 additions and 165 deletions
+20 -1
View File
@@ -240,7 +240,7 @@ try:
from .utils.o1key_image_jobs import register_o1key_image_job_routes
from .utils.o1key_image_thumbnail import register_o1key_image_thumbnail_route
from .utils.o1key_video_jobs import register_o1key_video_job_routes
from .utils.updater import UpdateError, update_package
from .utils.updater import UpdateError, check_for_update, update_package
_O1KEY_IMAGE_JOB_MANAGER = register_o1key_image_job_routes(
PromptServer,
@@ -266,6 +266,25 @@ try:
_o1key_restart_pending = _restart_threading.Event()
_o1key_update_lock = _restart_threading.Lock()
@PromptServer.instance.routes.get("/o1key/update/check")
async def check_o1key_update(request):
if not _o1key_update_lock.acquire(blocking=False):
return web.json_response(
{"code": "update_in_progress", "error": "更新正在进行。"}, status=409,
)
try:
result = await asyncio.to_thread(check_for_update)
return web.json_response(result)
except UpdateError as exc:
return web.json_response(exc.as_dict(), status=exc.status)
except Exception:
logging.exception("O1Key 检查更新失败")
return web.json_response(
{"code": "internal_error", "error": "检查更新失败。"}, status=500,
)
finally:
_o1key_update_lock.release()
@PromptServer.instance.routes.post("/o1key/update")
async def update_o1key_package(request):
if request.headers.get("X-O1Key-Update") != "1":