feat: 浏览器端报错翻译与提示改造

- errors: 新增 TeamSpeak 服务器错误 ID 映射表与不可重连错误码集合,归一化
  normalizeTeamSpeakError 按 错误ID/关键词/异常类/传输层特征 分级收敛错误
- voice-bridge: 身份无效/客户端不可用时先发结构化 connectionFailed 帧再关闭,
  新增 pendingKickReason 机制在 kicked 事件后优先回放踢出原因;Opus 编码器
  不可用时限流上报 AUDIO_ENCODER_UNAVAILABLE
- ts-client: 记录本端退出 reasonID,转发 kicked 事件并归一化踢出/封禁原因
- network-probe/teamspeak-probe: 收窄关键字匹配、拒绝原因收敛到既有探测码
- session-manager: 新增 teamSpeak-kicked 拆除原因
- WebClient: 麦克风失败不再假成功,音频状态避免自相矛盾,新增降级横幅与
  中/英/德三语提示词表
- useVoiceWebSocket: 导出 ensureMicrophone 供开麦前预检,新增音频诊断状态、
  CONNECTION_FAILURE_MESSAGES 总表与网关关闭码映射
- 关键新增逻辑补充中文注释说明改动意图
This commit is contained in:
LainHE committed 2026-09-16 22:24:25 +08:00
1 parent 1ba8cd5ee1
commit 4ead174c04
8 files changed
+677 -74

No files matched your search

+8 -3
View File
@@ -114,9 +114,14 @@ function classifyProbeError(error: unknown): TeamSpeakPingErrorCode {
if (/enoent|spawn\s+(?:ping(?:\.exe)?|ping)\s+.*not found|command not found/.test(lower)) return "PING_UNAVAILABLE";
if (/enotfound|eai_again|getaddrinfo|host not found|unknown host|could not find host|name or service not known/.test(lower)) return "HOST_NOT_FOUND";
if (/timeout|timed out|packet ack timeout|idle timeout/.test(lower)) return "TIMEOUT";
if (/password|authentication|invalid.*credential/.test(lower)) return "INVALID_PASSWORD";
if (/protocol|version|handshake|negotiat/.test(lower)) return "PROTOCOL_NEGOTIATION_FAILED";
if (/reject|full|denied/.test(lower)) return "SERVER_REJECTED";
// 关键词刻意收窄:裸的 password/version/denied 会出现在大量无关的 ping/传输
// 输出中,误判会把用户引向错误的排查方向,只把明确的短语视为证据。
// Keep the keywords narrow: a bare "password", "version" or "denied" appears in
// plenty of unrelated ping/transport output, and guessing here used to send the
// user to the wrong remedy. Only explicit phrases are treated as evidence.
if (/invalid password|password (?:required|incorrect|wrong|rejected)|authentication failed|invalid credential/.test(lower)) return "INVALID_PASSWORD";
if (/protocol (?:version )?(?:mismatch|not supported|error)|version (?:is )?(?:outdated|too old|not supported)|handshake (?:failed|error|timeout)|negotiation failed/.test(lower)) return "PROTOCOL_NEGOTIATION_FAILED";
if (/server (?:is )?full|slot limit|client protocol limit|banned?|flooding|server rejected|connection (?:denied|refused) by (?:the )?server/.test(lower)) return "SERVER_REJECTED";
return "UNREACHABLE";
}