Restore dashboard Feishu mirror toggle - #57
Open
AITCX08 wants to merge 1 commit into
Open
Conversation
Re-add the /api/mirror-toggle GET/POST endpoints and the dashboard
MirrorToggle button that were dropped on main. Backend reads/writes
~/.cc-connect/mirror.enabled (on/off) -- the same flag the feishu
转发开/关 command uses -- so the dashboard button and feishu command
share one source of truth. Auth via existing Bearer token middleware.
## 主要改动
- court_dashboard_server.py: register GET/POST /api/mirror-toggle +
handle_mirror_toggle_get/set reading/writing the shared flag file
- frontend MirrorToggle.tsx: Rss icon + 转发:开/关 text, 3s poll, click to flip
- api.ts: getMirrorToggle/setMirrorToggle
- TopBar.tsx: render <MirrorToggle/>
## 测试
- tsc -b && vite build: pass; MirrorToggle compiled into dist bundle
- curl GET (200 {enabled}) / POST off->file off / POST on->file on / bad body 400 / no-auth 401
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Restore the
/api/mirror-toggleendpoint + the dashboard top-bar toggle button (MirrorToggle) that were dropped when the branch was reset to main. Reads/writes the same~/.cc-connect/mirror.enabledflag the Feishu转发开/关command uses, so the dashboard button and the Feishu command share one state./api/mirror-toggle(Bearer-guarded, GET fail-closed to false on read error, POST validatesenabledis bool)MirrorToggle(Rss icon + 转发:开/关 + 3s poll + click-to-toggle),api.tsget/setMirrorToggle, rendered inTopBarVerification (static, app not launched)
npm run buildOK (MirrorToggle in bundle) · dashboard restarted,/healthz200/api/mirror-toggle→ 200{enabled:true}· no token → 401{enabled:false}→ GET reflects false →~/.cc-connect/mirror.enabledbecomesoff→ restored to onMerge gate
Hold until the user manually verifies the button in Feishu/dashboard.
🤖 Generated with Claude Code