tt-help-cli-ycl 1.4.168 → 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.
- package/package.json +1 -1
- package/scripts/test-subscription-allocator.mjs +220 -0
- package/scripts/test-subscription-auto-alloc-ui.mjs +208 -0
- package/scripts/test-subscription-auto-alloc.mjs +259 -0
- package/scripts/test-subscription-center-e2e.mjs +134 -0
- package/scripts/test-subscription-center-smoke.mjs +154 -0
- package/scripts/test-subscription-center-ui.mjs +111 -0
- package/scripts/vnc-login.sh +68 -0
- package/src/clash/runtime.js +22 -1
- package/src/cli/info.js +6 -1
- package/src/lib/browser/cdp.js +7 -1
- package/src/watch/public/app.js +586 -15
- package/src/watch/public/index.html +70 -3
- package/src/watch/subscription-allocator.js +255 -0
- package/src/watch/subscription-center.js +590 -0
- package/src/watch/watchdog-server.js +210 -0
- package/src/watchdog/agent.js +5 -0
- package/scripts/test-api-interceptor-429.mjs +0 -122
- package/scripts/test-api-interceptor-captcha.mjs +0 -176
- package/scripts/test-claim-fix.mjs +0 -216
- package/scripts/test-clash-discover.mjs +0 -126
- package/scripts/test-clash-hysteresis.mjs +0 -131
- package/scripts/test-clash-multichannel.mjs +0 -120
- package/scripts/test-client-error-monitor.mjs +0 -261
- package/scripts/test-country-fix.mjs +0 -341
- package/scripts/test-daemon-failover.mjs +0 -301
- package/scripts/test-daemon-switch-history.mjs +0 -141
- package/scripts/test-daemon-whitelist.mjs +0 -308
- package/scripts/test-explore-captcha-wait.mjs +0 -170
- package/scripts/test-photo-post.mjs +0 -156
- package/scripts/test-precheck-perf.mjs +0 -270
- package/scripts/test-precise-index.mjs +0 -114
- package/scripts/test-probe-live.mjs +0 -83
- package/scripts/test-probe.mjs +0 -315
- package/scripts/test-product-fill-cdp.mjs +0 -336
- package/scripts/test-product-fill-db.mjs +0 -216
- package/scripts/test-product-fill-http.mjs +0 -117
- package/scripts/test-proxy-switch-restart.mjs +0 -198
- package/scripts/test-refill-order.mjs +0 -218
- package/scripts/test-sample-all-fail.mjs +0 -142
- package/scripts/test-seller-any-country.mjs +0 -167
- package/scripts/test-stats-smoke.mjs +0 -43
- package/scripts/test-upgrade-spawn.mjs +0 -179
- package/scripts/test-webserver-error-classify.mjs +0 -409
- package/scripts/test-wmi-free-upgrade.mjs +0 -98
- package/src/cli/test-real-attach.js +0 -0
- 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/clash/runtime.js
CHANGED
|
@@ -893,11 +893,32 @@ async function rollbackConfig(content, { index = 1, apiPort, secret } = {}) {
|
|
|
893
893
|
} catch {}
|
|
894
894
|
}
|
|
895
895
|
|
|
896
|
-
/**
|
|
896
|
+
/**
|
|
897
|
+
* 强制刷新 provider(绕过 interval 缓存),让新订阅立即生效。
|
|
898
|
+
* 热加载/接管不会触发 provider 重新拉取:URL 已变但同名缓存未过期(interval 1h 内)时,
|
|
899
|
+
* 内核沿用旧订阅节点,节点数校验会把旧缓存误判为新订阅上线
|
|
900
|
+
* (2026-01-11 生产实锤:i3 换订阅后报应用成功,实际最长 1h 仍是旧机场节点)。
|
|
901
|
+
* 尽力而为:单条失败不报错(机场 URL 暂时不可达等),由后续节点数校验兜底。
|
|
902
|
+
*/
|
|
903
|
+
async function refreshProviders(subs, { apiPort, secret }) {
|
|
904
|
+
const headers = {};
|
|
905
|
+
if (secret) headers.Authorization = `Bearer ${secret}`;
|
|
906
|
+
await Promise.all(
|
|
907
|
+
subs.map((s) =>
|
|
908
|
+
fetch(
|
|
909
|
+
`http://127.0.0.1:${apiPort}/providers/proxies/${encodeURIComponent(s.name)}`,
|
|
910
|
+
{ method: "PUT", headers, signal: AbortSignal.timeout(20_000) },
|
|
911
|
+
).catch(() => {}),
|
|
912
|
+
),
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/** 等待并校验 provider 上线(热应用/接管共用):先强刷 provider 再校验,确保校验的是新订阅 */
|
|
897
917
|
export async function verifyProviders(
|
|
898
918
|
subs,
|
|
899
919
|
{ apiPort = DISCOVER_DEFAULTS.port, secret = DISCOVER_DEFAULTS.secret, log = () => {}, waitMs = 3000 } = {},
|
|
900
920
|
) {
|
|
921
|
+
await refreshProviders(subs, { apiPort, secret });
|
|
901
922
|
await delay(waitMs);
|
|
902
923
|
try {
|
|
903
924
|
const headers = {};
|
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
|
-
|
|
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();
|
package/src/lib/browser/cdp.js
CHANGED
|
@@ -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
|
-
|
|
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}`);
|