Commit Graph
29 Commits
Author SHA1 Message Date
GloridustandClaude Opus 4.8 f5e5bb5bcb fix(watchdog): VNC 响应性探测默认关闭,可用 env 重新开启
实测健康实例 VNC 探测 ~1ms 响应;但宿主级 CPU/IO 偶发争用(如同机重 docker build)
会让 8s 探测超时被误判为 stall,从而重启正常实例(用户反馈"浏览器经常重启")。

- 新增 WOC_WATCHDOG_HEALTH_FAILS(默认 0=关闭该探测);正整数 N = 连续 N 次无响应才重启。
- 内存阈值自愈(soft/hard)不受影响,照常工作。
- .env.example 补充说明。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 03:53:59 +08:00
GloridustandClaude Opus 4.8 9929a72be1 feat(panel): 全局日志系统 + 一键诊断包导出
单实例「日志」只记录该实例日志,无从排查跨实例/容器层面的问题(首个实例创建卡死、
打开实例黑屏不可用、升级失败等)。新增面板级全局日志 + 一键诊断包:

- logs.ts(新):统一持久化日志(面板数据卷,跨重建保留)。实例日志原语从 docker.ts
  迁来;新增 appendPanelLog/readPanelLog、按时间裁剪 filterSince、一年保留 pruneOldLogs、
  时间范围 24h/7d/30d/1y。无 docker 依赖避免循环。
- 仪表化:实例创建(含镜像拉取前后,定位首次拉取卡死)、删除、启停、重启、升级、
  应用安装/更新、看门狗自愈 均写入面板全局日志(同时回显 stdout)。
- docker.ts buildDiagnostics:打包 system.txt(Docker/镜像/系统)+ panel.log +
  instances/<id>.log(容器状态 inspect + 持久日志 + 实时日志)+ containers.txt(全部
  woc-* 容器清单,含残留),手搓多文件 tar.gz(沿用既有无依赖 tar 风格)。
- 路由:GET /api/admin/diagnostics?range=(导出 tar.gz)、GET /api/admin/panel-log?range=;
  启动 + 每 24h 跑 pruneOldLogs。
- 前端:管理页「诊断与日志」区——时间范围(24h默认/7d/30d/1y) + 导出诊断包 + 查看面板日志。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 00:48:36 +08:00
GloridustandClaude Opus 4.8 7293285d1a feat(panel): 显示构建版本号 + 自动检测新版(Docker Hub/GHCR 红点)
管理界面此前看不到面板版本,也无从知道有没有新版可升。现在:

- 构建时把版本号烤进面板镜像:Dockerfile 新增 ARG/ENV WOC_VERSION(放末尾不
  破坏依赖缓存);release.yml 用 git tag 注入(vX.Y.Z,手动触发为 dev-<sha>),
  仅面板镜像消费;build-local.sh 支持 --build-arg(默认 dev)。
- 后端 version.ts:best-effort 查询 Docker Hub 与 GHCR 上 woc-panel 的语义化
  标签取最大值,与当前版本比对;启动后 4s 首检 + 每 6h 复检 + 接口惰性触发,
  失败静默(离线/被墙/私有源不报错、不显红点)。命名空间从 WOC_WECHAT_IMAGE 推断。
- 接口:GET /api/version(任意登录用户读缓存)、POST /api/admin/version/check
  (管理员手动重查)。
- 前端:管理页「关于」卡显示当前版本/最新版/升级提示/检查更新/发布日志链接;
  侧栏「管理」入口在有新版时点红点(仅管理员)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 22:40:17 +08:00
GloridustandClaude Opus 4.8 2e201ff058 feat(panel): 持久化实例日志,跨容器重建保留
实例容器日志随重建(重启/升级/看门狗自愈)即丢失,用户看不到"上次为何
重启/崩溃"(浏览器实例常因内存触顶被看门狗重启)。现把生命周期事件 + 重启
原因 + 重建前的容器日志快照,追加到面板数据卷 /data/logs/<id>.log,跨重建保留。

- docker.ts: appendInstanceLog/readInstanceLog/snapshotContainerLog/deleteInstanceLog;
  日志目录与 accounts.json 同卷(宿主 ./data-panel 持久化),单实例上限 ~400KB
  超限截半保留最近;id 十六进制校验防路径注入。
- runInstance 删旧容器前先快照其最后日志、启动后记"容器已启动";
  stopInstance 记"容器已停止";removeInstance 彻底删除时清理日志文件。
- 看门狗 recover() 写入自愈原因(hard/soft/health + 内存明细)。
- 日志接口返回「持久化历史 + 本次容器实时日志」两段。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 21:53:11 +08:00
GloridustandClaude Opus 4.8 1c230316ed feat(v1.2.0): 自定义实例图标——内置精选 + 上传裁剪
- AppIcon:内置精选平台图标(微信/Chromium/Telegram/小红书/抖音/B站/微博/知乎/YouTube/通用)+ ICON_CHOICES。
- 编辑器(管理菜单「图标」):选内置图标 / 上传图片用 react-easy-crop 方形裁剪→128px PNG / 恢复默认。
- 后端 setInstanceIcon + /api/admin/instances/:id/icon(仅 admin;icon=builtin:<key>/data:图片/空,限 ~225KB)。
- 新增依赖 react-easy-crop。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 19:41:40 +08:00
GloridustandClaude Opus 4.8 1ffc6d7e1d feat(v1.2.0): 实例头像由首字母改为按应用类型的图标(自定义图标铺底)
新增 AppIcon.tsx(InstanceIcon + 内置 SVG 图标:微信/Chromium/Telegram/通用),侧栏与主页
卡片头像改用它(按 appType 出默认图标;data: 图片 / builtin:<key> 优先)。
新增 Instance.icon 字段 + publicInstance 下发,为「自定义图标(内置选择 + 上传裁剪)」铺底。
侧栏/主页标题「微信实例」→「实例」,主页副文案按应用名泛化。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 19:01:03 +08:00
GloridustandClaude Opus 4.8 7c9eb82a6f fix(v1.2.0): 旧容器无 app-ctl.sh 时回退 wechat-ctl.sh(修微信实例误报未安装)
多应用分发对所有实例调 /woc/app-ctl.sh,但升级前的旧容器镜像里没有该脚本 → exec 失败 →
wechatStatus 兜底成"未安装",已装微信的老实例全变"待安装"。triggerWechat/wechatStatus 改为
bash -c:有 app-ctl.sh 则按 appType 分发,无则回退老的 wechat-ctl.sh(旧实例皆微信)。
老实例不升级也能正常显示/操作;升级到多应用镜像后自动走 app-ctl 分发。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 18:52:08 +08:00
GloridustandClaude Opus 4.8 b954f38c15 fix(v1.2.0): wechatStatus 改走 app-ctl <appType>(之前被 iCloud 回退)
b7fd778 提交时这行被本机 iCloud 回退成 wechat-ctl.sh status,导致非微信实例(Chromium)
状态去查微信二进制 → 永远「尚未安装」,且 Chromium 无安装按钮 → 卡死。改回 app-ctl.sh
<appType> status:Chromium 即报已就绪、可直接进入。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 18:46:42 +08:00
GloridustandClaude Opus 4.8 b7fd778ab1 feat(v1.2.0): 多应用平台——创建实例时选 微信/Telegram(+Chromium/自定义占位)
镜像层(向后兼容,微信路径零改动):
- app-defs.sh:按 appType 给出 APP_BIN/APP_LAUNCH/APP_NAME(缺省回退微信)。
- app-ctl.sh:通用安装/状态分发;wechat 委托回 wechat-ctl.sh;telegram 下载官方 portable tar.xz。
- autostart:读 /config/.woc-app 选择启动哪个应用,读不到回退微信(老实例零改动)。
- 02-woc-app 钩子:把容器环境 WOC_APP_TYPE 落到 /config/.woc-app(缺则不写→回退微信)。
- Dockerfile:加 xz-utils(telegram 解压)+ COPY 新脚本。

