tt-help-cli-ycl 1.4.169 → 1.4.171

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/package.json +1 -1
  2. package/scripts/test-subscription-allocator.mjs +220 -0
  3. package/scripts/test-subscription-auto-alloc-ui.mjs +208 -0
  4. package/scripts/test-subscription-auto-alloc.mjs +259 -0
  5. package/scripts/test-subscription-center-e2e.mjs +134 -0
  6. package/scripts/test-subscription-center-smoke.mjs +154 -0
  7. package/scripts/test-subscription-center-ui.mjs +111 -0
  8. package/scripts/vnc-login.sh +68 -0
  9. package/src/cli/info.js +6 -1
  10. package/src/lib/browser/cdp.js +7 -1
  11. package/src/watch/public/app.js +586 -15
  12. package/src/watch/public/index.html +70 -3
  13. package/src/watch/subscription-allocator.js +255 -0
  14. package/src/watch/subscription-center.js +590 -0
  15. package/src/watch/watchdog-server.js +210 -0
  16. package/src/watchdog/agent.js +5 -0
  17. package/scripts/test-api-interceptor-429.mjs +0 -122
  18. package/scripts/test-api-interceptor-captcha.mjs +0 -176
  19. package/scripts/test-claim-fix.mjs +0 -216
  20. package/scripts/test-clash-discover.mjs +0 -126
  21. package/scripts/test-clash-hysteresis.mjs +0 -131
  22. package/scripts/test-clash-multichannel.mjs +0 -120
  23. package/scripts/test-client-error-monitor.mjs +0 -261
  24. package/scripts/test-country-fix.mjs +0 -341
  25. package/scripts/test-daemon-failover.mjs +0 -301
  26. package/scripts/test-daemon-switch-history.mjs +0 -141
  27. package/scripts/test-daemon-whitelist.mjs +0 -308
  28. package/scripts/test-explore-captcha-wait.mjs +0 -170
  29. package/scripts/test-photo-post.mjs +0 -156
  30. package/scripts/test-precheck-perf.mjs +0 -270
  31. package/scripts/test-precise-index.mjs +0 -114
  32. package/scripts/test-probe-live.mjs +0 -83
  33. package/scripts/test-probe.mjs +0 -315
  34. package/scripts/test-product-fill-cdp.mjs +0 -336
  35. package/scripts/test-product-fill-db.mjs +0 -216
  36. package/scripts/test-product-fill-http.mjs +0 -117
  37. package/scripts/test-proxy-switch-restart.mjs +0 -198
  38. package/scripts/test-refill-order.mjs +0 -218
  39. package/scripts/test-sample-all-fail.mjs +0 -142
  40. package/scripts/test-seller-any-country.mjs +0 -167
  41. package/scripts/test-stats-smoke.mjs +0 -43
  42. package/scripts/test-upgrade-spawn.mjs +0 -179
  43. package/scripts/test-webserver-error-classify.mjs +0 -409
  44. package/scripts/test-wmi-free-upgrade.mjs +0 -98
  45. package/src/cli/test-real-attach.js +0 -0
  46. package/src/results/user-videos-bar.lar.lar.moeta.json +0 -37
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env bash
2
+ # 一键打开服务器虚拟屏幕浏览器(人工登录 TikTok / 过验证码用)
3
+ # 在 Mac 上执行:bash tiktok-cli/scripts/vnc-login.sh [CDP端口,默认 9222]
4
+ # 流程:Xvfb → openbox(窗口管理器,防止 Edge 窗口塌缩) → Edge(带 mihomo 代理) → x11vnc → Mac 隧道 → 屏幕共享
5
+ # 幂等:已在跑的组件自动跳过;VNC 密码: tiktok(文件在服务器 ~/.vncpass)
6
+ #
7
+ # ⚠️ 已知限制(2026-10-15 实测):
8
+ # - Mac↔ubuntu26 链路仅 ~3.4Mbps,Apple 屏幕共享无压缩编码 → 操作延迟秒级,属链路物理上限
9
+ # - TigerVNC viewer(brew install --cask tiger-vnc,连 localhost:5900)支持 JPEG 压缩,流畅度高很多
10
+ # - TikTok 对 CDP 合成鼠标事件(DevTools 投屏点击)有防护会静默丢弃——人工操作必须走 VNC 真实输入
11
+ # - 输入建议用剪贴板粘贴(Mac ⌘C → VNC ⌘V),键盘映射已用 -xkb -nomodtweak 优化
12
+ set -uo pipefail
13
+
14
+ PORT="${1:-9222}"
15
+ PROXY="http://127.0.0.1:7890" # 服务器上 mihomo
16
+ VNC_LOCAL=5900 # 本地隧道端口
17
+ DISPLAY_NUM=":99"
18
+ WIN_W=1600
19
+ WIN_H=900
20
+
21
+ echo "[1/5] 服务器端:Xvfb + openbox + Edge(CDP $PORT) + x11vnc"
22
+ ssh ubuntu26 "PORT=$PORT PROXY=$PROXY DISPLAY_NUM=$DISPLAY_NUM WIN_W=$WIN_W WIN_H=$WIN_H bash -s" <<'EOF'
23
+ pgrep -x Xvfb >/dev/null || {
24
+ nohup Xvfb "${DISPLAY_NUM:-:99}" -screen 0 1600x900x24 >/tmp/xvfb.log 2>&1 </dev/null &
25
+ sleep 2
26
+ }
27
+ # openbox 窗口管理器:没有它 Edge 重启后 X 窗口会塌缩成 10x10(VNC 里黑屏/点不了)
28
+ pgrep -x openbox >/dev/null || {
29
+ DISPLAY="${DISPLAY_NUM:-:99}" nohup openbox >/tmp/openbox.log 2>&1 </dev/null &
30
+ sleep 2
31
+ }
32
+ if ! curl -s --max-time 3 "http://127.0.0.1:${PORT}/json/version" >/dev/null; then
33
+ cd ~/projects/tiktok/tiktok-cli || exit 1
34
+ DISPLAY="${DISPLAY_NUM:-:99}" nohup node cli.js open -p "$PORT" --proxy "$PROXY" \
35
+ >/tmp/tt-open.log 2>&1 </dev/null &
36
+ for _ in $(seq 1 25); do
37
+ curl -s --max-time 2 "http://127.0.0.1:${PORT}/json/version" >/dev/null && break
38
+ sleep 1
39
+ done
40
+ sleep 4
41
+ fi
42
+ # 保险:强制 Edge 窗口全屏(无 WM 或 WM 迟钝时的兜底)
43
+ DISPLAY="${DISPLAY_NUM:-:99}" xdotool search --class msedge windowactivate 2>/dev/null
44
+ DISPLAY="${DISPLAY_NUM:-:99}" xdotool search --class msedge windowmove 0 0 windowsize "${WIN_W:-1600}" "${WIN_H:-900}" 2>/dev/null
45
+ sleep 1
46
+ DISPLAY="${DISPLAY_NUM:-:99}" xdotool search --class msedge getwindowgeometry 2>/dev/null | grep Geometry
47
+ curl -s --max-time 3 "http://127.0.0.1:${PORT}/json/version" | head -c 60
48
+ echo " <- CDP :$PORT"
49
+ [ -f ~/.vncpass ] || x11vnc -storepasswd tiktok ~/.vncpass
50
+ pgrep -x x11vnc >/dev/null || {
51
+ nohup x11vnc -display "${DISPLAY_NUM:-:99}" -localhost -forever \
52
+ -rfbauth ~/.vncpass -xkb -nomodtweak -noxdamage -threads -wait 5 -defer 5 \
53
+ -scale 2/3 -quiet >/tmp/x11vnc.log 2>&1 </dev/null &
54
+ sleep 2
55
+ }
56
+ ss -tln | grep -q ":5900 " && echo "[服务器] VNC ready (127.0.0.1:5900)"
57
+ EOF
58
+
59
+ echo "[2/5] 本地隧道 localhost:$VNC_LOCAL → 服务器 5900"
60
+ lsof -nP -i :"$VNC_LOCAL" -sTCP:LISTEN >/dev/null 2>&1 \
61
+ || ssh -fN -L "$VNC_LOCAL":127.0.0.1:5900 ubuntu26
62
+
63
+ echo "[3/5] 打开 macOS 屏幕共享"
64
+ open "vnc://localhost:$VNC_LOCAL"
65
+
66
+ echo "[4/5] 完成。VNC 密码: tiktok | 浏览器日志: 服务器 /tmp/tt-open.log"
67
+ echo "[5/5] 提示:TigerVNC viewer 更流畅(brew install --cask tiger-vnc 后连 localhost:$VNC_LOCAL)"
68
+ echo "用完清理(服务器上):pkill -f 'msedge.*$PORT'; pkill x11vnc; pkill Xvfb # Xvfb 可留"
package/src/cli/info.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  extractUniqueId,
6
6
  normalizeUsername,
