tt-help-cli-ycl 1.4.163 → 1.4.164

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.163",
3
+ "version": "1.4.164",
4
4
  "description": "TikTok user & video data scraper - extract ttSeller, verified, locationCreated from HTML source",
5
5
  "type": "module",
6
6
  "bin": {
@@ -214,7 +214,33 @@ async function installCoreFromArt(artPath, entry, { log = () => {} } = {}) {
214
214
  * 确保内核二进制就位(多级获取: 本地缓存 → 包内 vendor → 服务器下载 → GitHub 兼底)
215
215
  * @returns {Promise<{ok:boolean, bin?:string, source?:string, error?:string}>}
216
216
  */
217
+ // ── 自定义内核(老 CPU 机器用本机可用内核,如 Verge 的 verge-mihomo.exe) ──
218
+
219
+ /**
220
+ * 自定义内核路径(~/.tt-help.json → clash.corePath):
221
+ * 官方 mihomo 二进制与 CPU 不兼容的机器(如 AMD A8-6410,启动即 0xC0000005),
222
+ * 指定本机已验证可用的内核二进制(例:C:\Program Files\Clash Verge\verge-mihomo.exe)。
223
+ * 指定后跳过下载/sha256 校验,直接用该路径 spawn(-d/-f 仍指向我们的运行目录,配置/日志隔离不变)。
224
+ */
225
+ export function customCorePath() {
226
+ try {
227
+ const cfgPath = join(homedir(), ".tt-help.json");
228
+ if (!existsSync(cfgPath)) return null;
229
+ const cfg = JSON.parse(readFileSync(cfgPath, "utf-8"));
230
+ const p = cfg?.clash?.corePath;
231
+ return p && existsSync(p) ? p : null;
232
+ } catch {
233
+ return null;
234
+ }
235
+ }
236
+
217
237
  export async function ensureBinary({ log = () => {} } = {}) {
238
+ // 0) 自定义内核(clash.corePath,存在即用,跳过下载/校验)
239
+ const custom = customCorePath();
240
+ if (custom) {
241
+ log(`⚙ 使用自定义内核: ${custom}`);
242
+ return { ok: true, bin: custom, source: "custom" };
243
+ }
218
244
  const { bin } = runtimePaths();
219
245
  const entry = VENDOR_MANIFEST[platformKey()];
220
246
  if (!entry) return { ok: false, error: `不支持的平台: ${platformKey()}` };