后端:envList 透传 WOC_APP_TYPE(+自定义启动命令);triggerWechat/wechatStatus 改走
app-ctl.sh <appType>(微信行为不变);创建实例路由接受 appType。

前端:新建实例对话框加「应用类型」选择器(微信默认 / Telegram;Chromium、自定义标记"即将支持"禁用)。

本轮 Telegram(x86_64) 端到端可用;Chromium(待 apt 烤镜像) 与 自定义(待上传流) 下一轮。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 17:38:15 +08:00
Gloridust 11c5406d0f Merge branch 'main' into feat/v1.2.0-multi-app 2026-06-14 17:19:41 +08:00
GloridustandClaude Opus 4.8 659d26ce68 fix(docker): typeInInstance 卡 ~2s 根因——xclip 未重定向 fd
xclip -i 会 daemon 化常驻持有剪贴板选区,并继承 docker exec 的 stdout/stderr,
导致 exec 要等这俩 fd 关闭、每次中文转发卡 ~2.1s。给 xclip 重定向 >/dev/null 2>&1
后整条链路降到 ~0.08s(实测 26× 提速)。中文输入条与无感模式都受益。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 16:57:33 +08:00
GloridustandClaude Opus 4.8 2edba455dc feat(v1.2.0): 实例 appType 数据模型地基(向后兼容)
引入 AppType(wechat/telegram/chromium/custom)+ APP_LABELS + instanceAppType() 兜底。
Instance 增 appType?(可选) 与 customLaunch?;createInstance 接受 appType(默认 wechat)、
按应用取默认名;publicInstance 下发 appType(老实例无字段→回退 wechat)。
纯增量、不改现有运行行为;为后续 autostart 分发 / 各应用安装 / 前端选择器铺底。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 15:37:53 +08:00
GloridustandClaude Opus 4.8 8ab5375ded feat(desktop): 输入法双模式切换(无感 / 转发)+ 深度修复无感丢字
nav 栏可切「无感输入」(直接在微信里打中文)/「转发输入」(底部输入条,默认),偏好持久化。
无感:enable_ime=true,compositionend 捕获中文经 xdotool 转发;并用有序队列把"转发未完成期间"
的后续可见字符 + 回车/退格串行送出,彻底消除"中文走异步、数字走 keysym 抢跑"的"你好123→23"丢字;
队列空闲不干预,英文/数字仍走原生 keysym 零延迟。新增 /api/instances/:id/key(xdotool 单键)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 15:15:05 +08:00
GloridustandClaude Opus 4.8 1c34777353 feat(panel): 管理员数据卷管理(整卷备份/恢复 + 文件浏览器)
管理页 → 实例「管理」→ 数据卷(仅 admin)。解决大量用户"把 PC 微信数据迁移上 docker"的诉求。

- 整卷备份:流式打包 /config 为 .tar.gz 下载(大文件不入内存);恢复:上传覆盖回 /config。
  machine-id 存在卷内随包迁移 → 跨 woc 实例恢复可保留聊天记录。
- 文件浏览器:浏览/上传/上传并解压(.tar/.tar.gz)/下载/改名/移动/删除;PC 数据打包上传解压后重启实例。
- 全程在运行中的实例上操作(exec + docker cp,运行容器才可 exec);恢复为全量覆盖,强提示并建议重启。
- 安全:仅 admin;路径严格限制在 /config、禁止 .. 穿越;上传落地为 abc 属主。
- docker.ts 抽出 extractSingleFileFromTar 复用(PAX 头跳过),新增 list/mkdir/move/delete/upload/
  extract/download/backup(stream)/restore;index.ts 加 9 个 /volume 管理路由;前端 VolumeManager 弹窗
  + 线性 SVG 图标(替代渲染不一致的 emoji);新增 doc/数据卷管理.md。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 22:01:41 +08:00
