Skip to content

feat(macos): 允许个人构建在编译时覆盖 bundle id 与数据目录 - #1244

Open
DragonNameLeo wants to merge 1 commit into
Open-Less:betafrom
DragonNameLeo:feat/macos-build-identity-override
Open

DragonNameLeo wants to merge 1 commit into
Open-Less:betafrom
DragonNameLeo:feat/macos-build-identity-override

Conversation

@DragonNameLeo

Copy link
Copy Markdown

摘要

无对应 issue。

让个人构建可以在编译时覆盖写死的 com.openless.app 和 OpenLess,从而与官方版并存、互不共享状态。未设置时取值不变,官方构建行为与改动前完全一致。

修复 / 新增 / 改进

  • 新增编译期常量 persistence::BUNDLE_ID / persistence::APP_DIR_NAME,分别读取 option_env!("OPENLESS_BUNDLE_ID") / option_env!("OPENLESS_APP_DIR_NAME"),默认 com.openless.app / OpenLess
  • macOS / Windows / Linux 的数据目录与日志目录改用 APP_DIR_NAME
  • CredentialsVault::SERVICE_NAME(系统凭据库 service 名)与 lib.rs 中应用内 TCC 重置使用的 bundle id 改用 BUNDLE_ID

用法示例(个人构建同时传入相同的 Tauri identifier):

OPENLESS_BUNDLE_ID=com.openless.app.local OPENLESS_APP_DIR_NAME="OpenLess Local" \
  npm run tauri -- build --bundles app \
  --config '{"identifier":"com.openless.app.local","productName":"OpenLess Local","plugins":{"updater":{"endpoints":[]}}}'

兼容

  • 不包含:Tauri 配置与打包脚本的改动(identifier 由构建者自行通过 --config 覆盖);Android 的路径与类名;旧版 ~/.openless/credentials.json 迁移路径
  • 对现有用户 / 本地环境 / 构建流程的影响:无。不设置这两个环境变量时,所有路径与 service 名与改动前逐字相同

测试计划

  • 命令:cargo check --locked(src-tauri,未设置上述环境变量)
  • 结果:通过
  • 命令:设置上述环境变量并按示例在 macOS 上构建,与官方版同时安装、运行
  • 结果:数据目录(~/Library/Application Support/OpenLess Local)、日志目录(~/Library/Logs/OpenLess Local)、Keychain service、麦克风 / 辅助功能授权均与官方版独立
  • 证据路径:无(本地手动验证)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Abbfv5hvANpC7Sku5KEXJ3

…ompile time

OPENLESS_BUNDLE_ID / OPENLESS_APP_DIR_NAME (read with option_env!) replace the
hardcoded com.openless.app and "OpenLess" for the data directory, log
directory, credential store service name and in-app TCC resets. Unset, the
values are unchanged, so official builds behave exactly as before; a personal
build can set them together with its Tauri identifier to run side by side
with the official app without sharing state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJvDYNu6QoSEhJ4yGSuRqk
@H-Chris233 H-Chris233 added area:security Security area enhancement New feature or request needs-review Needs review needs-tests Needs tests P3 Low priority platform:linux Linux-specific platform:macos macOS-specific platform:windows Windows-specific labels Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:security Security area enhancement New feature or request needs-review Needs review needs-tests Needs tests P3 Low priority platform:linux Linux-specific platform:macos macOS-specific platform:windows Windows-specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants