16 Commits
Author SHA1 Message Date
weidu12123 a3e79b97b6 feat: ship GPUI native client and fix SFTP session recovery
- Rebuild the GPUI client against the 1:1 UI spec with all six modules,
  terminal context menu, SSE reveal, system tray and standalone windows.
- Add an SFTP session self-healing layer: detect dead channels, drop the
  cached session, reconnect and retry across every file and transfer path.
- Add a terminal refresh button that recreates the pane in place, with
  proper loading and error feedback in both GPUI and the Web console.
- Route startup and autostart through vps-switch-gpui when it is present,
  and make repeated launches wake the existing window via a file lock.
- Strip debuginfo in release, add a GitHub Actions matrix workflow for
  macOS and Linux, and refresh the Windows installers and README.
2026-10-18 12:09:49 +08:00
weidu12123andClaude Opus 4.8 a868ce9a57 fix(terminal): rebuild the scene on history replay instead of appending it
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-17 02:22:35 +08:00
weidu12123andClaude Opus 4.8 4e1aebf26e fix: repair the issues found in the pre-release review
Backend:

- Downloading a file from the local host through the transfer engine always
  failed: the download branch had no LOCAL_HOST_ID case, so it opened SFTP
  against 127.0.0.1:0 (reproduced: "SSH 连接失败: 地址无效 (os error 10049)").
  The file browser's own download button goes through that path, so it was
  broken in the UI too. The local branch now reuses stream_upload_to_host,
  which already had one, keeping the temp-file/resume/SHA-256 guarantees.
- remove_item only refused the literal "/", so a Windows drive root listed by
  the file browser ("此电脑" returns "C:/") could be deleted recursively. New
  is_root_like() also covers drive roots, "." and "..", shared with
  compress_item, plus unit tests.
- dir_cache grew without bound; capped at 256 entries, oldest evicted first.
- ExecTaskManager capped task count but not buffered bytes: 60 running tasks
  could hold 120 MiB. Added a 32 MiB budget that evicts finished tasks only.
- Web sessions were only ever inserted, never expired, and every auth-settings
  save minted another one. Now a token->issued map with a 30-day TTL, pruned on
  every issue.

Frontend:

- A failed pane creation left the stage spinning "正在连接" forever (no retry,
  and the standalone window has no tab bar to escape through). The failure is
  now kept on the tab and rendered as an error with a retry button.
- The transfer-queue poller only cleared its 350 ms interval on success, so a
  401 or a backend restart left it polling ~3 req/s indefinitely.
- The MCP call detail fetch had no sequence guard, so clicking two rows quickly
  showed the wrong call's args and result.
- Only three call sites handled 401. Since the session table lives in memory,
  every daemon restart invalidates all sessions, so with auth enabled this is
  routine rather than an edge case. All protected requests now go through
  apiFetch and return to the login screen.
- check-update read data.message, which the backend never returns (it returns
  error), so failures only ever showed a bare "检查更新失败".

Docs: corrected the Claude Code setup commands (missing --transport http, and
x-vps-switch-key is not a header the server reads), fixed the Setup.exe PATH
claim, added measured memory numbers for both platforms, and added a
build-from-source section -- a clean clone cannot compile, since frontend/dist
is ignored while RustEmbed treats its absence as a hard error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-16 22:34:52 +08:00
weidu12123andClaude Opus 4.8 67031b31b1 chore(release): prepare v0.1.0 release packaging and clean sensitive data
- Scrub hardcoded hostnames from MCP descriptions, UI placeholders,
  and documentation examples to prevent environment leakage.
- Remove hardcoded development database fallback from src/db.rs.
- Untrack .cargo/config.toml from version control and ignore local mirrors.
- Ignore test artifacts, screenshots, and WiX temporary outputs in .gitignore.
- Add Inno Setup script (installer.iss) for Windows Setup.exe wizard installer.
- Add WiX configuration (wix/main.wxs) for Windows MSI installer.
- Add systemd service template (vps-switch.service) for Linux deployments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-16 10:39:35 +08:00
weidu12123andClaude Opus 4.8 21ac1dd4c5 feat: move MCP call log into its own settings section with full detail and filters
The call log was a bare table crammed into the MCP Server settings tab: no
way to read what an agent actually sent or got back, and no way to narrow
it down.

- mcp_calls gains a `result` column holding the full text returned to the
  agent (previously only a one-line summary survived). Args and result are
  each capped at 256 KiB, and hitting the cap writes the truncation notice
  into the body itself instead of hiding it behind a flag. Existing
  databases pick the column up via ALTER TABLE; old rows stay empty.
- GET /api/mcp-calls now filters by host, tool, ok, and a closed-open
  time range. Host matching expands comma-joined batch targets, so
  `vip-hk` finds "vip-hk,gateway,..." while `hk` still matches nothing.
- The list returns a 400-char args preview only; a new
  GET /api/mcp-calls/:id serves one record's full args and result, so a
  500-row view cannot pull hundreds of megabytes into the browser.
- Settings gets a fourth category, "调用记录": date range (local-day
  boundaries converted to UTC instants), host/tool/result selects, reset,
  and rows that expand into the complete args and result with copy
  buttons.

Verified on the running build against 686 existing records: host, tool,
result, date and combined filters all narrow correctly, and a 300 KB
output shows the in-body truncation note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-16 08:02:36 +08:00
weidu12123 5645b08f22 fix: repair the 10 issues found in the full-fleet test
- exec cancel: send an SSH signal and confirm the process group stopped before reporting cancelled
- terminal: reject pane_id whose host does not match the target host (read/send/key/close/reveal)
- auth: enable login by default on Linux/public bind; keep an explicit user choice
- terminal: build the send baseline from the actual PTY write, not from injection output
- exec: mark stdout/stderr explicitly when output exceeds the 1 MiB cap
- web download: deliver to the browser through the transfer engine and clean up staging
- mcp: unfinished tasks report ok=false; batch inspect fails when any item fails
- local: initialize OS metadata per platform and repair legacy Windows metadata on Linux
- cli config: keep PORT and DATA_DIR in the generated Claude/Codex stdio config
- update check: return 502/ok=false with real stdout/stderr/exitCode on failure
- frontend: add vue-tsc typecheck and fix the standardSQL import
2026-10-16 00:58:31 +08:00
weidu12123andClaude Fable 5 b836cb0b53 fix: stop MCP exec poll loop and add MCP call audit; Linux/VPS deploy support
- vps_exec 超时不再诱导轮询(去掉"请使用 vps_task 查询"的 hint),未完成一律 ok=false,
  终态清空过期 hint;vps_task(get) 增加 wait_seconds 阻塞等待,一次拿到最终结果
- 新增 MCP 调用全程留痕:mcp_calls 表 + GET /api/mcp-calls + 设置页「MCP 调用记录」板块
- Linux/VPS:本机执行走 sh、探针 inspect_local_linux、终端用 $SHELL、压缩解压用 tar;
  数据目录支持 DATA_DIR;非 Windows / HOST=0.0.0.0 默认开启登录密码
- 设置页去 1Shell 化文案;winres 归入 windows build-deps;内嵌应用图标(build.rs + assets/app.ico)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-15 16:38:10 +08:00
weidu12123 3176ffdc4c fix: MCP bridge fallback, loopback-exempt API key, terminal reconnect, and probe status
- stdio bridge now falls back to in-process handling unless the forward returns a
  real JSON-RPC response. A 401 from an API-key / data-dir mismatch used to be
  printed verbatim as the tool result, so clients never completed the handshake
- MCP API key is enforced only when bound to a non-loopback address; on 127.0.0.1
  it is exempt (local-first, like 1Shell). The remote toggle still governs HOST=0.0.0.0
- vps_terminal "key" action now passes through the command denylist; its fallback
  branch could previously carry arbitrary text and bypass the guard
- vps_exec interactive-prompt early-exit now matches only explicit keywords, so
  ordinary commands whose last line ends in ':' / '?' are no longer aborted mid-run
- terminal: add a "重新连接" button that recreates a pane in place after the session ends
- file browser: downloads go through the resumable + SHA-256 transfer engine
  (default local path = Downloads, runs in background, non-blocking)
