Skip to content

Your lightweight open-source personal agent.

fix: handler token issue also checks static token as fallback

chengyongru2420826e058c
diff --git a/nanobot/channels/websocket.py b/nanobot/channels/websocket.py
index 6b1308c11..231f763ca 100644
--- a/nanobot/channels/websocket.py
+++ b/nanobot/channels/websocket.py
@@ -14,7 +14,7 @@ from collections.abc import Callable
from contextlib import suppress
from functools import partial
from pathlib import Path
-from typing import TYPE_CHECKING, Any, Self
+from typing import Any, Self
from urllib.parse import parse_qs, unquote, urlparse
from loguru import logger
@@ -28,7 +28,7 @@ from websockets.http11 import Response
from nanobot.bus.events import OUTBOUND_META_AGENT_UI, OutboundMessage
from nanobot.bus.queue import MessageBus
from nanobot.channels.base import BaseChannel
-from nanobot.config.paths import get_media_dir, get_workspace_path
+from nanobot.config.paths import get_media_dir
from nanobot.config.schema import Base
from nanobot.security.workspace_access import (
WORKSPACE_SCOPE_METADATA_KEY,
@@ -44,9 +44,6 @@ from nanobot.webui.cli_apps_api import normalize_cli_app_mentions
from nanobot.webui.mcp_presets_api import normalize_mcp_preset_mentions
from nanobot.webui.transcript import append_transcript_object
-if TYPE_CHECKING:
- from nanobot.session.manager import SessionManager
-
def _strip_trailing_slash(path: str) -> str:
if len(path) > 1 and path.endswith("/"):
diff --git a/nanobot/webui/ws_http.py b/nanobot/webui/ws_http.py
index 572ad4c6a..1d6f35b5e 100644
--- a/nanobot/webui/ws_http.py
+++ b/nanobot/webui/ws_http.py
@@ -380,7 +380,7 @@ class GatewayHTTPHandler:
# -- Token issue --------------------------------------------------------
def _handle_token_issue(self, connection: Any, request: Any) -> Any:
- secret = self.config.token_issue_secret.strip()
+ secret = self.config.token_issue_secret.strip() or self.config.token.strip()
if secret:
if not _issue_route_secret_matches(request.headers, secret):
return connection.respond(401, "Unauthorized")