tt-help-cli-ycl 1.4.60 → 1.4.61

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-help-cli-ycl",
3
- "version": "1.4.60",
3
+ "version": "1.4.61",
4
4
  "description": "TikTok user & video data scraper - extract ttSeller, verified, locationCreated from HTML source",
5
5
  "type": "module",
6
6
  "bin": {
@@ -83,9 +83,9 @@ function getOnlineClients() {
83
83
 
84
84
  function normalizeCmd(c) {
85
85
  if (typeof c === "string")
86
- return { cmd: c, enabled: true, maxUptimeSeconds: 0, maxMemoryMB: 0 };
86
+ return { cmd: c.replace(/^[▶\n\r\s]+/, "").trim(), enabled: true, maxUptimeSeconds: 0, maxMemoryMB: 0 };
87
87
  return {
88
- cmd: c.cmd || "",
88
+ cmd: (c.cmd || "").replace(/^[▶\n\r\s]+/, "").trim(),
89
89
  enabled: c.enabled !== false,
90
90
  maxUptimeSeconds: c.maxUptimeSeconds || 0,
91
91
  maxMemoryMB: c.maxMemoryMB || 0,
@@ -108,9 +108,14 @@ function getClientCommands(userId) {
108
108
 
109
109
  function setClientCommands(userId, commands) {
110
110
  if (!Array.isArray(commands)) return;
111
+ // 清洗每个命令中的非法前缀
112
+ const cleaned = commands.map((c) => {
113
+ if (typeof c === "string") return c.replace(/^[▶\n\r\s]+/, "").trim();
114
+ return { ...c, cmd: (c.cmd || "").replace(/^[▶\n\r\s]+/, "").trim() };
115
+ });
111
116
  const cfg = loadConfig();
112
117
  if (!cfg.clientCommands) cfg.clientCommands = {};
113
- cfg.clientCommands[userId] = commands;
118
+ cfg.clientCommands[userId] = cleaned;
114
119
  saveConfig(cfg);
115
120
  }
116
121
 
@@ -223,7 +223,8 @@ export class ProcessManager extends EventEmitter {
223
223
  .map((c) => {
224
224
  if (typeof c === "string")
225
225
  c = { cmd: c, maxUptimeSeconds: 0, maxMemoryMB: 0 };
226
- const cmdLine = (c.cmd || "").trim();
226
+ // 清洗:去除可能混入的控制字符、状态图标等
227
+ const cmdLine = (c.cmd || "").replace(/^[▶\n\r\s]+/, "").trim();
227
228
  if (!cmdLine) return null;
228
229
  const id =
229
230
  cmdLine.length > 60 ? cmdLine.substring(0, 60) + "..." : cmdLine;