GloridustandClaude Opus 4.8 38846b6429 feat: 中文输入条 + 文件下载/另存修复 + 卡连接自愈 + CF/MAC/音频
中文输入(彻底改造,弃用脆弱的 VNC IME 拦截)
- 关闭 KasmVNC enable_ime:VNC 直接打字回归纯 keysym,英文/数字正常、不再损坏
- 新增底部「中文输入条」:面板真实 textarea 原生输入法 → POST /type → 容器内 xclip+xdotool
  粘贴进微信,可靠且与浏览器/输入法无关。flex 列布局(nav/画面/输入条三者并列不遮挡),
  牛奶布艺主题配色,可一键收起。

稳定性 / 自愈
- watchdog 新增响应性探测:实例 I/O/服务 stall(进程在、显示在线但读不出 VNC 文件、永远"正在
  连接桌面")时,连续 2 次无响应即自动重启自愈
- 前端 12s 未加载出来 → 「桌面无响应」+ 重新连接/重启,不再无限转圈
- PWA 新 SW 接管即自动重载一次,更新一刷即生效(修"改了仍看旧界面")

文件
- 下载:正确解析 tar、跳过 PAX 扩展头(中文名文件曾因此大小错误/损坏)
- 另存:每次启动确保 /config/Desktop 归 abc,修微信另存"保存失败"

安全 / 伪装
- Host 白名单支持 *.example.com 通配 + X-Forwarded-Host(修 CF 反代域名仍被拒)
- 设备伪装新增真实网卡 MAC(厂商 OUI,替代容器本地管理位 MAC)

音频:扬声器自动连接(首个手势激活)、焦点离开自动断、麦克风(HTTPS)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 23:33:46 +08:00
Gloridust 27fa9c2670 fix: machine mask 2026-06-06 02:15:16 +08:00
GloridustandClaude Opus 4.8 8fd147bccc fix(P0): unique persistent machine-id per instance + manual reset
All instances shared the image-baked machine-id (a67bf09f...), so Tencent
saw every WechatOnCloud account worldwide as one "device" — a textbook
device-farm signal triggering risk control and the forced-logout loop
reported across old and new versions.

- docker/woc-identity.sh: new /custom-cont-init.d/00-woc-identity hook —
  generates a unique machine-id on first start, persists it in the data
  volume (survives restart/upgrade/recreate), writes /etc/machine-id +
  /var/lib/dbus/machine-id, removes /.dockerenv. Existing instances get a
  fresh unique id on first upgraded start (volume lacks the file).
- regenInstanceMachineId + POST /api/admin/instances/:id/regen-machine-id:
  roll a brand-new device id and restart, for accounts re-flagged by risk
  control. Gated on the hook being present (old image → instructs upgrade).
- Admin 实例卡片「安全」弹窗新增「重置设备 ID 并重启」。

Verified: two fresh containers get distinct machine-ids; id persists across
restart; regen (rm persisted file + restart) yields a new persistent id.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 01:41:45 +08:00
GloridustandClaude Opus 4.7 35f256edb8 docs(security): clarify multi-host allowlist + echo rejected host in 400
- .env.example: surface multi-domain syntax (PANEL_ALLOWED_HOSTS=a,b,c),
  IPv6 literal example, and reverse-proxy troubleshooting tip.
- index.ts: 400 response includes the rejected `host` and a hint pointing
  at PANEL_ALLOWED_HOSTS — drops the diagnostic floor when reverse-proxy
  Host-passthrough is misconfigured.

Follow-up to #13 (DNS-rebinding allowlist).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 17:55:46 +08:00
Ethan ZouandGitHub a2677c6b4a Merge pull request #13 from aaronjmars/security/host-allowlist-dns-rebinding
fix(security): gate panel Host header to block DNS rebinding
2026-06-04 17:53:46 +08:00
Gloridust ba8fe96486 feat: delet old docker 2026-06-04 17:42:06 +08:00
Gloridust d99c3b8bf6 fix ram 2026-06-04 17:33:00 +08:00
aeonframework 74c436e779 fix(security): gate panel Host header to block DNS rebinding
Without Host validation, a malicious page the operator visits can use DNS
rebinding to point a hostname at the panel's loopback / LAN IP and drive
every authenticated API from the operator's own browser — including the
docker.sock-backed admin endpoints. The README's "intranet-only" guidance
does not cover this: the browser is the trust-boundary crossing.

Add an onRequest hook (plus a Host check on raw WebSocket upgrades) that
allows loopback + RFC1918 LAN by default and accepts public hostnames via
PANEL_ALLOWED_HOSTS (documented in .env.example and threaded through
docker-compose.yml). 35 inject()-driven assertions; tsc --noEmit clean.

Detected by Aeon + manual review (DNS-rebinding-gate axis).
Severity: high
CWE-346 (Origin Validation Error)
2026-06-02 20:25:28 +00:00
huglemon 6df7d8c7cf fix: add CJK IME paste fallback 2026-06-03 00:08:47 +08:00
Gloridust 4f582f2c5e fix Chinese input & copyboard & log 2026-06-02 19:46:28 +08:00
Gloridust 49b785ff9f fix autostart 2026-06-01 19:42:35 +08:00
Gloridust 1555e60072 update ui and fix vnc v1.1.0 2026-06-01 17:31:57 +08:00
GloridustandClaude Opus 4.8 eddc35ecae feat: 超管密码离线找回 + 改密/重置二次确认 + GHCR 手动构建文档
- 密码找回:accounts.json 给用户加 "resetPassword": true(兼容 reset_password),
  重启面板即把其密码重置为 PANEL_ADMIN_PASSWORD(默认 wechat)、解禁并清除标记
- 改密/重置密码弹窗新增「再次输入新密码」二次确认:两次不一致则拦截,
  避免浏览器自动填充/手误把密码静默设成非预期值导致锁死
- README:补充方式 B(本机 buildx 手动多架构构建推送 GHCR)+ Release 的 latest 注意事项
  + 「重置超管密码(离线找回)」操作步骤

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 13:29:54 +08:00
GloridustandClaude Opus 4.8 17ba168764 feat: 音视频/文件传输 + 产品 UX 改进 + 镜像源可切换
媒体链路(生产 HTTPS 下可用,含降级)
- 音频(听):PulseAudio + KasmVNC 工具条,开箱即用
- 麦克风(说):virtmic 管道源已就绪,运行时需 HTTPS(非 HTTPS 前端提示)
- 摄像头(视频):docker.ts 条件化 v4l2 设备直通 + 加 video 组;无设备/无 HTTPS 时优雅降级,音频麦克风不受影响
- WOC_VIDEO_DEVICES 显式指定或经 /host-dev 自动探测

文件传输(原生拖拽)
- 面板侧拖拽上传 + 下载:dockerode putArchive/getArchive 到实例 ~/Desktop(持久卷)
- 纯 JS 单文件 tar 编解码(免依赖),文本/二进制均无损;全程走面板鉴权与权限校验

安全 & UX
- 默认密码告警条 + mustChangePassword 追踪(兼容旧账号文件迁移)
- 会话过期(401) 自动跳登录;桌面连接 loading 态
- 停止/未创建实例一键启动(新增 /api/admin/instances/:id/start)
- 统一牛奶布艺弹窗 + Toast,替换 Admin 原生 alert/confirm/prompt
- 密码可见切换;实例重命名;退出二次确认;空状态改用品牌终端图标

其它
- gen-icons 生成终端风格图标(此前仅空白绿块,影响 Docker/CI 产物)
- 镜像源可切换 WOC_IMAGE_PREFIX(国内反代/ACR);品牌名「云微」
- 文档:.env.example / docker-compose 增加音视频(v4l2loopback/HTTPS)、镜像源、视频设备说明

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 10:56:33 +08:00
Gloridust 5c5e9c8540 update 2026-05-29 22:00:23 +08:00