- standalone terminal window: hide the dead 文件管理 / 详情图表 buttons
- probe status: an SSH connection means online (probe failure no longer flips to
  red); a connect timeout maps to unknown instead of offline; latency now measures
  the connect only, not the probe
- transfer: a resumed download fails instead of silently accepting when the remote
  hash is unavailable; secret.key is no longer overwritten when corrupt; a per-host
  lock serializes pane creation
2026-10-15 01:47:00 +08:00
weidu12123 fbf2ac2231 feat: CodeMirror editor, transfer resume, OS auto-detect, and pane-isolated terminal
- CodeMirror 6 online editor (lazy-loaded chunk) with syntax highlighting,
  search/replace, Ctrl+S save over SFTP, dark/light glass themes
- Streamed transfer resume: keep <target>.vps-part fragment on interruption,
  reconcile source hash on re-issue and continue from fragment end
- Probe self-heals os_info: try recorded OS, fall back to the other family,
  write back the real OS/version/arch (fixes hand-added hosts)
- Terminal uses its own SSH connection per host (released when last pane
  closes) so the login MOTD is not eaten by the shared status-check session
- Shell-integration injection narrowed to headless MCP panes only; remote
  echo off via pty-req ECHO=0 so nothing is drawn (no more line erasing)
- Frontend: roll back optimistic toggles and surface failures on autostart,
  MCP settings, host delete/patch, and CLI sync instead of faking success
2026-10-14 23:16:05 +08:00
weidu12123andClaude Opus 4.8 7bf552952f feat: add command blacklist guardrail for MCP command channels
MCP 工具一旦被外部 agent 放行,参数里的命令就不再受它自身权限系统检查
(Claude Code 的 MCP 权限规则只按工具名匹配、不带参数内容),
vps_exec 里的 rm -rf / 在 agent 侧零提示。这是唯一的兜底。

- src/guard.rs:名单判定。归一化(剥引号、\/ 还原、折叠空白、转小写、
  短选项聚簇排序,故 -rf/-fr/-r -f 等价)+ * 通配 + 词边界匹配 + 截断标记检查
- data/deny-list.txt:首启写出内置 25 条不可逆灾难,用户可增删,每次判定重读
- 挂在 vps_exec 与 vps_terminal 的 send 上,命中即拒绝执行、不产生输出
- 工具描述写明护栏存在,并告诉 agent 被拦时不要换写法重试
- GET/PUT /api/guard + 设置页 MCP 标签下的名单编辑区
- 没有白名单、确认流程、风险分级与安全挡位

边界:防手滑,不防蓄意绕过(r\m -rf /、$(echo rm) -rf / 这类纯模式匹配必然漏)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-13 23:55:31 +08:00
weidu12123andClaude Fable 5 14e7066db9 fix: close pre-release security holes and correctness bugs
- 静态资源回退存在路径穿越,未鉴权即可读出 secret.key 与 vps-switch.db
- MCP 端点默认要求 API Key;删除可被客户端伪造的 x-vps-switch-stdio 豁免头
- 跨源只放行本机回环来源;绑回环时校验 Host,挡 DNS rebinding
- 本机命令输出中文乱码(本机与远端共用 EncodedCommand + UTF-8)
- 远端拿不到退出码时不再报成功;cross 传输超时不再谎报"后台传输中"
- 任务表与单流输出加上限;传输队列双锁死锁改单锁;回收已退出的终端 pane
- 前端终端创建改为按主机去重;终端断线自动重连并给出提示

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-13 22:12:39 +08:00
weidu12123 3710e0926b fix: toggle settings page back to workspace and suppress local inspect powershell window popup 2026-10-13 19:03:46 +08:00
weidu12123 ac92ac981a feat: adopt monochrome topological lock brand icon (Option D) 2026-10-13 18:08:02 +08:00
weidu12123 ace7e83f58 feat: redesign settings with tabs, autostart registry, background mode, and about update check 2026-10-13 17:30:23 +08:00
weidu12123 76627aad6d feat: implement standalone native terminal window and full-width stage 2026-10-13 17:02:26 +08:00
weidu12123 d2348d0c00 feat: initial commit of vps-switch core modules and desktop frontend 2026-10-13 16:36:22 +08:00