7
7
  } from "../lib/url.js";
8
+ import { proxy as configuredProxy } from "../lib/constants.js";
8
9
 
9
10
  async function handleInfo(options) {
10
11
  const { infoUrls, infoOnlyVideo } = options;
@@ -36,7 +37,11 @@ async function handleInfo(options) {
36
37
  process.exit(1);
37
38
  }
38
39
 
39
- const scraper = new TikTokScraper({ poolSize: 1 });
40
+ // 配置了代理就注入(无 GUI/无系统代理的 Linux 服务器必需,否则直连被墙)
41
+ const scraper = new TikTokScraper({
42
+ poolSize: 1,
43
+ proxyServer: configuredProxy || null,
44
+ });
40
45
 
41
46
  try {
42
47
  await scraper.init();
@@ -461,6 +461,10 @@ function launchEdgeWithCDP(port, userDataDir, proxyServer) {
461
461
  "--disable-breakpad",
462
462
  "--disable-background-networking",
463
463
  "--disable-sync",
464
+ // Linux:允许 DevTools 前端(devtools:// origin)连 WS 投屏,
465
+ // 否则 Chrome 111+ 返回 403(本地调试用,CDP 仅绑 127.0.0.1);
466
+ // Xvfb 无窗口管理器,重启后窗口会塌缩成 10x10,必须显式指定尺寸
467
+ ...(platform === "linux" ? ["--remote-allow-origins=*", "--window-size=1600,900", "--window-position=0,0"] : []),
464
468
  // 显式打开 about:blank,避免 Edge 默认打开 MSN 新标签页
465
469
  "about:blank",
466
470
  ];
@@ -475,7 +479,9 @@ function launchEdgeWithCDP(port, userDataDir, proxyServer) {
475
479
  } else if (platform === "win32") {
476
480
  command = `start msedge ${argsStr}`;
477
481
  } else {
478
- command = `msedge ${argsStr} &`;
482
+ // Linux:必须重定向掉 stdout/stderr,否则 msedge 继承 exec 的管道,
483
+ // 回调永远不触发(浏览器启动成功但 explore 卡死在启动步骤)
484
+ command = `msedge ${argsStr} >/dev/null 2>&1 &`;
479
485
  }
480
486
 
481
487
  console.error(`[浏览器] 启动命令: ${command}`);