feat(okww): 优化专项配置与启动流程 - #341
Conversation
审阅者指南(Reviewer's Guide)通过此次重构,将 OK-WW 集成中的配置所有权重新交回 OK-WW 本身,同时在 MAS 端增加防护措施和“一键导入”能力,并简化 MAS 端对用户日常任务、资源选择以及基于启动器的游戏启动等选项的管理;同时移除了旧的应用内 JSON 编辑器 API。 新版 OK-WW 脚本配置会话的序列图sequenceDiagram
actor User
participant ScriptTable as ScriptTable.vue
participant ScriptsView as Scripts.vue
participant WebSocket as useWebSocket
participant Service as Service
participant Manager as OkwwManager.main_task
participant ScriptConfig as ScriptConfigTask
participant OkwwApp as ok-ww.exe
User->>ScriptTable: click handleStartOkwwConfig
ScriptTable->>ScriptsView: emit startOkwwConfig
ScriptsView->>ScriptsView: handleStartOkwwConfig
ScriptsView->>Service: addTaskApiDispatchStartPost
Service-->>ScriptsView: { code:200, taskId }
ScriptsView->>WebSocket: subscribe({ id: taskId })
ScriptsView->>ScriptsView: showOkwwConfigMask = true
Service->>Manager: dispatch task (mode=SCRIPT_CONFIG)
Manager->>ScriptConfig: spawn ScriptConfigTask.main_task
ScriptConfig->>ScriptConfig: _kill_processes
ScriptConfig->>ScriptConfig: _configure_okww_launcher
ScriptConfig->>ScriptConfig: copy mas_config_dir -> script_config_path
ScriptConfig->>OkwwApp: ProcessManager.open_process
WebSocket-->>ScriptsView: Signal { Accomplish? }
alt [user clicks 保存设置]
User->>ScriptsView: handleSaveOkwwConfig
ScriptsView->>Service: stopTaskApiDispatchStopPost
Service-->>ScriptsView: { code:200 }
ScriptsView->>WebSocket: unsubscribe(subscriptionId)
end
Service->>ScriptConfig: request stop
ScriptConfig->>ScriptConfig: final_task
ScriptConfig->>ScriptConfig: _configure_okww_launcher
ScriptConfig->>ScriptConfig: _update_json BasicOptions
ScriptConfig->>ScriptConfig: copy script_config_path -> mas_config_dir
ScriptConfig->>Manager: finish
ScriptsView->>ScriptsView: clearOkwwConfigSession
文件级变更
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的 控制台 以:
获取帮助Original review guide in EnglishReviewer's GuideRefactors OK-WW integration by moving configuration ownership back into OK-WW itself, adding MAS-side guardrails and one-click imports, and simplifying MAS-managed per-user options for daily tasks, resource selection, and launcher-based game startup while removing the old in-app JSON editor APIs. Sequence diagram for the new OK-WW script configuration sessionsequenceDiagram
actor User
participant ScriptTable as ScriptTable.vue
participant ScriptsView as Scripts.vue
participant WebSocket as useWebSocket
participant Service as Service
participant Manager as OkwwManager.main_task
participant ScriptConfig as ScriptConfigTask
participant OkwwApp as ok-ww.exe
User->>ScriptTable: click handleStartOkwwConfig
ScriptTable->>ScriptsView: emit startOkwwConfig
ScriptsView->>ScriptsView: handleStartOkwwConfig
ScriptsView->>Service: addTaskApiDispatchStartPost
Service-->>ScriptsView: { code:200, taskId }
ScriptsView->>WebSocket: subscribe({ id: taskId })
ScriptsView->>ScriptsView: showOkwwConfigMask = true
Service->>Manager: dispatch task (mode=SCRIPT_CONFIG)
Manager->>ScriptConfig: spawn ScriptConfigTask.main_task
ScriptConfig->>ScriptConfig: _kill_processes
ScriptConfig->>ScriptConfig: _configure_okww_launcher
ScriptConfig->>ScriptConfig: copy mas_config_dir -> script_config_path
ScriptConfig->>OkwwApp: ProcessManager.open_process
WebSocket-->>ScriptsView: Signal { Accomplish? }
alt [user clicks 保存设置]
User->>ScriptsView: handleSaveOkwwConfig
ScriptsView->>Service: stopTaskApiDispatchStopPost
Service-->>ScriptsView: { code:200 }
ScriptsView->>WebSocket: unsubscribe(subscriptionId)
end
Service->>ScriptConfig: request stop
ScriptConfig->>ScriptConfig: final_task
ScriptConfig->>ScriptConfig: _configure_okww_launcher
ScriptConfig->>ScriptConfig: _update_json BasicOptions
ScriptConfig->>ScriptConfig: copy script_config_path -> mas_config_dir
ScriptConfig->>Manager: finish
ScriptsView->>ScriptsView: clearOkwwConfigSession
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我在这里给出了一些整体性的反馈:
已修复的安全问题:
-
Python 自带的
xml标准库容易受到 XML 外部实体(XXE)攻击。这类攻击可能泄露机密数据,而“XML 炸弹”则可能导致拒绝服务。不要使用这个库来解析不受信任的输入。Python 官方文档推荐改用defusedxml。(link) -
OK-WW 的配置掩码 UI 现在在两个地方都有实现(
OkwwUserEdit.vue和Scripts.vue),结构和样式都非常相似;建议抽取出一个共享组件(例如OkwwConfigMask),以避免重复实现,并保持行为和文案的一致。 -
多个 OK-WW 路径/布局常量在不同层被重复定义(例如
AutoProxy._OKWW_REL_APP_JSON/_OKWW_REL_CONFIG_DIR与data/apps/ok-ww/working/configs等字符串字面量,以及okwwPathDiscoveryService.ts中的标记名称);将这些常量按运行环境(后端/前端)集中到单一模块中并复用,可以减少在 OK-WW 更新目录结构时出现静默破坏的风险。
面向 AI 代理的提示词
Please address the comments from this code review:
## Overall Comments
- The OK-WW config mask UI is now implemented twice (in `OkwwUserEdit.vue` and `Scripts.vue`) with very similar structure and styles; consider extracting a shared component (e.g. `OkwwConfigMask`) to avoid duplication and keep behavior and copy in sync.
- Several OK-WW path/layout constants are duplicated across layers (`AutoProxy._OKWW_REL_APP_JSON` / `_OKWW_REL_CONFIG_DIR` vs string literals like `data/apps/ok-ww/working/configs` and sentinel names in `okwwPathDiscoveryService.ts`); centralizing these in a single module per runtime (backend/frontend) and reusing them would reduce the risk of silent breakage when OK-WW updates its directory structure.请帮我变得更有用!请在每条评论上点击 👍 或 👎,我会利用这些反馈来改进之后给你的评审。
Original comment in English
Hey - I've left some high level feedback:
Fixed security issues:
-
The native Python
xmllibrary is vulnerable to XML External Entity (XXE) attacks. These attacks can leak confidential data and "XML bombs" can cause denial of service. Do not use this library to parse untrusted input. Instead the Python documentation recommends usingdefusedxml. (link) -
The OK-WW config mask UI is now implemented twice (in
OkwwUserEdit.vueandScripts.vue) with very similar structure and styles; consider extracting a shared component (e.g.OkwwConfigMask) to avoid duplication and keep behavior and copy in sync. -
Several OK-WW path/layout constants are duplicated across layers (
AutoProxy._OKWW_REL_APP_JSON/_OKWW_REL_CONFIG_DIRvs string literals likedata/apps/ok-ww/working/configsand sentinel names inokwwPathDiscoveryService.ts); centralizing these in a single module per runtime (backend/frontend) and reusing them would reduce the risk of silent breakage when OK-WW updates its directory structure.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The OK-WW config mask UI is now implemented twice (in `OkwwUserEdit.vue` and `Scripts.vue`) with very similar structure and styles; consider extracting a shared component (e.g. `OkwwConfigMask`) to avoid duplication and keep behavior and copy in sync.
- Several OK-WW path/layout constants are duplicated across layers (`AutoProxy._OKWW_REL_APP_JSON` / `_OKWW_REL_CONFIG_DIR` vs string literals like `data/apps/ok-ww/working/configs` and sentinel names in `okwwPathDiscoveryService.ts`); centralizing these in a single module per runtime (backend/frontend) and reusing them would reduce the risk of silent breakage when OK-WW updates its directory structure.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Uh oh!
There was an error while loading. Please reload this page.