Skip to content

feat: implement environment separation for simultaneous debugging#1128

Merged
piorpua merged 4 commits intoiOfficeAI:mainfrom
kylinhou:feature/EnvironmentSeparation
Mar 17, 2026
Merged

feat: implement environment separation for simultaneous debugging#1128
piorpua merged 4 commits intoiOfficeAI:mainfrom
kylinhou:feature/EnvironmentSeparation

Conversation

@kylinhou
Copy link
Copy Markdown

@kylinhou kylinhou commented Mar 3, 2026

Pull Request

描述 (Description)

本 PR 实现了 AionUi 客户端的开发/正式环境完全隔离功能,允许开发者在调试开发版本(just dev)时,与已打包的正式版应用同时运行且互不干扰,避免开发时数据异常影响正式环境的数据。

主要改动如下:

  1. 数据木隔离:在未打包的开发模式下,主动将 app.setName 设置为 AionUi-Dev,使开发版的缓存和配置存储在独立的 AppData\Roaming\AionUi-Dev 目录下,保护正式版的本地核心数据库(SQLite)不被污染。
  2. 服务端口隔离:对内置 Web Server 添加了运行环境判断,正式版默认沿用 25808 端口,开发版默认使用独立的 25809 端口,解决端口占用冲突。
  3. 消除多开单实例锁限制:由于底层依赖改变了 app.getName(),不仅隔离了存储,也使得开发版本获取到了独立的单实例锁(Single Instance Lock),彻底实现了双端双开。

关联的 Issue (Related Issues)

  • 没有相关 Issue

变更类型 (Type of Change)

  • 新功能 (New feature - 在不破坏现有功能的前提下添加了新特性)
  • 漏洞修复 (Bug fix)
  • 突破性变更 (Breaking change)
  • 文档更新 (Documentation update)

测试情况 (Testing)

  • 已在 macOS 测试
  • 已在 Windows 测试
  • 已在 Linux 测试
  • 我的代码遵循该项目的代码风格指南 (通过 prek 全部格式化与校验)
  • 我已对自己的代码进行了自我审查
  • 我的改动没有产生新的警告或错误

截图 (Screenshots)

image

补充信息 (Additional Context)

为了确保环境隔离能真正生效,app.setName('AionUi-Dev') 已通过调整提升至文件加载的最早期(即置于 ESM 的最初静态执行阶段),以防止内置 Chromium 或数据库在命名被修改前提前锁定默认(AionUi)沙盒路径。

感谢为 AionUi 做出贡献! 🎉

@kaizhou-lab kaizhou-lab self-assigned this Mar 17, 2026
zk added 2 commits March 17, 2026 15:08
…ection

- Add WEBUI_DEFAULT_PORT to src/common/constants.ts (25808 prod, 25809 dev)
- Replace all hardcoded 25808 port references across renderer, webserver,
  and browser adapter with the shared constant
- Remove unnecessary useState for port in WebuiModalContent
- Simplify misleading import-order comments in index.ts
…paration

# Conflicts:
#	src/index.ts
#	src/renderer/components/SettingsModal/contents/WebuiModalContent.tsx
ringringlin
ringringlin previously approved these changes Mar 17, 2026
@piorpua piorpua requested review from piorpua and ringringlin and removed request for ringringlin March 17, 2026 07:25
Add typeof check before calling app.setName() in configureChromium.ts
to prevent TypeError in test environments where electron app is
partially mocked without setName.
@kaizhou-lab kaizhou-lab force-pushed the feature/EnvironmentSeparation branch from be8de38 to 228b1a9 Compare March 17, 2026 07:35
@piorpua piorpua merged commit c5cd0a7 into iOfficeAI:main Mar 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants