refactor(webui): replace real-time polling with click-to-check version updates
- Remove background PyPI polling loop and WebSocket broadcast - Remove UpdateBanner from ThreadHeader (keep main page clean) - Add on-demand version check endpoint (GET /api/settings/version-check) - Add 'About' section in Settings > Overview with check-for-updates button - Design: no auto-fetch, user initiates check explicitly via button click
This commit is contained in:
@@ -36,6 +36,7 @@ from nanobot.webui.settings_api import (
|
||||
update_transcription_settings,
|
||||
update_web_search_settings,
|
||||
)
|
||||
from nanobot.webui.version_check import check_for_update
|
||||
|
||||
QueryParams = dict[str, list[str]]
|
||||
|
||||
@@ -117,6 +118,8 @@ class WebUISettingsRouter:
|
||||
return await self._handle_settings_cli_apps_action(request, "test")
|
||||
if path == "/api/settings/mcp-presets":
|
||||
return await self._handle_settings_mcp_presets(request)
|
||||
if path == "/api/settings/version-check":
|
||||
return await self._handle_settings_version_check(request)
|
||||
mcp_action = _MCP_PRESET_ACTIONS_BY_PATH.get(path)
|
||||
if mcp_action is not None:
|
||||
return await self._handle_settings_mcp_presets(request, mcp_action)
|
||||
@@ -347,3 +350,15 @@ class WebUISettingsRouter:
|
||||
if action is None:
|
||||
return self._json_response(payload)
|
||||
return self._json_response(self._with_restart_state(payload, section="runtime"))
|
||||
|
||||
async def _handle_settings_version_check(self, request: WsRequest) -> Response:
|
||||
if not self._authorized(request):
|
||||
return self._unauthorized()
|
||||
try:
|
||||
update_info = await asyncio.to_thread(check_for_update)
|
||||
except Exception:
|
||||
self.logger.exception("version check failed")
|
||||
return self._error_response(500, "version check failed")
|
||||
return self._json_response({
|
||||
"updateAvailable": update_info,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user