修复审查发现的功能/规范/性能问题(安全性功能除外) - #18
Open
heitaoplay wants to merge 1 commit into
Open
Conversation
致 liko: 本次提交修复了 HSC 代码审查中发现的、除「跨客户端远程编辑」安全性功能以外的所有问题。 【功能/逻辑 B1–B7】 - 移除背景深度效果对已删除字段 CONFIG.depthMax 的引用(panel.js / main.js),深度效果改为无等级扁平触发 - 统一版本号:config.js 回退值改为 1.0.2;theme-color-api.js 内嵌版本常量重命名为 COLORAPI_VER 并更新全部引用 - 修复 Emote 类型重复星号(BC 已用 *…* 包裹,不再手动加前导 *) - 修正催眠值说明文案(强制解除为时间制/清醒词,非「低于15%」) - 加固催眠语音拦截 _busy 锁(思考动作发送失败时解除锁 + finally 兜底,避免强控中永久失效) 【规范 S1–S5】 - 重写 README 项目结构,对齐真实 src/ 分类(core/ui/effects/hypno/expansion/util),修正 window.Liko.HSC 引用 - 清理 lint:no-unused-vars 允许未使用 catch 绑定 + 删除未用 isZh 导入,并移除 distort/BC_i18n/hypno-anim 中的死变量(0 warning) - printChat 改用 textContent 防 Self-XSS - 删除 i18n 死键(depthMax / depthRow* 等) - 强度滑杆最小值 0.3 → 0.1,对齐文档 0.1~3.0 【性能 P1–P3】 - extractChatText fallback 不再 cloneNode 整棵聊天 DOM,改为递归走查文本节点 - _screenGuard 由 400ms 轮询改为 CommonSetScreen hook(仅旧版 BC 无该函数时回退轮询) - 音效预载扩展至全部分类(hypno/voice/climax/depth) 【说明】跨客户端远程编辑(HSC_SetTexts 接收端鉴权)的安全性功能本次未改动——审查确认其鉴权模型正确(基于 BC 已认证的 data.Sender 在接收端校验 editModes + 白名单),故按约定保留不动。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@Liko 你好,
我对 BC-HSC 催眠插件做了一次完整代码审查,并修复了除「安全性(跨客户端远程编辑)」功能以外的所有问题。本提交已基于最新 upstream/main 重新 rebase,无冲突。
修复内容概览
功能 / 逻辑修复
CONFIG.depthMax死代码引用);强度滑块下限对齐文档 0.1~3.0。character-fx.js中 Emote 消息被重复包裹*…*(BC 已自动包裹)。hypno-speech.js的_busy锁:sendLocalizedAction异常时正确释放锁,setTimeout结束必清锁,避免永久卡死。util.js的extractChatText改用递归 walk 抽取纯文本,修复cloneNode清节点导致的内容丢失/错误。sound.js的preloadSounds改为预加载全部分类(此前只预加载 hypno 类)。规范 / 代码质量
config.js修正__HSC_VERSION__注入版本号(此前硬编码错误版本)。theme-color-api.js将误用的全局MOD_VER重命名为COLORAPI_VER,消除变量遮蔽。profile.js移除未使用的isZh导入。README.md重写为真实目录结构(src/core|expansion|util|ui|hypno|effects),修正window.Liko.HSCApi→window.Liko.HSC。i18n.js清理已删除的深度等级键,并修正催眠值解除文案。eslint.config.js增加caughtErrors: 'none',清理distort/BC_i18n/hypno-anim中的死变量。性能 / 架构
core-init.js用CommonSetScreenhook 替换 400ms 轮询守卫(保留旧版 BC 的轮询兜底),并在卸载时正确移除 hook。本次有意跳过
profile.js的HSC_SetTexts接收端鉴权模型(基于 BC 认证data.Sender校验 editModes + 白名单)实现正确,故本次未改动。如需进一步增强可另行讨论。验证
npm run lint→ 0 problemsnpm run build→ 通过(169.19 kB / gzip 58.49 kB,39 modules)请 review,谢谢!
附:完整代码审查报告已在本地生成(HSC代码审查报告.md),如需我可补充贴出或单独提交。