From 15e22d30998586b4d4741873016bd83220ff9b1c Mon Sep 17 00:00:00 2001 From: illusia <64828020+EchoSixHIYA@users.noreply.github.com> Date: Thu, 1 Oct 2026 16:18:20 +0800 Subject: [PATCH] fix: scope identity operations to the active dialog --- CLAUDE.md | 7 + docs/CODE_REFACTOR_PLAN.zh-CN.md | 85 ++++-- package.json | 2 +- .../web-client/IdentityImportDialog.vue | 53 ++++ web/src/composables/useWebClientIdentity.ts | 159 +++++++++++ web/src/services/skin-pack.test.ts | 10 +- web/src/styles/web-client.css | 68 ++--- web/src/views/WebClient.vue | 141 ++-------- web/test/identity-dialog.test.mjs | 262 ++++++++++++++++++ 9 files changed, 605 insertions(+), 182 deletions(-) create mode 100644 web/src/components/web-client/IdentityImportDialog.vue create mode 100644 web/src/composables/useWebClientIdentity.ts create mode 100644 web/test/identity-dialog.test.mjs diff --git a/CLAUDE.md b/CLAUDE.md index 15edc06..36c50ab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,6 +34,7 @@ WebSpeak connects browser users to TeamSpeak 3 and TeamSpeak 6 through a self-ho | `web/src/voice/connection.ts`, `commands.ts` | Cancellable ticket acquisition, socket and connection generations, plus per-command acknowledgement deadlines and cleanup | | `web/src/voice/session-state.ts` | Reactive directory, chat history, events and notifications; complete versus omitted directory data, session resets and private-conversation identity scopes | | `web/src/composables/useWebClientChat.ts`, `useWebClientChannels.ts` | Destination-owned drafts and pending sends, identity-bound private history, and iterative channel-tree projection | +| `web/src/composables/useWebClientIdentity.ts`, `web/src/components/web-client/IdentityImportDialog.vue` | Page-owned identity reads, parsing, restoration and exports; a presentation dialog with explicit input and action events | | `web/src/voice/audio-diagnostics.ts`, `web/src/composables/useWebClientPerformance.ts` | Session-owned diagnostic probes and compatibility counters, browser statistics, comparable sample scopes and cancellable UI polling | | `web/src/platform/` | Browser mounting and cancellable Android gateway readiness handshake | | `web/src/services/`, `web/src/i18n/`, `web/src/skins/` | Browser persistence, identity import, skin packages and translations | @@ -119,6 +120,10 @@ Serialize `setSinkId` on each audio context or media element, since an in-flight ## Configuration and persistence +Identity file reads belong to the current selection, text revision and dialog lifetime. New files (including invalid selections), manual edits, closing, entering the room, clearing local data and page disposal retire old results. Parsing owns its submitted draft; only a current result may replace the identity or notify. Preserve the 128 KiB limit, UTF-8/UTF-16 BOM decoding and existing busy-close behavior. The dialog disables submission while a selected file is being read and disables edits while parsing. + +Startup identity restoration must not overwrite a newer import or remember preference. Exports belong to the identity and page that started them; coalesce pending clicks, discard late serialization and release download anchors, URLs and timers independently. Keep codec parsing in the existing identity service and persistence in the page/storage layer. + Admin requests belong to the login session and feature that started them. Invalidate pending work on authentication changes and page disposal; cancel feature work on management subroute exit. A late 401 must not expire a newer session, and late login or backup results must not navigate or download after disposal. Aborted work is not a user-facing failure. Failed logout preserves the authenticated draft; successful logout or session expiry resets private page state. Settings responses merge against the submitted snapshot instead of replacing newer edits. Password and action, and relay token and action, are atomic draft groups. Clear acknowledged secret inputs, retain edits made during the request, merge relay nodes by ID, and do not restore obsolete probe metadata. Serialize skin mutations and prevent duplicate invite actions; cancelling browser work does not undo a server mutation already executed. @@ -172,6 +177,8 @@ Platform startup owns its message listener, polling interval and deadline, inclu Routes load their page modules on demand. Document-level page styles must be gated by `html[data-ws-route]` because loaded CSS remains after navigation. The admin stylesheet is independent of public skins. Component extraction must retain `data-ws-part` hooks and account for Vue scoped styles across component boundaries. +The identity dialog retains page-owned CSS with narrowly targeted `:deep` selectors so the existing declaration order and specificity remain intact. Shared button rules target its dedicated classes across the component boundary. Its close button is positioned within the modal. Public skin-contract tests include Vue files recursively under `components/web-client`; keep new public parts documented. + Validate admin responses before applying them to page state. Network and protocol failures must preserve unsaved input; a failed logout must not be presented as a successful logout. Keep secret keep/replace/remove actions intact and do not persist credentials in UI error messages or diagnostic logs. The repository remote is `https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak`. Preserve existing local work when implementing the plan in `docs/CODE_REFACTOR_PLAN.zh-CN.md`. Keep private configuration, runtime data and local deployment archives out of source commits. Preserve documented skin hooks and browser persistence formats during component refactors. diff --git a/docs/CODE_REFACTOR_PLAN.zh-CN.md b/docs/CODE_REFACTOR_PLAN.zh-CN.md index 1a4c93b..41a3c4b 100644 --- a/docs/CODE_REFACTOR_PLAN.zh-CN.md +++ b/docs/CODE_REFACTOR_PLAN.zh-CN.md @@ -1,16 +1,16 @@ # WebSpeak 代码待修改清单与修改方向 -本文聚焦 `webspeak-webclient`,记录当前待修改问题、实施结果和验收条件。本批已处理成员目录、通知生命周期、聊天确认与私聊归属,并提取消息状态模块;338 项测试及前后端构建通过。 +本文聚焦 `webspeak-webclient`,整理当前代码结构、待修改项、大致修改方向与验收条件。本批已修复身份文件异步覆盖、迟到解析及启动恢复覆盖问题,提取身份状态模块与导入弹窗;362 项测试及前后端构建通过。 -接下来拆分页面组件,继续核对真实消息兼容、TeamSpeak 媒体、Android 真机与发布包。媒体、连接、命令、诊断和消息状态已有独立模块,后续保留其生命周期约束。模拟 SDK 的本机浏览器验证不能替代真实媒体验收。 +后续继续按功能区域拆分客户端与管理页,并同步核对样式和交互。真实消息兼容、TeamSpeak 媒体、Android 真机及发布包单独安排验收。媒体、连接、命令、诊断、消息及身份状态已有独立模块,继续复用;历史修复及验证结果保留在后文。 ## 范围与依据 - 记录日期:2026 年 10 月 1 日。 -- 施工基线:`dev` 分支,`a97fa5439202149d3b8fa8bf9b57db252c8dae9c`;应用版本 `0.2.5-preview`。开始时只有前轮整理文档未提交,源码干净。 -- 本批新增 25 项用例,其中 20 项先失败后通过;`npm run verify` 通过 338 项测试、后端编译、前端类型检查及生产构建。35 个显式测试文件均存在。 -- 本机真实 HTTP/WebSocket 网关配合模拟 TeamSpeak SDK,浏览器验证等待确认、失败保留草稿、成功消息和私聊标签;桌面及 390 × 844 窄屏截图检查通过,浏览器无错误日志。没有验收真实 TeamSpeak 音质或 Android。 -- 基线 `a97fa54` 的 [CI 与 Docker 检查](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/actions/runs/36828220842) 已查询确认成功;本批新增代码的远端验证按对应提交另行记录。 +- 施工基线:`dev` 分支,`28eda60d9bf84c722093ca96e1e04a161a8f8481`;应用版本 `0.2.5-preview`。开始时仅有前轮整理文档未提交,源码干净。 +- 本批新增 24 项身份流程测试,其中 10 项先在提取后保持原行为的代码中失败,再修复通过。统一入口现有 36 个测试文件,`npm run verify` 通过 362 项测试、后端编译、前端类型检查及生产构建。 +- 浏览器检查实际文件选择、UTF-16 解码、解析失败保留输入、关闭重开、Esc 与焦点恢复。1280 × 720 和 390 × 844 的弹窗内容尺寸及主要计算样式与基线一致,仅将关闭按钮从屏幕角落定位回弹窗;另检查德语、暗色与窄屏布局,无浏览器错误日志。 +- 基线 `28eda60` 的 [CI 与 Docker 检查](https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak/actions/runs/36832374172) 已查询确认成功。本批未验收真实 TeamSpeak 音质或 Android 真机,浏览器测试使用本机预览。 - 下文“代码可确认”指控制流或配置可直接支持的判断;具体故障发生条件仍需回归用例验证。“待验收”表示证据尚缺,不等于已发生故障。P1/P2/P3 表示建议实施顺序,不代表安全漏洞等级。 ## 当前代码结构 @@ -28,7 +28,8 @@ | 浏览器连接与命令 | `web/src/voice/connection.ts`、`commands.ts` | 连接模块 132 行,拥有请求取消、期限、socket 与代次;命令模块 59 行,拥有确认等待及统一收尾 | | 浏览器诊断 | `web/src/voice/audio-diagnostics.ts`、`web/src/composables/useWebClientPerformance.ts` | 采样模块 168 行,拥有等待、来源范围与兼容计数;面板 composable 管理轮询和可比样本的展示 | | 会话消息状态 | `web/src/voice/session-state.ts` | 172 行;拥有成员与频道、聊天历史、事件、通知、会话范围和私聊身份映射 | -| 页面与业务状态 | `web/src/views/`、`web/src/composables/` | 主页面 1,220 行,管理页 400 行;聊天 composable 管理按会话和对象隔离的草稿、发送等待及反馈 | +| 页面与业务状态 | `web/src/views/`、`web/src/composables/` | 主页面 1,119 行,管理页 400 行;聊天 composable 管理按会话和对象隔离的草稿、发送等待及反馈 | +| 身份导入与导出 | `useWebClientIdentity.ts`、`components/web-client/IdentityImportDialog.vue` | 159 行状态模块与 53 行展示组件;异步操作、启动恢复与导出资源独立归属 | | 前端基础服务 | `web/src/services/`、`web/src/i18n/`、`web/src/skins/` | 请求、浏览器存储、身份导入、主题、皮肤及多语言 | | Android | `web/src/platform/`、`src/mobile/`、`mobile/`、`web/android/` | 本机网关就绪握手、移动打包和原生容器;运行时与设备验收独立 | | 独立中继 | `src/relay.ts`、`src/server/acceleration-relay.ts` | 中继进程及网关接入,本轮不扩展其功能 | @@ -39,25 +40,37 @@ ## 事项状态与剩余待办 -沿用原清单编号。04-K、04-L、06-E 至 06-G 本批已实施,04-D 的消息投影已提取;06-C 及真实环境事项继续待办。06-D 为此前的管理页窄屏整理,不复用编号。 +沿用原清单编号,06-H 本批已实施;06-C 的身份导入弹窗已提取,其他界面区域继续待办。下表只列当前待办;已完成事项与历史验证另列。06-D 为此前的管理页窄屏整理,不复用编号。 | 编号 | 优先级 | 待办及依据 | 大致修改方向 | 完成条件 | | --- | --- | --- | --- | --- | -| 04-K | 已修复,本地通过 | 成员快照、增量和头像集中更新 | 共享成员投影,完整快照替换;省略字段保留未知数据 | 改名、状态、重复进入、离开、UID 复用及头像回归通过 | -| 06-E | 已修复,本地与浏览器通过 | 聊天等待网关确认后进入成功历史 | 按对象持有等待,失败保留草稿,核对实际频道 | 重连、拒绝、迟到确认、新输入、切换标签后重复发送均有回归 | -| 06-F | 已修复,本地与浏览器通过 | 私聊选择及历史按身份区分 | 浏览器成员范围与网关 UID 双重核对,退出重置 | ID 复用、缺少 UID、未知发送者、目标离线和切服用例通过 | -| 04-L | 已修复,本地通过 | 退出和替换清除事件、聊天和通知 | 区分显式退出与同 socket 恢复,保持数组引用 | 新会话不继承旧通知;恢复目录即使省略成员也不会复用旧目录 | -| 06-G | 已修复,本地通过 | 父子环、重复 ID 和孤儿目录受控展示 | 父子与兄弟顺序均迭代遍历,每个 ID 至多输出一次 | 自环及双节点环不再栈溢出;正常顺序和 5,000 层目录用例通过 | -| 04-D | 已提取,本地通过 | 消息状态由 `session-state.ts` 管理 | 入口保留连接和媒体编排,消息模块只回调所属成员的资源清理 | 响应式数组引用、旧 socket 隔离、本人回显和媒体清理回归通过 | | 06-C | P2 | 主页面和管理页已有业务模块,模板仍集中 | 先拆稳定界面区域,页面保留连接或认证编排 | 表单、路由、五语、主题、皮肤接口、键盘与窄屏布局保持一致 | | 03 | P2 | 共享契约已落地,真实收发与旧客户端兼容仍缺验收证据 | 用脱敏的实际消息样本核对字段、默认值、非法输入及兼容范围 | 两端解析一致;非法消息受控处理,不误丢有效事件 | | 02-C | P2 | 本机与边界替身测试不能证明真实媒体链路 | 建立真实 TeamSpeak 双向语音、WebRTC 回退、伴奏和多用户验收步骤 | 记录版本、浏览器、网络、设备、步骤及实际结果 | | 07-A | P2 | 移动文档记录内嵌 Node.js 18.20.4,SDK 声明至少 20.19;真机连接尚未验收 | 先验证 SDK 实际连接,再决定运行时升级或适配;补真机音频和更新后布局检查 | 真机连接、双向语音、设备切换、重连与资源释放有明确结果 | | 09-A | P3 | 忽略规则和打包工作流已有实现,当前版本的干净输入发布仍需核实 | 分平台从声明的源码与依赖构建,核对启动和打包输入 | Windows、Linux、Docker、Android 分别形成可复现结果,不依赖历史包或实验替身 | -## 本轮状态与聊天修复 +## 身份导入与组件拆分实施 -以下问题描述与带行号的原入口引用对应施工前基线 `a97fa54`。成员与消息的当前实现见 [session-state.ts](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/voice/session-state.ts),聊天交互见 [useWebClientChat.ts](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/composables/useWebClientChat.ts)。 +### 06-H 身份文件读取的异步归属 + +原入口为 `28eda60` 中的 `WebClient.vue` 文件读取、弹窗开关与卸载函数。当前实现见 [useWebClientIdentity.ts](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/composables/useWebClientIdentity.ts) 与 [IdentityImportDialog.vue](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/components/web-client/IdentityImportDialog.vue)。 + +修改前,`readIdentityFile` 等待 `file.arrayBuffer()` 后直接写入导入文本或错误,没有读取序号、弹窗代次或页面失效检查。文件读取也不设置 `identityImportBusy`;该标志用于点击导入后的解析阶段,不能阻止读取中的关闭操作。以下时序已通过可控制返回顺序的用例复现: + +- 先选文件 A,再选文件 B;若 A 最后返回,会覆盖 B 的文本,A 的迟到失败也可能覆盖当前错误状态。 +- 读取期间关闭并重新打开弹窗;旧读取可能把上一次的内容写进新弹窗。 +- 读取期间手动编辑文本;旧读取完成后可能覆盖刚输入的内容。 + +已实施:状态模块统一持有操作代次,新的选择、文本修改、关闭、进入房间、清除本地数据或页面卸载使旧结果失效。文件仍在读取时不能提交旧文本;解析只提交所属草稿,失败保留输入。展示组件只接收文本、状态与文案并发出操作事件,文件输入和焦点归组件管理。 + +保留 128 KiB 文件限制、UTF-8 与带 BOM 的 UTF-16 解码、身份格式校验和五语提示。解析期间维持不允许关闭的行为,同时禁用编辑与文件选择。导出等待绑定当前身份与页面,重复点击合并,迟到结果不下载;锚点、对象 URL 和计时器分别释放。启动身份读取同样检查修订,不能覆盖新导入、已取消的记忆偏好或清理后的状态。 + +验证:[identity-dialog.test.mjs](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/test/identity-dialog.test.mjs) 的 24 项测试覆盖上述时序、格式读取、正常提交、解析失败、导出与 URL 清理、启动恢复;其中 10 项先失败后通过。既有格式测试继续保留。浏览器实际选择 UTF-16 测试文件并验证错误反馈、保留文本、关闭和重开;桌面及窄屏对比发现原关闭按钮位于屏幕右上角,现定位于弹窗内。没有把该批验证扩展解释为真实 TeamSpeak 或 Android 验收。 + +## 上一批状态与聊天修复 + +以下问题描述与带行号的原入口引用对应上一批施工前基线 `a97fa54`;本节“本批”均指该历史批次。成员与消息的当前实现见 [session-state.ts](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/voice/session-state.ts),聊天交互见 [useWebClientChat.ts](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/composables/useWebClientChat.ts)。 ### 04-K 统一成员目录更新 @@ -218,11 +231,25 @@ ### 06-C 页面组件 -客户端建议依次拆加入表单、频道树、成员列表、聊天区、音频设置和弹窗;管理页拆服务器设置、运维与邀请、皮肤和诊断区。页面保留连接或认证编排,组件通过明确输入与事件复用现有业务状态,避免重复请求同一份数据。 +当前依据:[WebClient.vue](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/WebClient.vue:1) 有 1,119 行,身份导入已独立,其余模板仍同时承载加入页、语音活动、聊天、频道成员、音频控制和多个弹窗;[AdminView.vue](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/AdminView.vue:41) 有 400 行,服务器、运维与皮肤模板按路由集中在一个文件。业务 composable 已存在,主要待办是明确展示边界及其状态接口。这是维护性改进,不以文件长度推定运行故障。 -保留 `data-ws-part`、路由样式隔离、明暗主题和五语文案。[skin-pack.test.ts](../web/src/services/skin-pack.test.ts) 当前读取固定 Vue 文件检查公开节点;拆组件时同步调整读取范围或改用实际渲染结果。主页面还使用 scoped 样式,需核对组件边界变化后的选择器覆盖,不能仅以编译通过认定布局一致。 +以下名称为建议,实施时按实际接口确定。先迁移一个区域并验收,再迁移下一处,避免同时重写模板和业务状态。 -管理页已具备请求与登录会话绑定、过期结果丢弃、保存快照合并、秘密字段动作成组处理及皮肤写操作互斥。后续保留这些规则,重点回归草稿、保存失败、切换路由、键盘操作与窄屏长文案。 +| 区域 | 建议组件及职责 | 状态保留位置与接口 | 重点验收 | +| --- | --- | --- | --- | +| 加入页 | `JoinForm` 展示目标、昵称、频道、身份选项与连接状态 | 连接与历史仍由现有 composable 管理;表单用明确字段模型,提交、取消和导入用事件 | 固定与开放模式、收藏与历史、连接等待及取消、密码交互 | +| 频道与成员 | `ChannelMemberPanel` 展示层级、成员状态和操作入口 | 复用 `useWebClientChannels` 与 `useWebClientMembers`;移动、私语、私聊等动作交回已有控制层 | 搜索、展开、频道切换、桌面拖放与触屏操作、菜单定位 | +| 聊天 | `ChatPanel` 展示标签、历史、草稿和发送反馈 | 草稿与待确认状态继续由单一 `useWebClientChat` 实例管理;保留外部打开私聊的入口 | 切标签保留草稿、发送失败与重试、目标离线、滚动和移动端切页 | +| 音频与弹窗 | 身份导入已提取;继续拆音频工具栏、设置面板及密码弹窗 | 媒体仍由语音控制模块拥有;设置关闭触发现有清理;身份状态复用已完成的 06-H | 静音、音量、设备切换、试听、焦点、Esc 关闭及资源释放 | +| 管理功能页 | `AdminServerSettings`、`AdminOperations`、`AdminSkins`,再按需要拆邀请和诊断展示 | 复用三个现有管理 composable;登录、CSRF、路由与总览留在页面;组件不重复发请求 | 保存期间继续编辑、请求失败保留草稿、退出失败、路由切换及皮肤操作互斥 | + +接口只传该区域需要的状态和动作,避免把整页上下文塞进一个对象,也避免父子各自实例化同一个业务 composable。展示辅助函数如头像、时间格式可在确有多处复用时集中;不为减少行数额外引入全局状态层。 + +样式需要随组件边界一并核对。[客户端样式入口](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/WebClient.vue:1119)和[管理页样式入口](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/AdminView.vue:400)均使用 `scoped`,对应 CSS 分别为 1,299 与 449 行。模板移入子组件后,不能假定原父组件选择器仍覆盖内部节点。本批身份弹窗保留样式声明顺序,通过仅针对该组件的 `:deep` 选择器跨越边界;共享按钮样式使用专用类名衔接。后续区域按实际依赖选择组件自有样式或有范围限制的跨组件规则,保留明暗主题、`data-ws-part` 和路由隔离,管理页保持独立于公开皮肤。 + +测试也需跟随边界调整:[皮肤节点检查](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/services/skin-pack.test.ts:80)已递归读取 `components/web-client` 下的 Vue 文件,保留其他公开页面与基础选择器的检查。[管理页状态测试](/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/test/admin-view.test.mjs:79)覆盖 setup 行为,但用 `render: () => null` 替换模板,不能单独证明子组件的字段与事件接线正确。管理页后续拆分时同步扩大其皮肤隔离检查,并补有代表性的表单、按钮和路由交互验证。 + +每个区域验收包括桌面与窄屏、五语长文案、明暗主题和自定义皮肤;对比布局、滚动、弹层遮挡及键盘操作。编译通过和源码正则匹配不能替代实际渲染检查。 ### 03 与 02-C 契约和真实媒体 @@ -244,10 +271,14 @@ Android 记录具体设备和系统,验收连接、双向语音、输入输出 | 原事项或范围 | 当前状态 | | --- | --- | +| 06-H 身份异步操作及 06-C 身份弹窗 | 24 项时序与资源测试通过,状态与模板分离,关闭按钮定位修正;正常文件读取、错误反馈、焦点和响应式布局已有浏览器验证 | +| 04-K、04-L、04-D 消息状态 | 成员快照与增量统一投影,退出清理通知,恢复保留规则及会话范围已有实现;保留响应式数组引用 | +| 06-E、06-F 聊天与私聊 | 发送等待确认,失败保留草稿;私聊按身份归属,网关可核对频道与 UID;上一批有状态与浏览器验证记录 | +| 06-G 频道层级 | 迭代遍历处理环、重复 ID 和孤儿节点;正常顺序及深层目录已有回归记录 | | 04-E 至 04-J 浏览器媒体、连接与诊断 | 伴奏切换及取消、电平监测、命令等待、凭证取消和诊断来源隔离已有实现;此前验证结果保留于对应章节 | | 05-A 服务端会话音频 | `SessionAudioTransport` 已接入 PCM、WebRTC 和 TeamSpeak 下行,统一路由、背压与统计 | | 05-B、05-C WebRTC 关闭 | 已逐项容错释放资源,重复关闭共享完成 Promise,包括失败结果 | -| 02-B 测试入口遗漏 | WebRTC 关闭与诊断面板测试已进入统一命令;当前 35 个列出的测试文件均存在 | +| 02-B 测试入口遗漏 | WebRTC 关闭、诊断面板及身份流程测试均进入统一命令;当前 36 个列出的测试文件均存在 | | 05-D SDK 事件与目录 | `SessionEventCoordinator` 已提取;旧 SDK 来源、关闭等待、重连等待及踢出到达顺序已有实现和回归记录 | | 成员头像 | 下载控制器与 SDK 异步阶段均绑定连接代次;批次、缓存、监听及迟到结果有生命周期限制 | | 前端基础整理 | 共享消息契约、管理请求与三个状态模块、五语管理文案、头部组件及路由延迟加载已实现 | @@ -267,12 +298,20 @@ Android 记录具体设备和系统,验收连接、双向语音、输入输出 | 顺序 | 内容 | 验收方式 | | --- | --- | --- | -| 已实施,本地通过 | 04-K、04-L、06-E 至 06-G、04-D:目录、聊天、通知和消息状态 | 338 项测试及前后端构建通过;浏览器确认聊天成功、失败及窄屏展示 | -| 接下来 | 06-C、03:页面组件及契约兼容核对 | 一次拆一个稳定区域;检查草稿、路由、主题、皮肤、五语及真实消息样本 | +| 已完成本批 | 06-H 与 06-C 身份弹窗 | 362 项测试及前后端构建通过;浏览器检查文件读取、失败、关闭、焦点及布局 | +| 接下来 | 06-C:其余客户端组件及配套样式和交互检查 | 一次拆一个稳定区域;保留业务状态实例,检查主题、皮肤、五语、键盘与窄屏 | +| 后续批次 | 06-C:管理页功能组件 | 复用管理 composable;检查字段与事件接线、草稿、保存、路由和登录状态 | +| 联调阶段 | 03:契约兼容核对 | 收集脱敏真实消息;分别记录新旧客户端与网关组合的确认和目标校验行为 | | 独立安排 | 02-C、07-A:真实 TeamSpeak 与 Android | 环境、版本、设备、网络、操作步骤和实际结果逐项留档,可提前安排 | | 发布前 | 09-A:各平台干净构建与产物验收 | 从声明输入构建并实际启动;HTTP、真实媒体和平台能力分别记录 | -本批 `npm run verify` 完整通过。后续新增测试仍需进入显式命令;页面拆分补交互与布局检查,真实设备与发布包分别补验。不要把纯结构调整与依赖主版本升级、数据库迁移或音质参数调整合并实施。 +本批已通过 `npm run verify`,其余安排继续待办;新增测试需纳入统一入口的显式清单。真实环境记录至少包含提交、服务端与客户端版本、设备、传输方式、操作步骤、预期、实际结果及未通过原因。不要把纯结构调整与依赖主版本升级、数据库迁移或音质参数调整合并实施。 + +## 身份模块施工前的只读整理结果 + +- 以 `28eda60` 为基线更新当前结构与剩余待办,区分静态判断、待验收项目和历史验证结果。 +- 新增 06-H 身份文件异步覆盖问题,细化 06-C 的组件职责、状态归属、样式和交互验证方向。 +- 保留既有修复记录;只修改本文,未修改业务代码、测试、配置、依赖和本地产物,未运行测试或构建,未提交或推送。 ## 本批施工前的只读整理记录 diff --git a/package.json b/package.json index c9e56c7..ca90c05 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "scripts": { "dev": "tsx src/index.ts", "build": "tsc", - "test": "node --import tsx --test src/admin/skin-registry.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts src/server/visitor-count.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/audio-stats.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/server-messages.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/voice-performance.test.mjs web/test/screen-share.test.ts web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/skin-pack.test.ts web/src/services/identity-import.test.ts", + "test": "node --import tsx --test src/admin/skin-registry.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts src/server/visitor-count.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/audio-stats.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/server-messages.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/voice-performance.test.mjs web/test/screen-share.test.ts web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/skin-pack.test.ts web/src/services/identity-import.test.ts web/test/identity-dialog.test.mjs", "verify": "npm test && npm run build && npm run web:build", "start": "node dist/index.js", "web:dev": "cd web && npx vite --host", diff --git a/web/src/components/web-client/IdentityImportDialog.vue b/web/src/components/web-client/IdentityImportDialog.vue new file mode 100644 index 0000000..30e833d --- /dev/null +++ b/web/src/components/web-client/IdentityImportDialog.vue @@ -0,0 +1,53 @@ + + + diff --git a/web/src/composables/useWebClientIdentity.ts b/web/src/composables/useWebClientIdentity.ts new file mode 100644 index 0000000..a05131d --- /dev/null +++ b/web/src/composables/useWebClientIdentity.ts @@ -0,0 +1,159 @@ +import { onScopeDispose, ref, watch, type Ref } from "vue"; +import { exportTeamSpeakIdentity, IdentityImportError, importIdentityText } from "../services/identity-import.js"; + +interface IdentityOptions { + identityMaterial: Ref; + rememberIdentity: Ref; + t: (key: string) => string; + showToast: (message: string) => void; + parse?: (text: string) => Promise; + serialize?: (material: string) => Promise; +} + +/** Page-owned identity operations; the dialog only renders state and emits input. */ +export function useWebClientIdentity({ identityMaterial, rememberIdentity, t, showToast, + parse = importIdentityText, serialize = exportTeamSpeakIdentity }: IdentityOptions) { + const open = ref(false); + const text = ref(""); + const error = ref(""); + const busy = ref(false); + const reading = ref(false); + const exporting = ref(false); + let generation = 0; + let exportGeneration = 0; + let identityRevision = 0; + let disposed = false; + const downloads = new Map | undefined>(); + const isCurrent = (operation: number) => !disposed && open.value && operation === generation; + + function invalidate() { + generation++; + reading.value = false; + busy.value = false; + } + watch(text, () => { invalidate(); error.value = ""; }, { flush: "sync" }); + watch([identityMaterial, rememberIdentity], () => { + identityRevision++; + exportGeneration++; + exporting.value = false; + }, { flush: "sync" }); + + function show() { + if (disposed || busy.value) return; + invalidate(); + text.value = ""; + error.value = ""; + open.value = true; + } + function close() { + if (busy.value) return; + invalidate(); + open.value = false; + } + function reset() { + invalidate(); + identityRevision++; + exportGeneration++; + exporting.value = false; + open.value = false; + text.value = ""; + error.value = ""; + for (const url of downloads.keys()) releaseDownload(url); + } + async function readFile(file?: Pick) { + if (!file || disposed || !open.value || busy.value) return; + invalidate(); + const operation = generation; + error.value = ""; + if (file.size > 128 * 1024) { + error.value = t("identityImportErrorTooLarge"); + return; + } + reading.value = true; + try { + const bytes = new Uint8Array(await file.arrayBuffer()); + if (!isCurrent(operation)) return; + let encoding = "utf-8"; + if (bytes[0] === 0xff && bytes[1] === 0xfe) encoding = "utf-16le"; + else if (bytes[0] === 0xfe && bytes[1] === 0xff) encoding = "utf-16be"; + text.value = new TextDecoder(encoding, { fatal: true }).decode(bytes); + error.value = text.value.trim() ? "" : t("identityImportErrorEmpty"); + } catch { + if (isCurrent(operation)) error.value = t("identityImportErrorMalformed"); + } finally { + if (isCurrent(operation)) reading.value = false; + } + } + async function submit() { + if (disposed || !open.value || busy.value || reading.value) return; + invalidate(); + const operation = generation; + busy.value = true; + error.value = ""; + try { + const material = await parse(text.value); + if (!isCurrent(operation)) return; + invalidate(); + rememberIdentity.value = true; + identityMaterial.value = material; + open.value = false; + text.value = ""; + showToast(t("identityImportSuccess")); + } catch (failure) { + if (!isCurrent(operation)) return; + const code = failure instanceof IdentityImportError ? failure.code : "invalid-key"; + error.value = t(({ + empty: "identityImportErrorEmpty", "too-large": "identityImportErrorTooLarge", + multiple: "identityImportErrorMultiple", malformed: "identityImportErrorMalformed", + "invalid-key": "identityImportErrorInvalidKey", unsupported: "identityImportErrorUnsupported", + } as const)[code]); + } finally { if (isCurrent(operation)) busy.value = false; } + } + async function exportIdentity() { + if (disposed || exporting.value || !rememberIdentity.value || !identityMaterial.value) return; + const operation = ++exportGeneration; + const current = () => !disposed && operation === exportGeneration; + exporting.value = true; + let url: string | undefined; + let link: HTMLAnchorElement | undefined; + try { + const content = await serialize(identityMaterial.value); + if (!current()) return; + url = URL.createObjectURL(new Blob([content], { type: "text/plain;charset=utf-8" })); + downloads.set(url, undefined); + link = document.createElement("a"); + link.href = url; + link.download = "webspeak-identity.ini"; + document.body.append(link); + link.click(); + const downloadUrl = url; + downloads.set(url, setTimeout(() => releaseDownload(downloadUrl), 1000)); + showToast(t("identityExportSuccess")); + } catch { + if (url) releaseDownload(url); + if (current()) showToast(t("identityExportError")); + } finally { + try { link?.remove(); } catch { /* URL cleanup is independent of DOM removal. */ } + if (current()) exporting.value = false; + } + } + function releaseDownload(url: string) { + if (!downloads.has(url)) return; + clearTimeout(downloads.get(url)); + downloads.delete(url); + try { URL.revokeObjectURL(url); } catch { /* Continue releasing other owned URLs. */ } + } + async function restore(load: () => Promise) { + if (disposed) return; + const revision = ++identityRevision; + try { + const stored = await load(); + if (!disposed && revision === identityRevision && stored) { + rememberIdentity.value = true; + identityMaterial.value = stored; + } + } catch { /* Optional local storage cannot prevent a new browser session. */ } + } + onScopeDispose(() => { disposed = true; reset(); }); + return { open, text, error, busy, reading, exporting, show, close, reset, restore, readFile, submit, exportIdentity }; +} diff --git a/web/src/services/skin-pack.test.ts b/web/src/services/skin-pack.test.ts index d927c01..324efc8 100644 --- a/web/src/services/skin-pack.test.ts +++ b/web/src/services/skin-pack.test.ts @@ -1,5 +1,5 @@ import assert from "node:assert/strict"; -import { readFile } from "node:fs/promises"; +import { readFile, readdir } from "node:fs/promises"; import test from "node:test"; import { strToU8, zipSync } from "fflate"; import { importSkinPack, resolveSkinCssAssets, SkinPackError } from "./skin-pack.js"; @@ -78,16 +78,18 @@ test("community skins use a scoped light fallback instead of inheriting the nigh }); test("all public skin parts are documented and the admin console is outside skin scope", async () => { - const [webClient, header, demo, skinSwitcher, languageSwitcher, admin, documentation] = await Promise.all([ + const componentRoot = new URL("../components/web-client/", import.meta.url); + const componentFiles = (await readdir(componentRoot, { recursive: true })).filter(path => path.endsWith(".vue")); + const components = (await Promise.all(componentFiles.map(path => readFile(new URL(path.replaceAll("\\", "/"), componentRoot), "utf8")))).join("\n"); + const [webClient, demo, skinSwitcher, languageSwitcher, admin, documentation] = await Promise.all([ readFile(new URL("../views/WebClient.vue", import.meta.url), "utf8"), - readFile(new URL("../components/web-client/WebClientHeader.vue", import.meta.url), "utf8"), readFile(new URL("../views/DemoView.vue", import.meta.url), "utf8"), readFile(new URL("../components/SkinSwitcher.vue", import.meta.url), "utf8"), readFile(new URL("../components/LanguageSwitcher.vue", import.meta.url), "utf8"), readFile(new URL("../views/AdminView.vue", import.meta.url), "utf8"), readFile(new URL("../../../docs/SKIN_DEVELOPMENT.md", import.meta.url), "utf8"), ]); - const publicParts = new Set([...`${webClient}\n${header}\n${demo}\n${skinSwitcher}\n${languageSwitcher}`.matchAll(/data-ws-part="([^"]+)"/g)].map((match) => match[1])); + const publicParts = new Set([...`${webClient}\n${components}\n${demo}\n${skinSwitcher}\n${languageSwitcher}`.matchAll(/data-ws-part="([^"]+)"/g)].map((match) => match[1])); for (const part of publicParts) assert.ok(documentation.includes(`\`${part}\``), `Undocumented skin part: ${part}`); assert.match(skinSwitcher, /data-ws-skin-id/); assert.match(skinSwitcher, /data-ws-state/); diff --git a/web/src/styles/web-client.css b/web/src/styles/web-client.css index f987d01..942185c 100644 --- a/web/src/styles/web-client.css +++ b/web/src/styles/web-client.css @@ -80,10 +80,10 @@ .field-wrap:focus-within { color: #006a64; background: #fff; box-shadow: 0 0 0 2px #81d8d0; } .field-wrap input { width: 100%; min-width: 0; padding: 0; color: #24312f; outline: none; border: 0; background: transparent; font-size: 13px; } .field-wrap input::placeholder { color: #a5b0ad; } -.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; color: #fff; background: #006a64; border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s; } -.primary-button:hover:not(:disabled) { background: #005650; box-shadow: 0 9px 20px rgba(0, 106, 100, .18); transform: translateY(-1px); } -.primary-button:active:not(:disabled) { transform: translateY(0); } -.primary-button:disabled { cursor: not-allowed; opacity: .45; } +.primary-button, :deep(.identity-import-submit) { display: inline-flex; align-items: center; justify-content: center; gap: 10px; color: #fff; background: #006a64; border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s; } +.primary-button:hover:not(:disabled), :deep(.identity-import-submit:hover:not(:disabled)) { background: #005650; box-shadow: 0 9px 20px rgba(0, 106, 100, .18); transform: translateY(-1px); } +.primary-button:active:not(:disabled), :deep(.identity-import-submit:active:not(:disabled)) { transform: translateY(0); } +.primary-button:disabled, :deep(.identity-import-submit:disabled) { cursor: not-allowed; opacity: .45; } .connect-button { width: 100%; min-height: 44px; margin-top: 10px; font-size: 13px; } .button-spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; } .join-meta { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 12px; color: #96a29f; font-size: 10px; } @@ -119,7 +119,7 @@ .member-panel { min-width: 0; padding: 26px 16px; color: #2c3935; background: #fbfcfc; border-left: 1px solid #eef2f0; }.member-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; }.member-panel-heading h2 { margin: 5px 0 0; color: #25322e; font-size: 19px; letter-spacing: -.04em; }.member-search { margin-top: 18px; padding: 0 10px; min-height: 33px; }.member-group { margin-top: 24px; }.member-group-title { display: flex; align-items: center; gap: 8px; color: #85928e; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }.group-line { height: 1px; flex: 1; background: #e6edeb; }.member-list { display: flex; flex-direction: column; gap: 17px; margin-top: 17px; }.member-row { display: flex; align-items: center; gap: 8px; min-width: 0; }.member-avatar { position: relative; display: grid; place-items: center; width: 33px; height: 33px; flex: 0 0 auto; color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; }.member-avatar.speaking { box-shadow: 0 0 0 2px #90f691, 0 0 10px rgba(144,246,145,.35); }.member-presence { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border: 2px solid #fbfcfc; border-radius: 50%; background: #65d879; }.member-copy { min-width: 0; flex: 1; }.member-copy strong, .member-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.member-copy strong { color: #34423d; font-size: 10px; }.member-copy span { margin-top: 4px; color: #96a29e; font-size: 9px; }.member-volume { display: flex; align-items: center; gap: 5px; color: #a1afaa; width: 64px; }.member-volume input { width: 45px; height: 4px; appearance: none; border-radius: 99px; outline: none; cursor: pointer; }.member-volume input::-webkit-slider-thumb, .settings-range::-webkit-slider-thumb { width: 14px; height: 14px; appearance: none; border: 2px solid #81d8d0; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.12); cursor: pointer; }.member-volume input::-moz-range-thumb, .settings-range::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid #81d8d0; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.12); cursor: pointer; }.member-empty { margin-top: 22px; color: #98a49f; font-size: 10px; text-align: center; }.member-panel-tip { display: flex; gap: 8px; margin-top: 36px; padding: 12px; color: #72827c; background: #eef5f2; border-radius: 9px; font-size: 9px; line-height: 1.5; }.member-panel-tip .ui-icon { color: #5e9e96; } -.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 28px; background: rgba(25, 33, 31, .42); backdrop-filter: blur(5px); }.settings-modal { display: flex; width: min(920px, 100%); max-height: min(760px, calc(100dvh - 56px)); overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 20px 60px rgba(16,40,35,.2); }.settings-nav { display: flex; flex-direction: column; width: 215px; flex: 0 0 auto; padding: 28px 12px 20px; background: #f8faf9; border-right: 1px solid #e6ecea; }.settings-title { padding: 0 13px 20px; color: #25322e; font-size: 19px; font-weight: 700; }.settings-nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; color: #65736f; background: transparent; border-left: 3px solid transparent; border-radius: 8px; font-size: 11px; text-align: left; cursor: pointer; }.settings-nav-item.active { color: #006a64; background: #e2efec; border-left-color: #006a64; font-weight: 700; }.settings-version { margin-top: auto; padding: 20px 13px 0; color: #98a5a0; border-top: 1px solid #e4ebe8; font-size: 10px; line-height: 1.7; }.settings-version span { color: #b0bbb7; }.settings-main { display: flex; min-width: 0; flex: 1; flex-direction: column; }.settings-header { display: flex; align-items: center; justify-content: space-between; min-height: 75px; padding: 0 28px; border-bottom: 1px solid #edf1ef; }.settings-header h2 { margin: 0; color: #202c29; font-size: 22px; letter-spacing: -.045em; }.settings-content { flex: 1; overflow-y: auto; padding: 28px 40px; }.settings-section { max-width: 620px; margin: 0 auto; }.settings-section h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 21px; color: #293631; font-size: 16px; }.settings-section h3 .ui-icon { color: #006a64; }.settings-label { display: block; margin-bottom: 8px; color: #5e6d67; font-size: 10px; font-weight: 500; }.select-like { display: flex; align-items: center; justify-content: space-between; min-height: 39px; margin-bottom: 19px; padding: 0 13px; color: #394742; background: #f4f7f6; border-radius: 8px; font-size: 11px; }.select-like .ui-icon { color: #677671; }.settings-range-row { display: flex; align-items: center; justify-content: space-between; }.settings-range-row .settings-label { margin: 0; }.settings-range-row strong { color: #006a64; font-size: 10px; }.settings-range { width: 100%; height: 6px; margin: 11px 0 20px; appearance: none; border-radius: 999px; outline: none; cursor: pointer; }.settings-range::-webkit-slider-thumb { width: 19px; height: 19px; }.settings-range::-moz-range-thumb { width: 19px; height: 19px; }.mic-test { padding: 15px; border: 1px solid #e5ece9; border-radius: 11px; background: #fafcfb; }.mic-test-header { display: flex; align-items: center; justify-content: space-between; }.mic-test-header strong { color: #36453f; font-size: 11px; }.mic-test-header button { padding: 6px 9px; color: #006a64; background: #e0f1ee; border-radius: 5px; font-size: 10px; cursor: pointer; }.meter { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; height: 39px; margin-top: 12px; padding: 0 4px 4px; border-bottom: 1px solid #dce6e2; }.meter i { width: 5px; min-height: 4px; border-radius: 3px 3px 0 0; background: #dfe6e3; }.meter i.active { background: #81ed8b; box-shadow: 0 0 7px rgba(129,237,139,.45); animation: meter 1s ease-in-out infinite alternate; }.meter-labels { display: flex; justify-content: space-between; margin-top: 6px; color: #9ba6a2; font-size: 8px; }.settings-separator { max-width: 620px; margin: 32px auto; border-top: 1px solid #edf1ef; }.mode-note { display: flex; align-items: flex-start; gap: 8px; padding: 12px; color: #66817a; background: #eef7f4; border-radius: 8px; font-size: 10px; line-height: 1.5; }.mode-note .ui-icon { color: #4f9c91; }.settings-footer { display: flex; justify-content: flex-end; gap: 16px; min-height: 67px; padding: 15px 28px; border-top: 1px solid #edf1ef; }.text-button { padding: 0 6px; color: #63716c; background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }.save-button { padding: 0 23px; }.qq-modal-card { position: relative; width: min(460px, 100%); max-height: min(90dvh, 720px); overflow-y: auto; padding: 30px; color: #263431; border: 1px solid #d9e7e3; border-radius: 20px; background: #fff; box-shadow: 0 20px 60px rgba(16,40,35,.22); text-align: center; }.qq-modal-heading { padding: 0 24px 18px; }.qq-modal-heading h2 { margin: 8px 0 0; color: #1d2d29; font-size: 25px; letter-spacing: -.04em; }.qq-modal-close { position: absolute; top: 13px; right: 13px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: #6d7d78; background: #f1f6f4; border: 1px solid #e1ebe8; border-radius: 50%; cursor: pointer; }.qq-modal-close:hover { color: #006a64; background: #e2f2ef; border-color: #c8e6e1; }.qq-qr-image { display: block; width: min(100%, 360px); max-height: min(55vh, 520px); margin: 0 auto; object-fit: contain; border-radius: 12px; }.qq-direct-join { margin: 18px 0 9px; color: #667773; font-size: 13px; }.qq-join-link { display: block; padding: 11px 14px; color: #006a64; background: #edf8f5; border: 1px solid #cfe9e4; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1.45; text-decoration: none; overflow-wrap: anywhere; }.qq-join-link:hover { color: #fff; background: #006a64; border-color: #006a64; }.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 8px; padding: 11px 15px; color: #fff; background: #263e39; border-radius: 9px; box-shadow: 0 10px 24px rgba(16,48,42,.2); font-size: 11px; animation: toast-in .25s ease-out; } +.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 28px; background: rgba(25, 33, 31, .42); backdrop-filter: blur(5px); }.settings-modal { display: flex; width: min(920px, 100%); max-height: min(760px, calc(100dvh - 56px)); overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 20px 60px rgba(16,40,35,.2); }.settings-nav { display: flex; flex-direction: column; width: 215px; flex: 0 0 auto; padding: 28px 12px 20px; background: #f8faf9; border-right: 1px solid #e6ecea; }.settings-title { padding: 0 13px 20px; color: #25322e; font-size: 19px; font-weight: 700; }.settings-nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; color: #65736f; background: transparent; border-left: 3px solid transparent; border-radius: 8px; font-size: 11px; text-align: left; cursor: pointer; }.settings-nav-item.active { color: #006a64; background: #e2efec; border-left-color: #006a64; font-weight: 700; }.settings-version { margin-top: auto; padding: 20px 13px 0; color: #98a5a0; border-top: 1px solid #e4ebe8; font-size: 10px; line-height: 1.7; }.settings-version span { color: #b0bbb7; }.settings-main { display: flex; min-width: 0; flex: 1; flex-direction: column; }.settings-header { display: flex; align-items: center; justify-content: space-between; min-height: 75px; padding: 0 28px; border-bottom: 1px solid #edf1ef; }.settings-header h2 { margin: 0; color: #202c29; font-size: 22px; letter-spacing: -.045em; }.settings-content { flex: 1; overflow-y: auto; padding: 28px 40px; }.settings-section { max-width: 620px; margin: 0 auto; }.settings-section h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 21px; color: #293631; font-size: 16px; }.settings-section h3 .ui-icon { color: #006a64; }.settings-label { display: block; margin-bottom: 8px; color: #5e6d67; font-size: 10px; font-weight: 500; }.select-like { display: flex; align-items: center; justify-content: space-between; min-height: 39px; margin-bottom: 19px; padding: 0 13px; color: #394742; background: #f4f7f6; border-radius: 8px; font-size: 11px; }.select-like .ui-icon { color: #677671; }.settings-range-row { display: flex; align-items: center; justify-content: space-between; }.settings-range-row .settings-label { margin: 0; }.settings-range-row strong { color: #006a64; font-size: 10px; }.settings-range { width: 100%; height: 6px; margin: 11px 0 20px; appearance: none; border-radius: 999px; outline: none; cursor: pointer; }.settings-range::-webkit-slider-thumb { width: 19px; height: 19px; }.settings-range::-moz-range-thumb { width: 19px; height: 19px; }.mic-test { padding: 15px; border: 1px solid #e5ece9; border-radius: 11px; background: #fafcfb; }.mic-test-header { display: flex; align-items: center; justify-content: space-between; }.mic-test-header strong { color: #36453f; font-size: 11px; }.mic-test-header button { padding: 6px 9px; color: #006a64; background: #e0f1ee; border-radius: 5px; font-size: 10px; cursor: pointer; }.meter { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; height: 39px; margin-top: 12px; padding: 0 4px 4px; border-bottom: 1px solid #dce6e2; }.meter i { width: 5px; min-height: 4px; border-radius: 3px 3px 0 0; background: #dfe6e3; }.meter i.active { background: #81ed8b; box-shadow: 0 0 7px rgba(129,237,139,.45); animation: meter 1s ease-in-out infinite alternate; }.meter-labels { display: flex; justify-content: space-between; margin-top: 6px; color: #9ba6a2; font-size: 8px; }.settings-separator { max-width: 620px; margin: 32px auto; border-top: 1px solid #edf1ef; }.mode-note { display: flex; align-items: flex-start; gap: 8px; padding: 12px; color: #66817a; background: #eef7f4; border-radius: 8px; font-size: 10px; line-height: 1.5; }.mode-note .ui-icon { color: #4f9c91; }.settings-footer { display: flex; justify-content: flex-end; gap: 16px; min-height: 67px; padding: 15px 28px; border-top: 1px solid #edf1ef; }.text-button, :deep(.identity-import-cancel) { padding: 0 6px; color: #63716c; background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }.save-button { padding: 0 23px; }.qq-modal-card { position: relative; width: min(460px, 100%); max-height: min(90dvh, 720px); overflow-y: auto; padding: 30px; color: #263431; border: 1px solid #d9e7e3; border-radius: 20px; background: #fff; box-shadow: 0 20px 60px rgba(16,40,35,.22); text-align: center; }.qq-modal-heading { padding: 0 24px 18px; }.qq-modal-heading h2 { margin: 8px 0 0; color: #1d2d29; font-size: 25px; letter-spacing: -.04em; }.qq-modal-close, :deep(.identity-import-close) { position: absolute; top: 13px; right: 13px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: #6d7d78; background: #f1f6f4; border: 1px solid #e1ebe8; border-radius: 50%; cursor: pointer; }.qq-modal-close:hover, :deep(.identity-import-close:hover) { color: #006a64; background: #e2f2ef; border-color: #c8e6e1; }.qq-qr-image { display: block; width: min(100%, 360px); max-height: min(55vh, 520px); margin: 0 auto; object-fit: contain; border-radius: 12px; }.qq-direct-join { margin: 18px 0 9px; color: #667773; font-size: 13px; }.qq-join-link { display: block; padding: 11px 14px; color: #006a64; background: #edf8f5; border: 1px solid #cfe9e4; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1.45; text-decoration: none; overflow-wrap: anywhere; }.qq-join-link:hover { color: #fff; background: #006a64; border-color: #006a64; }.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 8px; padding: 11px 15px; color: #fff; background: #263e39; border-radius: 9px; box-shadow: 0 10px 24px rgba(16,48,42,.2); font-size: 11px; animation: toast-in .25s ease-out; } .channel-password-modal { position: relative; width: min(420px, 100%); padding: 31px 32px 28px; color: #263431; border: 1px solid #d9e7e3; border-radius: 18px; background: #fff; box-shadow: 0 20px 60px rgba(16,40,35,.22); } .channel-password-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 17px; color: #006a64; background: #e4f4f0; border-radius: 14px; } @@ -248,26 +248,26 @@ .identity-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; } .identity-controls .remember-identity { min-width: 0; flex: 1; } .identity-actions { display: flex; flex: 0 0 auto; gap: 7px; } -.identity-action-button, .identity-file-button { min-height: 31px; padding: 0 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border)); border-radius: 8px; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; } -.identity-action-button:hover, .identity-file-button:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface-1)); } +.identity-action-button, :deep(.identity-file-button) { min-height: 31px; padding: 0 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border)); border-radius: 8px; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; } +.identity-action-button:hover, :deep(.identity-file-button:hover) { background: color-mix(in srgb, var(--accent) 16%, var(--surface-1)); } .identity-action-button:disabled { cursor: not-allowed; opacity: .48; } -.identity-import-backdrop { z-index: 50; } -.identity-import-modal { display: flex; width: min(620px, 100%); max-height: min(720px, calc(100dvh - 56px)); flex-direction: column; gap: 15px; overflow-y: auto; padding: 25px; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px color-mix(in srgb, var(--text-primary) 22%, transparent); } -.identity-import-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-right: 35px; } -.identity-import-header h2 { margin: 0; color: var(--text-primary); font-size: 20px; letter-spacing: -.035em; } -.identity-import-header p { margin: 7px 0 0; color: var(--text-muted); font-size: 11px; line-height: 1.5; } -.identity-import-textarea { display: block; width: 100%; min-height: 190px; resize: vertical; padding: 12px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; outline: none; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; } -.identity-import-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 17%, transparent); } -.identity-drop-zone { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; min-height: 58px; padding: 10px 14px; color: var(--text-muted); background: color-mix(in srgb, var(--accent) 5%, var(--surface-1)); border: 1px dashed color-mix(in srgb, var(--accent) 48%, var(--border)); border-radius: 10px; font-size: 11px; cursor: pointer; transition: background .16s, border-color .16s; } -.identity-drop-zone > .ui-icon { color: var(--accent); } -.identity-drop-zone.active, .identity-drop-zone:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface-1)); border-color: var(--accent); } -.identity-file-input { display: none; } -.identity-import-error { margin: -5px 0 0; color: var(--danger); font-size: 11px; line-height: 1.45; } -.identity-import-security { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 11px 12px; color: var(--text-muted); background: color-mix(in srgb, var(--warning) 10%, var(--surface-1)); border-radius: 9px; font-size: 10px; line-height: 1.5; } -.identity-import-security .ui-icon { flex: 0 0 auto; color: var(--warning); } -.identity-import-footer { display: flex; align-items: center; justify-content: flex-end; gap: 15px; } -.identity-import-submit { min-height: 39px; padding: 0 16px; } -.identity-import-submit:disabled { cursor: not-allowed; opacity: .52; } +:deep(.identity-import-backdrop) { z-index: 50; } +:deep(.identity-import-modal) { position: relative; display: flex; width: min(620px, 100%); max-height: min(720px, calc(100dvh - 56px)); flex-direction: column; gap: 15px; overflow-y: auto; padding: 25px; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px color-mix(in srgb, var(--text-primary) 22%, transparent); } +:deep(.identity-import-header) { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-right: 35px; } +:deep(.identity-import-header h2) { margin: 0; color: var(--text-primary); font-size: 20px; letter-spacing: -.035em; } +:deep(.identity-import-header p) { margin: 7px 0 0; color: var(--text-muted); font-size: 11px; line-height: 1.5; } +:deep(.identity-import-textarea) { display: block; width: 100%; min-height: 190px; resize: vertical; padding: 12px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; outline: none; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; } +:deep(.identity-import-textarea:focus) { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 17%, transparent); } +:deep(.identity-drop-zone) { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; min-height: 58px; padding: 10px 14px; color: var(--text-muted); background: color-mix(in srgb, var(--accent) 5%, var(--surface-1)); border: 1px dashed color-mix(in srgb, var(--accent) 48%, var(--border)); border-radius: 10px; font-size: 11px; cursor: pointer; transition: background .16s, border-color .16s; } +:deep(.identity-drop-zone > .ui-icon) { color: var(--accent); } +:deep(.identity-drop-zone.active), :deep(.identity-drop-zone:hover) { background: color-mix(in srgb, var(--accent) 12%, var(--surface-1)); border-color: var(--accent); } +:deep(.identity-file-input) { display: none; } +:deep(.identity-import-error) { margin: -5px 0 0; color: var(--danger); font-size: 11px; line-height: 1.45; } +:deep(.identity-import-security) { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 11px 12px; color: var(--text-muted); background: color-mix(in srgb, var(--warning) 10%, var(--surface-1)); border-radius: 9px; font-size: 10px; line-height: 1.5; } +:deep(.identity-import-security .ui-icon) { flex: 0 0 auto; color: var(--warning); } +:deep(.identity-import-footer) { display: flex; align-items: center; justify-content: flex-end; gap: 15px; } +:deep(.identity-import-submit) { min-height: 39px; padding: 0 16px; } +:deep(.identity-import-submit:disabled) { cursor: not-allowed; opacity: .52; } .local-servers { display: grid; gap: 8px; margin: 1px 0 5px; } .local-server-group { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; } .local-server-group > span { width: 100%; color: #87958f; font-size: 10px; font-weight: 700; } @@ -330,7 +330,7 @@ .join-page .notice { font-size: 15px; } .join-page .field-label { font-size: 13.75px; } .join-page .field-wrap input { font-size: 16.25px; } -.join-page .primary-button { font-size: 15px; } +.join-page .primary-button, .join-page :deep(.identity-import-submit) { font-size: 15px; } .join-page .connect-button { font-size: 16.25px; } .join-page .join-meta, .join-page .join-footer { font-size: 12.5px; } @@ -844,7 +844,9 @@ .web-client.language-en .join-page .field-wrap input, .web-client.language-de .join-page .field-wrap input { font-size: 14.3px; } .web-client.language-en .join-page .primary-button, -.web-client.language-de .join-page .primary-button { font-size: 13.2px; } +.web-client.language-de .join-page .primary-button, +.web-client.language-en .join-page :deep(.identity-import-submit), +.web-client.language-de .join-page :deep(.identity-import-submit) { font-size: 13.2px; } .web-client.language-en .join-page .connect-button, .web-client.language-de .join-page .connect-button { font-size: 14.3px; } .web-client.language-en .join-page .join-meta, @@ -1272,19 +1274,19 @@ } @media (max-width: 740px) { - .identity-import-backdrop { align-items: flex-end; padding: 0; } - .identity-import-modal { width: 100%; max-height: calc(100svh - env(safe-area-inset-top, 0px)); padding: 24px 19px calc(18px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0; } - .identity-import-textarea { min-height: 24svh; } - .identity-drop-zone { justify-content: flex-start; } - .identity-import-footer .identity-import-submit { min-height: 46px; } + :deep(.identity-import-backdrop) { align-items: flex-end; padding: 0; } + :deep(.identity-import-modal) { width: 100%; max-height: calc(100svh - env(safe-area-inset-top, 0px)); padding: 24px 19px calc(18px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0; } + :deep(.identity-import-textarea) { min-height: 24svh; } + :deep(.identity-drop-zone) { justify-content: flex-start; } + :deep(.identity-import-footer .identity-import-submit) { min-height: 46px; } } @media (max-width: 420px) { .identity-controls { align-items: flex-start; flex-direction: column; gap: 8px; } .identity-actions { width: 100%; } .identity-action-button { flex: 1; } - .identity-import-header { padding-right: 27px; } - .identity-import-header h2 { font-size: 18px; } + :deep(.identity-import-header) { padding-right: 27px; } + :deep(.identity-import-header h2) { font-size: 18px; } } /* Give the brand and actions their own rows before they can overlap. */ diff --git a/web/src/views/WebClient.vue b/web/src/views/WebClient.vue index db9e967..fa91ea8 100644 --- a/web/src/views/WebClient.vue +++ b/web/src/views/WebClient.vue @@ -76,7 +76,7 @@ -
{{ t('identityOptions') }}

{{ t('rememberIdentityConcurrentWarning') }}

+
{{ t('identityOptions') }}

{{ t('rememberIdentityConcurrentWarning') }}

- -
- {{ t('identityDropZone') }} -
- - -

{{ t('identityImportSecurity') }}

-
- - +