Skip to content

修复移动端启动检测并支持收藏项目持久化#2

Open
Tabshhh wants to merge 1 commit intoStarsTom:mainfrom
Tabshhh:fix/mobile-startup-and-starred-projects
Open

修复移动端启动检测并支持收藏项目持久化#2
Tabshhh wants to merge 1 commit intoStarsTom:mainfrom
Tabshhh:fix/mobile-startup-and-starred-projects

Conversation

@Tabshhh
Copy link

@Tabshhh Tabshhh commented Mar 19, 2026

变更内容

1. 修复移动端启动检测

之前启动脚本在拉起后端后没有检查 3001 是否真正启动成功,后端启动失败时,前端只会表现为“网络异常”,定位原因比较困难。

这次改动:

  • 启动脚本增加 3001 端口检查
  • 启动失败时直接输出最近的 stderr 信息
  • 运行时检查脚本补充关键诊断信息

2. 收藏项目持久化

之前收藏项目只保存在本地状态中,刷新后可能重置,也无法跨设备同步。

这次改动:

  • 新增用户偏好表
  • 新增用户偏好读写接口
  • 将侧边栏收藏项目接入后端偏好存储

验证

  • 3001/health 正常
  • 8080/health 正常
  • 重启服务栈后 30018080 均正常拉起
  • 收藏项目刷新后可保留

Copilot AI review requested due to automatic review settings March 19, 2026 11:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在提升移动端启动脚本的可诊断性,并将侧边栏“收藏项目”从仅本地存储升级为后端用户偏好持久化,从而支持刷新保留与跨设备同步。

Changes:

  • PowerShell 启动脚本增加对 3001 端口监听检测,并在失败时输出最近的 stderr 日志
  • 新增 user_preferences 表及其 DB 读写封装,并提供偏好读写 API
  • 前端侧边栏接入偏好读写接口,将收藏项目同步到后端

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
upstream-overrides/claudecodeui-1.25.2/src/utils/api.js /api/user/preferences/:key 增加 get/set API 封装
upstream-overrides/claudecodeui-1.25.2/src/components/sidebar/utils/utils.ts 新增收藏项目偏好 key 常量
upstream-overrides/claudecodeui-1.25.2/src/components/sidebar/hooks/useSidebarController.ts 启动时拉取收藏偏好并在收藏变更时写回后端
upstream-overrides/claudecodeui-1.25.2/server/routes/user.js 新增用户路由:git-config、onboarding、preferences
upstream-overrides/claudecodeui-1.25.2/server/database/init.sql 增加 user_preferences 表定义
upstream-overrides/claudecodeui-1.25.2/server/database/db.js migrations 创建 user_preferences 表 + userPreferencesDb 读写封装
scripts/start-mobile-codex-stack.ps1 增加 3001 端口启动检测并在失败时输出 stderr tail

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +31
router.get('/git-config', authenticateToken, async (req, res) => {
try {
const userId = req.user.id;
let gitConfig = userDb.getGitConfig(userId);
Comment on lines +173 to +175
const next = new Set(payload.value.filter((item: unknown) => typeof item === 'string'));
setStarredProjects(next);
persistStarredProjects(next);
Comment on lines +16 to +19
$listener = Get-NetTCPConnection -State Listen -LocalPort 3001 -ErrorAction SilentlyContinue
if ($listener) {
$appReady = $true
break
Comment on lines +352 to +354
void api.user.setPreference(STARRED_PROJECTS_PREFERENCE_KEY, [...next]).catch((error) => {
console.error('Error saving starred projects preference:', error);
});
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.

2 participants