@napuketto/loader 0.0.5 → 0.0.6

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.
@@ -1117,6 +1117,8 @@ const LOGIN_STATES = [
1117
1117
  function isLoginState(value) {
1118
1118
  return LOGIN_STATES.includes(value);
1119
1119
  }
1120
+ /** 非 IPC 模式 QR 透出标记行前缀(cli forwardFiltered 解析后终端渲染)。 */
1121
+ const QR_LINE_PREFIX = "NAPUTO_QR ";
1120
1122
  /** 登录参数(NAPUTO_QUICK_UIN 强制指定 / ref 目标 / 默认)。 */
1121
1123
  function buildLoginOpts(Appid, forcedUin, ref) {
1122
1124
  const quickUin = forcedUin ?? ref.targetUin;
@@ -1125,9 +1127,14 @@ function buildLoginOpts(Appid, forcedUin, ref) {
1125
1127
  initTimeoutMs: 2e4,
1126
1128
  ...quickUin !== void 0 ? { quickUin } : {}
1127
1129
  };
1128
- if (env.NAPUTO_IPC === "1") opts["onLoginProgress"] = (progress) => {
1129
- if (progress.qr !== void 0) sendQr(progress.qr.pngBase64, progress.qr.qrcodeUrl);
1130
- if (isLoginState(progress.state)) sendLogin(progress.state, progress.selfInfo);
1130
+ const ipcMode = env.NAPUTO_IPC === "1";
1131
+ opts["onLoginProgress"] = (progress) => {
1132
+ if (progress.qr !== void 0) if (ipcMode) sendQr(progress.qr.pngBase64, progress.qr.qrcodeUrl);
1133
+ else node_process.default.stdout.write(`${QR_LINE_PREFIX}${JSON.stringify({
1134
+ pngBase64: progress.qr.pngBase64,
1135
+ qrcodeUrl: progress.qr.qrcodeUrl
1136
+ })}\n`);
1137
+ if (ipcMode && isLoginState(progress.state)) sendLogin(progress.state, progress.selfInfo);
1131
1138
  };
1132
1139
  return opts;
1133
1140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napuketto/loader",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "NapukettoQQ 引导组件:自建宿主(标准 Node + stub QQNT.dll)dlopen wrapper.node 并启动 kernel,不拉起 QQ / 不注入",
5
5
  "type": "module",
6
6
  "files": [