llonebot-dist 7.12.14 → 7.12.15

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/llbot.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createRequire } from "node:module";
2
2
  import * as path$4 from "node:path";
3
3
  import path, { dirname, join } from "node:path";
4
- import fs, { copyFile, mkdir, readFile, stat, unlink, writeFile } from "node:fs/promises";
5
- import fs$1, { existsSync } from "fs";
6
- import * as fs$6 from "node:fs";
7
- import fs$2, { appendFile, appendFileSync, createReadStream, existsSync as existsSync$1, mkdirSync, promises, stat as stat$1, statSync, watch } from "node:fs";
4
+ import fsPromise, { copyFile, mkdir, readFile, stat, unlink, writeFile } from "node:fs/promises";
5
+ import fs, { existsSync } from "fs";
6
+ import * as fs$5 from "node:fs";
7
+ import fs$1, { appendFile, appendFileSync, createReadStream, existsSync as existsSync$1, mkdirSync, promises, stat as stat$1, statSync, watch } from "node:fs";
8
8
  import os from "node:os";
9
9
  import { Binary, Time, camelize, clone, deduplicate, deepEqual, defineProperty, difference, filterKeys, hyphenate, is, isNonNullable, isNullable, isPlainObject, makeArray, mapValues, noop, omit, pick, remove, valueMap } from "cosmokit";
10
10
  import { Exporter, Factory } from "reggol";
@@ -21,7 +21,7 @@ import http, { STATUS_CODES, createServer, request } from "node:http";
21
21
  import { Http2ServerRequest, constants as constants$1 } from "node:http2";
22
22
  import { Readable, Transform } from "node:stream";
23
23
  import { deflateSync, gunzipSync, gzipSync, inflateSync } from "node:zlib";
24
- import fsPromise, { stat as stat$2, unlink as unlink$1 } from "fs/promises";
24
+ import fsPromise$1, { stat as stat$2, unlink as unlink$1 } from "fs/promises";
25
25
  import { inspect, isDeepStrictEqual } from "node:util";
26
26
  import net, { connect } from "node:net";
27
27
  import https from "node:https";
@@ -3973,7 +3973,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3973
3973
  //#endregion
3974
3974
  //#region node_modules/qrcode/lib/renderer/png.js
3975
3975
  var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
3976
- var fs$11 = __require("fs");
3976
+ var fs$10 = __require("fs");
3977
3977
  var PNG = require_png$1().PNG;
3978
3978
  var Utils = require_utils$1();
3979
3979
  exports.render = function render(qrData, options) {
@@ -4025,7 +4025,7 @@ var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
4025
4025
  called = true;
4026
4026
  cb.apply(null, args);
4027
4027
  };
4028
- const stream = fs$11.createWriteStream(path);
4028
+ const stream = fs$10.createWriteStream(path);
4029
4029
  stream.on("error", done);
4030
4030
  stream.on("close", done);
4031
4031
  exports.renderToFileStream(stream, qrData, options);
@@ -6611,7 +6611,7 @@ async function logSummaryMessage(ctx, message) {
6611
6611
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6612
6612
  module.exports = isexe;
6613
6613
  isexe.sync = sync;
6614
- var fs$10 = __require("fs");
6614
+ var fs$9 = __require("fs");
6615
6615
  function checkPathExt(path, options) {
6616
6616
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
6617
6617
  if (!pathext) return true;
@@ -6628,12 +6628,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6628
6628
  return checkPathExt(path, options);
6629
6629
  }
6630
6630
  function isexe(path, options, cb) {
6631
- fs$10.stat(path, function(er, stat) {
6631
+ fs$9.stat(path, function(er, stat) {
6632
6632
  cb(er, er ? false : checkStat(stat, path, options));
6633
6633
  });
6634
6634
  }
6635
6635
  function sync(path, options) {
6636
- return checkStat(fs$10.statSync(path), path, options);
6636
+ return checkStat(fs$9.statSync(path), path, options);
6637
6637
  }
6638
6638
  }));
6639
6639
  //#endregion
@@ -6641,14 +6641,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6641
6641
  var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6642
6642
  module.exports = isexe;
6643
6643
  isexe.sync = sync;
6644
- var fs$9 = __require("fs");
6644
+ var fs$8 = __require("fs");
6645
6645
  function isexe(path, options, cb) {
6646
- fs$9.stat(path, function(er, stat) {
6646
+ fs$8.stat(path, function(er, stat) {
6647
6647
  cb(er, er ? false : checkStat(stat, options));
6648
6648
  });
6649
6649
  }
6650
6650
  function sync(path, options) {
6651
- return checkStat(fs$9.statSync(path), options);
6651
+ return checkStat(fs$8.statSync(path), options);
6652
6652
  }
6653
6653
  function checkStat(stat, options) {
6654
6654
  return stat.isFile() && checkMode(stat, options);
@@ -9140,7 +9140,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9140
9140
  //#endregion
9141
9141
  //#region node_modules/fluent-ffmpeg/lib/capabilities.js
9142
9142
  var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9143
- var fs$8 = __require("fs");
9143
+ var fs$7 = __require("fs");
9144
9144
  var path$7 = __require("path");
9145
9145
  var async = require_async();
9146
9146
  var utils = require_utils();
@@ -9216,7 +9216,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9216
9216
  proto._getFfmpegPath = function(callback) {
9217
9217
  if ("ffmpegPath" in cache) return callback(null, cache.ffmpegPath);
9218
9218
  async.waterfall([function(cb) {
9219
- if (process.env.FFMPEG_PATH) fs$8.exists(process.env.FFMPEG_PATH, function(exists) {
9219
+ if (process.env.FFMPEG_PATH) fs$7.exists(process.env.FFMPEG_PATH, function(exists) {
9220
9220
  if (exists) cb(null, process.env.FFMPEG_PATH);
9221
9221
  else cb(null, "");
9222
9222
  });
@@ -9247,7 +9247,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9247
9247
  if ("ffprobePath" in cache) return callback(null, cache.ffprobePath);
9248
9248
  async.waterfall([
9249
9249
  function(cb) {
9250
- if (process.env.FFPROBE_PATH) fs$8.exists(process.env.FFPROBE_PATH, function(exists) {
9250
+ if (process.env.FFPROBE_PATH) fs$7.exists(process.env.FFPROBE_PATH, function(exists) {
9251
9251
  cb(null, exists ? process.env.FFPROBE_PATH : "");
9252
9252
  });
9253
9253
  else cb(null, "");
@@ -9265,7 +9265,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9265
9265
  else if (ffmpeg.length) {
9266
9266
  var name = utils.isWindows ? "ffprobe.exe" : "ffprobe";
9267
9267
  var ffprobe = path$7.join(path$7.dirname(ffmpeg), name);
9268
- fs$8.exists(ffprobe, function(exists) {
9268
+ fs$7.exists(ffprobe, function(exists) {
9269
9269
  cb(null, exists ? ffprobe : "");
9270
9270
  });
9271
9271
  } else cb(null, "");
@@ -9290,14 +9290,14 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9290
9290
  if ("flvtoolPath" in cache) return callback(null, cache.flvtoolPath);
9291
9291
  async.waterfall([
9292
9292
  function(cb) {
9293
- if (process.env.FLVMETA_PATH) fs$8.exists(process.env.FLVMETA_PATH, function(exists) {
9293
+ if (process.env.FLVMETA_PATH) fs$7.exists(process.env.FLVMETA_PATH, function(exists) {
9294
9294
  cb(null, exists ? process.env.FLVMETA_PATH : "");
9295
9295
  });
9296
9296
  else cb(null, "");
9297
9297
  },
9298
9298
  function(flvtool, cb) {
9299
9299
  if (flvtool.length) return cb(null, flvtool);
9300
- if (process.env.FLVTOOL2_PATH) fs$8.exists(process.env.FLVTOOL2_PATH, function(exists) {
9300
+ if (process.env.FLVTOOL2_PATH) fs$7.exists(process.env.FLVTOOL2_PATH, function(exists) {
9301
9301
  cb(null, exists ? process.env.FLVTOOL2_PATH : "");
9302
9302
  });
9303
9303
  else cb(null, "");
@@ -9802,7 +9802,7 @@ var require_ffprobe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9802
9802
  //#endregion
9803
9803
  //#region node_modules/fluent-ffmpeg/lib/recipes.js
9804
9804
  var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9805
- var fs$7 = __require("fs");
9805
+ var fs$6 = __require("fs");
9806
9806
  var path$6 = __require("path");
9807
9807
  var PassThrough$4 = __require("stream").PassThrough;
9808
9808
  var async = require_async();
@@ -10008,8 +10008,8 @@ var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10008
10008
  next(null, filenames);
10009
10009
  },
10010
10010
  function createDirectory(filenames, next) {
10011
- fs$7.exists(config.folder, function(exists) {
10012
- if (!exists) fs$7.mkdir(config.folder, function(err) {
10011
+ fs$6.exists(config.folder, function(exists) {
10012
+ if (!exists) fs$6.mkdir(config.folder, function(err) {
10013
10013
  if (err) next(err);
10014
10014
  else next(null, filenames);
10015
10015
  });
@@ -10257,7 +10257,7 @@ function setFFMpegPath(ffmpegPath) {
10257
10257
  path.join(import.meta.dirname, "ffmpeg.exe"),
10258
10258
  process.env["FFMPEG_PATH"] || ""
10259
10259
  ];
10260
- for (const p of paths) if (fs$2.existsSync(p)) {
10260
+ for (const p of paths) if (fs$1.existsSync(p)) {
10261
10261
  import_fluent_ffmpeg.default.setFfmpegPath(p);
10262
10262
  console.log("set ffmpeg successfully", p);
10263
10263
  break;
@@ -11364,7 +11364,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
11364
11364
  };
11365
11365
  //#endregion
11366
11366
  //#region src/version.ts
11367
- var version$2 = "7.12.14";
11367
+ var version$2 = "7.12.15";
11368
11368
  //#endregion
11369
11369
  //#region node_modules/sift/es5m/index.js
11370
11370
  /******************************************************************************
@@ -17022,7 +17022,7 @@ var processQueue = async () => {
17022
17022
  const promises = queue.splice(0, concurrency).map(async ({ filePath, resolve, reject }) => {
17023
17023
  let handle;
17024
17024
  try {
17025
- handle = await fs$6.promises.open(path$4.resolve(filePath), "r");
17025
+ handle = await fs$5.promises.open(path$4.resolve(filePath), "r");
17026
17026
  } catch (err) {
17027
17027
  return reject(err);
17028
17028
  }
@@ -17069,7 +17069,7 @@ function checkUriType(uri) {
17069
17069
  if (uri.startsWith("data:")) return { type: FileUriType.DataURL };
17070
17070
  if (uri.startsWith("http://") || uri.startsWith("https://")) return { type: FileUriType.RemoteURL };
17071
17071
  if (uri.startsWith("file://")) return { type: FileUriType.FileURL };
17072
- if (fs$2.existsSync(uri)) return { type: FileUriType.Path };
17072
+ if (fs$1.existsSync(uri)) return { type: FileUriType.Path };
17073
17073
  return { type: FileUriType.Unknown };
17074
17074
  }
17075
17075
  async function fetchFile(url, headersInit) {
@@ -17099,7 +17099,7 @@ async function uri2local(ctx, uri, needExt) {
17099
17099
  const { type } = checkUriType(uri);
17100
17100
  if (type === FileUriType.FileURL) {
17101
17101
  const filePath = fileURLToPath(uri);
17102
- if (!fs$2.existsSync(filePath)) return {
17102
+ if (!fs$1.existsSync(filePath)) return {
17103
17103
  success: false,
17104
17104
  errMsg: "路径不存在",
17105
17105
  fileName: "",
@@ -17125,12 +17125,12 @@ async function uri2local(ctx, uri, needExt) {
17125
17125
  const res = await fetchFile(uri);
17126
17126
  let fileName = randomUUID();
17127
17127
  let filePath = path.join(TEMP_DIR, fileName);
17128
- await fs.writeFile(filePath, res.data);
17128
+ await fsPromise.writeFile(filePath, res.data);
17129
17129
  if (needExt) {
17130
17130
  const ext = (await getFileType(filePath)).ext;
17131
17131
  fileName += `.${ext}`;
17132
17132
  const newPath = `${filePath}.${ext}`;
17133
- await fs.rename(filePath, newPath);
17133
+ await fsPromise.rename(filePath, newPath);
17134
17134
  filePath = newPath;
17135
17135
  }
17136
17136
  return {
@@ -17153,11 +17153,11 @@ async function uri2local(ctx, uri, needExt) {
17153
17153
  let filename = randomUUID();
17154
17154
  let filePath = path.join(TEMP_DIR, filename);
17155
17155
  const base64 = uri.replace(/^base64:\/\//, "");
17156
- await fs.writeFile(filePath, base64, "base64");
17156
+ await fsPromise.writeFile(filePath, base64, "base64");
17157
17157
  if (needExt) {
17158
17158
  const ext = (await getFileType(filePath)).ext;
17159
17159
  filename += `.${ext}`;
17160
- await fs.rename(filePath, `${filePath}.${ext}`);
17160
+ await fsPromise.rename(filePath, `${filePath}.${ext}`);
17161
17161
  filePath = `${filePath}.${ext}`;
17162
17162
  }
17163
17163
  return {
@@ -17174,11 +17174,11 @@ async function uri2local(ctx, uri, needExt) {
17174
17174
  let filename = randomUUID();
17175
17175
  const [, _type, base64] = capture;
17176
17176
  let filePath = path.join(TEMP_DIR, filename);
17177
- await fs.writeFile(filePath, base64, "base64");
17177
+ await fsPromise.writeFile(filePath, base64, "base64");
17178
17178
  if (needExt) {
17179
17179
  const ext = (await getFileType(filePath)).ext;
17180
17180
  filename += `.${ext}`;
17181
- await fs.rename(filePath, `${filePath}.${ext}`);
17181
+ await fsPromise.rename(filePath, `${filePath}.${ext}`);
17182
17182
  filePath = `${filePath}.${ext}`;
17183
17183
  }
17184
17184
  return {
@@ -17249,13 +17249,13 @@ function getSha1HexFromBuffer(buf) {
17249
17249
  }
17250
17250
  async function getMd5HexFromFile(filePath) {
17251
17251
  const hash = createHash("md5");
17252
- const stream = fs$2.createReadStream(filePath);
17252
+ const stream = fs$1.createReadStream(filePath);
17253
17253
  for await (const chunk of stream) hash.update(chunk);
17254
17254
  return hash.digest("hex");
17255
17255
  }
17256
17256
  async function getSha1HexFromFile(filePath) {
17257
17257
  const hash = createHash("sha1");
17258
- const stream = fs$2.createReadStream(filePath);
17258
+ const stream = fs$1.createReadStream(filePath);
17259
17259
  for await (const chunk of stream) hash.update(chunk);
17260
17260
  return hash.digest("hex");
17261
17261
  }
@@ -17264,13 +17264,13 @@ function getMd5BufferFromBuffer(buf) {
17264
17264
  }
17265
17265
  async function getMd5BufferFromFile(filePath) {
17266
17266
  const hash = createHash("md5");
17267
- const stream = fs$2.createReadStream(filePath);
17267
+ const stream = fs$1.createReadStream(filePath);
17268
17268
  for await (const chunk of stream) hash.update(chunk);
17269
17269
  return hash.digest();
17270
17270
  }
17271
17271
  async function getSha1BufferFromFile(filePath) {
17272
17272
  const hash = createHash("sha1");
17273
- const stream = fs$2.createReadStream(filePath);
17273
+ const stream = fs$1.createReadStream(filePath);
17274
17274
  for await (const chunk of stream) hash.update(chunk);
17275
17275
  return hash.digest();
17276
17276
  }
@@ -17506,7 +17506,7 @@ async function calculateSha1StreamBytes(filePath) {
17506
17506
  let bytesRead = 0;
17507
17507
  let nextBlockBoundary = blockSize;
17508
17508
  const byteArrayList = [];
17509
- const readable = fs$2.createReadStream(filePath);
17509
+ const readable = fs$1.createReadStream(filePath);
17510
17510
  for await (const chunk of readable) {
17511
17511
  let buf;
17512
17512
  if (tail.length > 0) {
@@ -17531,7 +17531,7 @@ async function calculateSha1StreamBytes(filePath) {
17531
17531
  }
17532
17532
  async function readAndHash10M(filePath) {
17533
17533
  const maxSize = 10002432;
17534
- const fd = await fs.open(filePath, "r");
17534
+ const fd = await fsPromise.open(filePath, "r");
17535
17535
  const buffer = Buffer.allocUnsafe(maxSize);
17536
17536
  const { bytesRead } = await fd.read(buffer, 0, maxSize, 0);
17537
17537
  await fd.close();
@@ -17573,13 +17573,13 @@ var TriSha1 = class {
17573
17573
  };
17574
17574
  async function calculateTriSha1(filePath, fileSize) {
17575
17575
  const hash = new TriSha1(fileSize);
17576
- const stream = fs$2.createReadStream(filePath);
17576
+ const stream = fs$1.createReadStream(filePath);
17577
17577
  for await (const chunk of stream) hash.update(chunk);
17578
17578
  return hash.finalize();
17579
17579
  }
17580
17580
  var defaultVideoThumb = Buffer.from("/9j/4AAQSkZJRgABAQAAAQABAAD//gAXR2VuZXJhdGVkIGJ5IFNuaXBhc3Rl/9sAhAAKBwcIBwYKCAgICwoKCw4YEA4NDQ4dFRYRGCMfJSQiHyIhJis3LyYpNCkhIjBBMTQ5Oz4+PiUuRElDPEg3PT47AQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAF/APADAREAAhEBAxEB/8QBogAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoLEAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZG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BaQDgaAFBoAcDTAdmgQuaADNAgzQBPWZqFAgoAWgBaYC0CGmmBG1AyM0ANJoATNACZoAXNABmgAzQAUAJQAhoAQ0xDTQISmAUALQAUgHA0AKDTAdmgQuaBBQAtAFiszQKACgBaAFFMAoEIaYEbUDI2oAYaAEoASgAzQAuaACgAoAKAENMQ00AJTEFAhKACgAoAXNACg0AOBoAWgQtAC0AWazNAoAKACgBaYBQIQ0AMNMYw0AMIoAbQAlMAoAKACgAzSAKYhKAENACUxBQIKACgBKACgBaAHCgQ4UALQAUAWqzNAoAKACgApgFACGgQ00xjTQAwigBCKAG4pgJQAlABQAUCCgBKACgBKYgoEFABQISgAoAWgBRQA4UALQAUCLdZmoUAFABQAlMAoASgBDQA00wENACYoATFMBpFADSKAEoEJQAUAFABQAlMQtAgoASgQUAJQAUAKKAHCgBaBBQBbrM1CgAoAKACmAUAJQAlADaYBQAlACYpgIRQA0igBpFAhtABQAUAFMAoEFABQIKAEoASgQUALQAooAWgQUAW81mbC0CCgApgFACUAIaAEpgJQAUAFABQAhFMBpFADSKAGkUCExQAYoAMUAGKADFMQYoAMUCExSATFABQIKYBQAtABQIt5qDYM0ALmgQtIApgIaAENADaACmAlAC0ALQAUwGkUANIoAaRQAmKBBigAxQAYoAMUAGKBBigBMUAJigQmKAExTAKBC0AFAFnNQaig0AKDQAtAgoASgBDQAlMBKACgAFADhQAtMBCKAGkUAIRQAmKADFABigQmKADFACYoAXFABigQmKAExQAmKBCYpgJigAoAnzUGgZoAcDQAuaBC0AJQAhoASmAlABQAtADhQAtMAoATFACEUAJigAxQAYoATFAhMUAFABQAuKADFABigBpWgBCKBCYpgJigB+ag0DNADgaBDgaAFzQITNACUAJTAKACgBRQAopgOoAWgBKAEoAKACgAoASgBpoEJQAooAWgBaBhigBMUCEIoAQigBMUAJSLCgBQaBDgaQC5oEFACUwCgBKACmAtADhQA4UALQAUAJQAUAJQAUAJQAhoENoAWgBRQAooGLQAUAGKAGkUAIRQIZSKEoGKKBDhQAU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EGaBhmgAoAkpGgUCCgQooELQIKYhKACgBKAGmgBpoGMNAxDQAlAwzQIUUAOFAhwoAcKBC0AJQAhoGNNACUAFABQAZoAXNABQAUAS0ixKACgQoNAhaYgoEFACUABoAaaAGmgYw0DENAxtABQAooEOFADhQIcKAFoASgBDQAhoGJQAUAFACUALQIKBi0CJDSLEoATNAhc0CHZpiCgQUAJQIKBjTQAhoGNNAxpoATFABigBQKAHCgBwoAWgAoAKACgBKAEoASgAoASgBaAAUAOoEONIoaTQAZoAUGmIUGgQtAgzQISgAoAQ0DGmgYlAxKACgAxQAtACigBRQAtAxaACgAoATFABigBCKAG0CEoAWgBRTAUUAf//Z", "base64");
17581
17581
  async function getVideoInfo(filePath) {
17582
- const size = fs$2.statSync(filePath).size;
17582
+ const size = fs$1.statSync(filePath).size;
17583
17583
  return new Promise((resolve, reject) => {
17584
17584
  (0, import_fluent_ffmpeg.default)(filePath).ffprobe((err, metadata) => {
17585
17585
  if (err) reject(err);
@@ -17656,7 +17656,7 @@ function convert(ctx, input, options, outputPath) {
17656
17656
  });
17657
17657
  }
17658
17658
  async function encodeSilk(ctx, filePath) {
17659
- const file = await fs.readFile(filePath);
17659
+ const file = await fsPromise.readFile(filePath);
17660
17660
  if (!isSilk(file)) {
17661
17661
  ctx.logger.info(`语音文件${filePath}需要转换成silk`);
17662
17662
  let result;
@@ -17675,7 +17675,7 @@ async function encodeSilk(ctx, filePath) {
17675
17675
  "-f s16le"
17676
17676
  ] }), 24e3);
17677
17677
  const pttPath = path.join(TEMP_DIR, randomUUID());
17678
- await fs.writeFile(pttPath, result.data);
17678
+ await fsPromise.writeFile(pttPath, result.data);
17679
17679
  ctx.logger.info(`语音文件${filePath}转换成功!`, pttPath, `时长:`, result.duration);
17680
17680
  return {
17681
17681
  converted: true,
@@ -17698,11 +17698,11 @@ async function encodeSilk(ctx, filePath) {
17698
17698
  }
17699
17699
  }
17700
17700
  async function decodeSilk(ctx, inputFilePath, outFormat) {
17701
- const { data } = await decode(await fs.readFile(inputFilePath), 24e3);
17701
+ const { data } = await decode(await fsPromise.readFile(inputFilePath), 24e3);
17702
17702
  const tmpPath = path.join(TEMP_DIR, path.basename(inputFilePath));
17703
17703
  const outFilePath = tmpPath + `.${outFormat}`;
17704
17704
  const pcmFilePath = tmpPath + ".pcm";
17705
- await fs.writeFile(pcmFilePath, data);
17705
+ await fsPromise.writeFile(pcmFilePath, data);
17706
17706
  return convert(ctx, pcmFilePath, { input: [
17707
17707
  "-f s16le",
17708
17708
  "-ar 24000",
@@ -18378,7 +18378,7 @@ async function handleMsg(ctx, msg, quickAction) {
18378
18378
  async function handleFriendRequest$1(ctx, request, quickAction) {
18379
18379
  if (!isNullable(quickAction.approve)) {
18380
18380
  await ctx.ntFriendApi.approvalFriendRequest(request.flag, quickAction.approve).catch((e) => ctx.logger.error(e));
18381
- if (!isNullable(quickAction.remark)) ctx.ntFriendApi.setBuddyRemark(request.flag, quickAction.remark).catch((e) => ctx.logger.error(e));
18381
+ if (!isNullable(quickAction.remark)) await ctx.ntFriendApi.setFriendRemark(request.flag, quickAction.remark).catch((e) => ctx.logger.error(e));
18382
18382
  }
18383
18383
  }
18384
18384
  async function handleGroupRequest(ctx, request, quickAction) {
@@ -23781,6 +23781,71 @@ var Oidb;
23781
23781
  jumpUrl: ProtoField(3, "string")
23782
23782
  });
23783
23783
  _Oidb.GetFriendRecommendContactArkResp = ProtoMessage.of({ ark: ProtoField(1, "string") });
23784
+ _Oidb.SetFriendRemarkReq = ProtoMessage.of({
23785
+ uid: ProtoField(1, "string"),
23786
+ remark: ProtoField(2, "string")
23787
+ });
23788
+ _Oidb.DeleteFriendReq = ProtoMessage.of({ field1: ProtoField(1, {
23789
+ targetUid: ProtoField(1, "string"),
23790
+ field2: ProtoField(2, {
23791
+ field1: ProtoField(1, "uint32"),
23792
+ field2: ProtoField(2, "uint32"),
23793
+ field3: ProtoField(3, {
23794
+ field1: ProtoField(1, "uint32"),
23795
+ field2: ProtoField(2, "uint32"),
23796
+ field3: ProtoField(3, "uint32")
23797
+ })
23798
+ }),
23799
+ block: ProtoField(3, "bool"),
23800
+ bothDelete: ProtoField(4, "bool")
23801
+ }) });
23802
+ _Oidb.SetFriendCategoryReq = ProtoMessage.of({
23803
+ uid: ProtoField(1, "string"),
23804
+ categoryId: ProtoField(2, "uint32")
23805
+ });
23806
+ _Oidb.FetchFriendRequestsReq = ProtoMessage.of({
23807
+ version: ProtoField(1, "int32"),
23808
+ type: ProtoField(3, "int32"),
23809
+ selfUid: ProtoField(4, "string"),
23810
+ startIndex: ProtoField(5, "int32"),
23811
+ reqNum: ProtoField(6, "int32"),
23812
+ getFlag: ProtoField(8, "int32"),
23813
+ startTime: ProtoField(9, "int32"),
23814
+ needCommFriend: ProtoField(12, "int32"),
23815
+ field22: ProtoField(22, "int32")
23816
+ });
23817
+ _Oidb.FetchFriendRequestsResp = ProtoMessage.of({
23818
+ field1: ProtoField(1, "int32"),
23819
+ field2: ProtoField(2, "int32"),
23820
+ info: ProtoField(3, {
23821
+ field2: ProtoField(2, "int32"),
23822
+ count: ProtoField(3, "int32"),
23823
+ requests: ProtoField(7, {
23824
+ selfUid: ProtoField(1, "string"),
23825
+ friendUid: ProtoField(2, "string"),
23826
+ state: ProtoField(3, "int32"),
23827
+ timestamp: ProtoField(4, "uint32"),
23828
+ comment: ProtoField(5, "string"),
23829
+ source: ProtoField(6, "string"),
23830
+ sourceId: ProtoField(7, "int32"),
23831
+ subSourceId: ProtoField(8, "int32"),
23832
+ isInitiator: ProtoField(20, "bool")
23833
+ }, "repeated")
23834
+ })
23835
+ });
23836
+ _Oidb.FetchFilteredFriendRequestsReq = ProtoMessage.of({
23837
+ field1: ProtoField(1, "int32"),
23838
+ field2: ProtoField(2, { count: ProtoField(1, "int32") })
23839
+ });
23840
+ _Oidb.FetchFilteredFriendRequestsResp = ProtoMessage.of({ info: ProtoField(2, { requests: ProtoField(1, {
23841
+ sourceUid: ProtoField(1, "string"),
23842
+ sourceNickname: ProtoField(2, "string"),
23843
+ comment: ProtoField(5, "string"),
23844
+ source: ProtoField(6, "string"),
23845
+ warningInfo: ProtoField(7, "string"),
23846
+ timestamp: ProtoField(8, "uint32"),
23847
+ groupCode: ProtoField(9, "uint32")
23848
+ }, "repeated") }) });
23784
23849
  })(Oidb || (Oidb = {}));
23785
23850
  //#endregion
23786
23851
  //#region src/ntqqapi/proto/msg.ts
@@ -24677,10 +24742,7 @@ var SetFriendAddRequest = class extends BaseAction {
24677
24742
  });
24678
24743
  async _handle(payload) {
24679
24744
  await this.ctx.ntFriendApi.approvalFriendRequest(payload.flag, payload.approve);
24680
- if (payload.remark) {
24681
- const res = await this.ctx.ntFriendApi.setBuddyRemark(payload.flag, payload.remark);
24682
- if (res.result !== 0) throw new Error(res.errMsg);
24683
- }
24745
+ if (payload.remark) await this.ctx.ntFriendApi.setFriendRemark(payload.flag, payload.remark);
24684
24746
  return null;
24685
24747
  }
24686
24748
  };
@@ -24969,17 +25031,17 @@ var DownloadFile = class extends BaseAction {
24969
25031
  const isRandomName = !payload.name;
24970
25032
  const name = payload.name ? path.basename(payload.name) : randomUUID();
24971
25033
  const filePath = path.join(TEMP_DIR, name);
24972
- if (payload.base64) await fsPromise.writeFile(filePath, payload.base64, "base64");
25034
+ if (payload.base64) await fsPromise$1.writeFile(filePath, payload.base64, "base64");
24973
25035
  else if (payload.url) {
24974
25036
  const headers = this.getHeaders(payload.headers);
24975
25037
  const res = await fetchFile(payload.url, headers);
24976
- await fsPromise.writeFile(filePath, res.data);
25038
+ await fsPromise$1.writeFile(filePath, res.data);
24977
25039
  } else throw new Error("不存在任何文件, 无法下载");
24978
- if (fs$1.existsSync(filePath)) {
25040
+ if (fs.existsSync(filePath)) {
24979
25041
  if (isRandomName) {
24980
25042
  const md5 = await getMd5HexFromFile(filePath);
24981
25043
  const newPath = path.join(TEMP_DIR, md5);
24982
- await fsPromise.rename(filePath, newPath);
25044
+ await fsPromise$1.rename(filePath, newPath);
24983
25045
  return { file: newPath };
24984
25046
  }
24985
25047
  return { file: filePath };
@@ -25827,8 +25889,7 @@ var DeleteFriend$1 = class extends BaseAction {
25827
25889
  const uin = payload.user_id.toString();
25828
25890
  const uid = await this.ctx.ntUserApi.getUidByUin(uin);
25829
25891
  if (!uid) throw new Error("无法获取用户信息");
25830
- const res = await this.ctx.ntFriendApi.delBuddy(uid);
25831
- if (res.result !== 0) throw new Error(res.errMsg);
25892
+ await this.ctx.ntFriendApi.deleteFriend(uid);
25832
25893
  return null;
25833
25894
  }
25834
25895
  };
@@ -25966,8 +26027,7 @@ var SetFriendCategory = class extends BaseAction {
25966
26027
  async _handle(payload) {
25967
26028
  const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString());
25968
26029
  if (!uid) throw new Error("无法获取好友信息");
25969
- const res = await this.ctx.ntFriendApi.setBuddyCategory(uid, +payload.category_id);
25970
- if (res.result !== 0) throw new Error(res.errMsg);
26030
+ await this.ctx.ntFriendApi.setFriendCategory(uid, +payload.category_id);
25971
26031
  return null;
25972
26032
  }
25973
26033
  };
@@ -25982,8 +26042,7 @@ var SetFriendRemark = class extends BaseAction {
25982
26042
  async _handle(payload) {
25983
26043
  const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString());
25984
26044
  if (!uid) throw new Error("无法获取好友信息");
25985
- const res = await this.ctx.ntFriendApi.setBuddyRemark(uid, payload.remark);
25986
- if (res.result !== 0) throw new Error(res.errMsg);
26045
+ await this.ctx.ntFriendApi.setFriendRemark(uid, payload.remark);
25987
26046
  return null;
25988
26047
  }
25989
26048
  };
@@ -26502,17 +26561,17 @@ var GetDoubtFriendsAddRequest = class extends BaseAction {
26502
26561
  actionName = ActionName.GetDoubtFriendsAddRequest;
26503
26562
  payloadSchema = lib_default$1.object({ count: lib_default$1.union([Number, String]).default(50) });
26504
26563
  async _handle(payload) {
26505
- const res = await this.ctx.ntFriendApi.getDoubtBuddyReq(+payload.count);
26506
- return await Promise.all(res.doubtList.map(async (e) => {
26564
+ const res = await this.ctx.ntFriendApi.getDoubtFriendRequests(+payload.count);
26565
+ return await Promise.all(res.map(async (e) => {
26507
26566
  return {
26508
- flag: e.uid,
26509
- uin: await this.ctx.ntUserApi.getUinByUid(e.uid),
26510
- nick: e.nick,
26567
+ flag: e.sourceUid,
26568
+ uin: await this.ctx.ntUserApi.getUinByUid(e.sourceUid),
26569
+ nick: e.sourceNickname,
26511
26570
  source: e.source,
26512
- reason: e.reason,
26513
- msg: e.msg,
26514
- group_code: e.groupCode,
26515
- time: e.reqTime,
26571
+ reason: e.warningInfo,
26572
+ msg: e.comment,
26573
+ group_code: e.groupCode.toString(),
26574
+ time: e.timestamp.toString(),
26516
26575
  type: "doubt"
26517
26576
  };
26518
26577
  }));
@@ -28909,8 +28968,7 @@ var handleFriendRequest = async (ctx, payload) => {
28909
28968
  var deleteFriend = async (ctx, payload) => {
28910
28969
  const uid = await ctx.ntUserApi.getUidByUin(payload.user_id);
28911
28970
  if (!uid) throw new Error("无法获取用户信息");
28912
- const res = await ctx.ntFriendApi.delBuddy(uid);
28913
- if (res.result !== 0) throw new Error(res.errMsg);
28971
+ await ctx.ntFriendApi.deleteFriend(uid);
28914
28972
  return {};
28915
28973
  };
28916
28974
  //#endregion
@@ -43473,7 +43531,7 @@ async function download(url, headers) {
43473
43531
  return Buffer.from(bytes);
43474
43532
  }
43475
43533
  async function resolveMilkyUri(uri) {
43476
- if (uri.startsWith("file://")) return await fs.readFile(fileURLToPath(uri));
43534
+ if (uri.startsWith("file://")) return await fsPromise.readFile(fileURLToPath(uri));
43477
43535
  if (uri.startsWith("http://") || uri.startsWith("https://")) return await download(uri);
43478
43536
  if (uri.startsWith("base64://")) return Buffer.from(uri.slice(9), "base64");
43479
43537
  throw new Error(`Unsupported URI scheme: ${uri}`);
@@ -43581,7 +43639,7 @@ var SystemApi = [
43581
43639
  return Ok({ member: transformGroupMember(await ctx.ntGroupApi.getGroupMember(groupCode, memberUid, payload.no_cache), payload.group_id) });
43582
43640
  }),
43583
43641
  defineApi("get_peer_pins", zod_default.object({}), GetPeerPinsOutput, async (ctx) => {
43584
- const result = await ctx.ntSystemApi.getPins();
43642
+ const result = await ctx.ntMsgApi.getPins();
43585
43643
  return Ok({
43586
43644
  friends: await Promise.all(result.friends.map(async (e) => {
43587
43645
  const info = await ctx.ntFriendApi.getFriendInfoByUid(e.uid, false);
@@ -48188,34 +48246,30 @@ var FriendApi = [
48188
48246
  defineApi("delete_friend", DeleteFriendInput, zod_default.object({}), async (ctx, payload) => {
48189
48247
  const uid = await ctx.ntUserApi.getUidByUin(payload.user_id.toString());
48190
48248
  if (!uid) return Failed(-404, "User not found");
48191
- const result = await ctx.ntFriendApi.delBuddy(uid);
48192
- if (result.result !== 0) return Failed(-500, result.errMsg);
48249
+ await ctx.ntFriendApi.deleteFriend(uid);
48193
48250
  return Ok({});
48194
48251
  }),
48195
48252
  defineApi("get_friend_requests", GetFriendRequestsInput, GetFriendRequestsOutput, async (ctx, payload) => {
48196
48253
  if (payload.is_filtered) {
48197
- const result = await ctx.ntFriendApi.getDoubtBuddyReq(payload.limit);
48198
- return Ok({ requests: await Promise.all(result.doubtList.map(async (e) => {
48199
- return {
48200
- time: Number(e.reqTime),
48201
- initiator_id: Number(await ctx.ntUserApi.getUinByUid(e.uid)),
48202
- initiator_uid: e.uid,
48203
- target_user_id: Number(selfInfo.uin),
48204
- target_user_uid: selfInfo.uid,
48205
- state: "pending",
48206
- comment: e.msg,
48207
- via: e.source,
48208
- is_filtered: true
48209
- };
48210
- })) });
48254
+ const result = await ctx.ntFriendApi.getDoubtFriendRequests(payload.limit);
48255
+ return Ok({ requests: await Promise.all(result.map(async (e) => ({
48256
+ time: e.timestamp,
48257
+ initiator_id: Number(await ctx.ntUserApi.getUinByUid(e.sourceUid)),
48258
+ initiator_uid: e.sourceUid,
48259
+ target_user_id: Number(selfInfo.uin),
48260
+ target_user_uid: selfInfo.uid,
48261
+ state: "pending",
48262
+ comment: e.comment,
48263
+ via: e.source,
48264
+ is_filtered: true
48265
+ }))) });
48211
48266
  } else {
48212
- let buddyReqs = (await ctx.ntFriendApi.getBuddyReq()).buddyReqs;
48213
- if (buddyReqs.length > payload.limit) buddyReqs = buddyReqs.slice(0, payload.limit);
48214
- return Ok({ requests: await Promise.all(buddyReqs.map(async (e) => {
48267
+ const result = await ctx.ntFriendApi.getFriendRequests(payload.limit);
48268
+ return Ok({ requests: await Promise.all(result.map(async (e) => {
48215
48269
  const friendId = Number(await ctx.ntUserApi.getUinByUid(e.friendUid));
48216
48270
  const selfId = Number(selfInfo.uin);
48217
48271
  return {
48218
- time: Number(e.reqTime),
48272
+ time: e.timestamp,
48219
48273
  initiator_id: e.isInitiator ? selfId : friendId,
48220
48274
  initiator_uid: e.isInitiator ? selfInfo.uid : e.friendUid,
48221
48275
  target_user_id: e.isInitiator ? friendId : selfId,
@@ -48223,14 +48277,16 @@ var FriendApi = [
48223
48277
  state: {
48224
48278
  [BuddyReqType.PeerInitiator]: "pending",
48225
48279
  [BuddyReqType.MeInitiatorWaitPeerConfirm]: "pending",
48226
- [BuddyReqType.PeerAgreed]: "accepted",
48227
48280
  [BuddyReqType.MeAgreed]: "accepted",
48281
+ [BuddyReqType.MeAgreedAndAdded]: "accepted",
48282
+ [BuddyReqType.PeerAgreed]: "accepted",
48283
+ [BuddyReqType.PeerAgreedAndAdded]: "accepted",
48228
48284
  [BuddyReqType.PeerRefused]: "rejected",
48229
48285
  [BuddyReqType.MeRefused]: "rejected"
48230
- }[e.reqType] ?? "pending",
48231
- comment: e.extWords,
48232
- via: e.addSource ?? "",
48233
- is_filtered: e.isDoubt
48286
+ }[e.state] ?? "pending",
48287
+ comment: e.comment,
48288
+ via: e.source,
48289
+ is_filtered: false
48234
48290
  };
48235
48291
  })) });
48236
48292
  }
@@ -53063,14 +53119,15 @@ var NTQQFriendApi = class extends Service {
53063
53119
  super(ctx, "ntFriendApi");
53064
53120
  this.ctx = ctx;
53065
53121
  }
53066
- async approvalFriendRequest(friendUid, accept) {
53067
- await this.ctx.pmhq.setFriendRequest(friendUid, accept ? 3 : 5);
53068
- }
53069
53122
  async getFriendList(forceUpdate) {
53070
53123
  if (forceUpdate || this.friendsCache.length === 0) {
53071
53124
  const res = await this.ctx.pmhq.fetchFriends();
53072
53125
  this.friendsCache = res.friendList.map((friend) => {
53073
53126
  const biz = friend.subBiz.get(1);
53127
+ let statusId = biz.numData.get(27372);
53128
+ if (statusId >= 268435456) statusId -= 268435456;
53129
+ if (statusId > 14878464) statusId -= 14878464;
53130
+ if (statusId === 0) statusId = 2;
53074
53131
  return {
53075
53132
  uid: friend.uid,
53076
53133
  uin: friend.uin,
@@ -53083,7 +53140,8 @@ var NTQQFriendApi = class extends Service {
53083
53140
  sex: biz.numData.get(20009),
53084
53141
  birthdayYear: biz.data.get(20031)[0] << 8 | biz.data.get(20031)[1],
53085
53142
  birthdayMonth: biz.data.get(20031)[2],
53086
- birthdayDay: biz.data.get(20031)[3]
53143
+ birthdayDay: biz.data.get(20031)[3],
53144
+ status: statusId * 10
53087
53145
  };
53088
53146
  });
53089
53147
  this.categoriesCache.clear();
@@ -53133,42 +53191,32 @@ var NTQQFriendApi = class extends Service {
53133
53191
  const { ark } = await this.ctx.pmhq.getFriendRecommendContactArk(uin);
53134
53192
  return ark;
53135
53193
  }
53136
- async setBuddyRemark(uid, remark = "") {
53137
- return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/setBuddyRemark", [{
53138
- uid,
53139
- remark
53140
- }]);
53194
+ async setFriendRemark(uid, remark = "") {
53195
+ return await this.ctx.pmhq.setFriendRemark(uid, remark);
53141
53196
  }
53142
- async delBuddy(friendUid) {
53143
- return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/delBuddy", [{
53144
- friendUid,
53145
- tempBlock: false,
53146
- tempBothDel: true
53147
- }]);
53197
+ async deleteFriend(targetUid, block = false, bothDelete = true) {
53198
+ return await this.ctx.pmhq.deleteFriend(targetUid, block, bothDelete);
53148
53199
  }
53149
- async setBuddyCategory(uid, categoryId) {
53150
- return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/setBuddyCategory", [uid, categoryId]);
53200
+ async setFriendCategory(uid, categoryId) {
53201
+ return await this.ctx.pmhq.setFriendCategory(uid, categoryId);
53151
53202
  }
53152
53203
  async clearBuddyReqUnreadCnt() {
53153
53204
  return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/clearBuddyReqUnreadCnt", []);
53154
53205
  }
53155
- async getDoubtBuddyReq(reqNum) {
53156
- const reqId = Date.now().toString();
53157
- return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/getDoubtBuddyReq", [
53158
- reqId,
53159
- reqNum,
53160
- ""
53161
- ], {
53162
- resultCmd: "nodeIKernelBuddyListener/onDoubtBuddyReqChange",
53163
- resultCb: (payload) => payload.reqId === reqId
53164
- });
53206
+ async getFriendRequests(limit) {
53207
+ const { info } = await this.ctx.pmhq.fetchFriendRequests(selfInfo.uid, limit);
53208
+ return info.requests;
53209
+ }
53210
+ async getDoubtFriendRequests(limit) {
53211
+ const { info } = await this.ctx.pmhq.fetchFilteredFriendRequests(limit);
53212
+ return info.requests;
53213
+ }
53214
+ async approvalFriendRequest(friendUid, accept) {
53215
+ await this.ctx.pmhq.setFriendRequest(friendUid, accept ? 3 : 5);
53165
53216
  }
53166
53217
  async approvalDoubtFriendRequest(requestUid) {
53167
53218
  return await this.ctx.pmhq.setFilteredFriendRequestReq(selfInfo.uid, requestUid);
53168
53219
  }
53169
- async getBuddyReq() {
53170
- return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/getBuddyReq", [], { resultCmd: "nodeIKernelBuddyListener/onBuddyReqChange" });
53171
- }
53172
53220
  async getCategoryById(categoryId) {
53173
53221
  return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/getCategoryById", [categoryId]);
53174
53222
  }
@@ -53880,6 +53928,9 @@ var NTQQMsgApi = class extends Service {
53880
53928
  toUid
53881
53929
  ]);
53882
53930
  }
53931
+ async getPins() {
53932
+ return await this.ctx.pmhq.fetchPins();
53933
+ }
53883
53934
  };
53884
53935
  //#endregion
53885
53936
  //#region src/common/utils/request.ts
@@ -54295,7 +54346,7 @@ var NTQQWebApi = class extends Service {
54295
54346
  const iBatchID = Math.floor(Date.now() / 1e3);
54296
54347
  for (let i = 0; i < filePathList.length; i++) {
54297
54348
  const filePath = filePathList[i];
54298
- const fileBuffer = await fs.readFile(filePath);
54349
+ const fileBuffer = await fsPromise.readFile(filePath);
54299
54350
  const fileSize = fileBuffer.length;
54300
54351
  const fileType = await fileTypeFromBuffer(fileBuffer);
54301
54352
  const timestamp = Math.floor(Date.now() / 1e3);
@@ -54480,7 +54531,7 @@ var NTQQWebApi = class extends Service {
54480
54531
  }
54481
54532
  if (sVid) {
54482
54533
  const filePath = await createThumb(this.ctx, filePathList[i]);
54483
- const fileBuffer = await fs.readFile(filePath);
54534
+ const fileBuffer = await fsPromise.readFile(filePath);
54484
54535
  const fileSize = fileBuffer.length;
54485
54536
  const timestamp = Math.floor(Date.now() / 1e3);
54486
54537
  const checksum = getMd5HexFromBuffer(fileBuffer);
@@ -54648,9 +54699,6 @@ var NTQQSystemApi = class extends Service {
54648
54699
  async scanQRCode(path) {
54649
54700
  return await this.ctx.pmhq.invoke("nodeIKernelNodeMiscService/scanQBar", [path]);
54650
54701
  }
54651
- async getPins() {
54652
- return await this.ctx.pmhq.fetchPins();
54653
- }
54654
54702
  };
54655
54703
  //#endregion
54656
54704
  //#region node_modules/get-port/index.js
@@ -55975,7 +56023,7 @@ var Config = class extends Service {
55975
56023
  this.logger.info("配置文件位于", this.configPath);
55976
56024
  this.config = this.get();
55977
56025
  if (this.configPath) {
55978
- fs$2.watchFile(this.configPath, {
56026
+ fs$1.watchFile(this.configPath, {
55979
56027
  persistent: true,
55980
56028
  interval: 1e3
55981
56029
  }, () => {
@@ -55993,7 +56041,7 @@ var Config = class extends Service {
55993
56041
  }
55994
56042
  getDefaultConfig() {
55995
56043
  const _defaultConfig = { ...defaultConfig };
55996
- const defaultConfigFromFile = fs$2.readFileSync(this.defaultConfigPath, "utf-8");
56044
+ const defaultConfigFromFile = fs$1.readFileSync(this.defaultConfigPath, "utf-8");
55997
56045
  try {
55998
56046
  const parsedDefaultConfig = import_dist.default.parse(defaultConfigFromFile);
55999
56047
  Object.assign(_defaultConfig, parsedDefaultConfig);
@@ -56004,12 +56052,12 @@ var Config = class extends Service {
56004
56052
  }
56005
56053
  reloadConfig() {
56006
56054
  if (!this.configPath) return this.getDefaultConfig();
56007
- if (!fs$2.existsSync(this.configPath)) {
56055
+ if (!fs$1.existsSync(this.configPath)) {
56008
56056
  this.config = this.getDefaultConfig();
56009
56057
  this.set(this.config);
56010
56058
  return this.config;
56011
56059
  } else {
56012
- const data = fs$2.readFileSync(this.configPath, "utf-8");
56060
+ const data = fs$1.readFileSync(this.configPath, "utf-8");
56013
56061
  let jsonData = defaultConfig;
56014
56062
  try {
56015
56063
  jsonData = import_dist.default.parse(data);
@@ -56035,7 +56083,7 @@ var Config = class extends Service {
56035
56083
  writeConfig(config) {
56036
56084
  if (!this.configPath) return;
56037
56085
  this.watch = false;
56038
- fs$2.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8");
56086
+ fs$1.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8");
56039
56087
  setTimeout(() => {
56040
56088
  this.watch = true;
56041
56089
  }, 1500);
@@ -56141,13 +56189,13 @@ var WebUITokenUtil = class {
56141
56189
  }
56142
56190
  getToken() {
56143
56191
  if (!this.token) {
56144
- if (fs$2.existsSync(this.tokenPath)) this.token = fs$2.readFileSync(this.tokenPath, "utf-8").trim();
56192
+ if (fs$1.existsSync(this.tokenPath)) this.token = fs$1.readFileSync(this.tokenPath, "utf-8").trim();
56145
56193
  }
56146
56194
  return this.token;
56147
56195
  }
56148
56196
  setToken(token) {
56149
56197
  this.token = token.trim();
56150
- fs$2.writeFileSync(this.tokenPath, token, "utf-8");
56198
+ fs$1.writeFileSync(this.tokenPath, token, "utf-8");
56151
56199
  }
56152
56200
  };
56153
56201
  var webuiTokenUtil = new WebUITokenUtil(path.join(DATA_DIR, "webui_token.txt"));
@@ -57139,19 +57187,19 @@ function createNotificationRoutes(ctx) {
57139
57187
  });
57140
57188
  router.get("/notifications/friend", async (c) => {
57141
57189
  try {
57142
- const buddyReqs = ((await ctx.ntFriendApi.getBuddyReq()).buddyReqs || []).filter((reqItem) => !reqItem.isInitiator);
57190
+ const buddyReqs = (await ctx.ntFriendApi.getFriendRequests(50)).filter((reqItem) => !reqItem.isInitiator);
57143
57191
  const enriched = await Promise.all(buddyReqs.map(async (reqItem) => {
57144
- const uin = reqItem.friendUid ? await ctx.ntUserApi.getUinByUid(reqItem.friendUid).catch(() => "") : "";
57192
+ const uin = await ctx.ntUserApi.getUinByUid(reqItem.friendUid).catch(() => "");
57193
+ const nick = await ctx.ntUserApi.getUserSimpleInfo(reqItem.friendUid).then((e) => e.coreInfo.nick).catch(() => "");
57145
57194
  return {
57146
57195
  friendUid: reqItem.friendUid,
57147
57196
  friendUin: uin,
57148
- friendNick: reqItem.friendNick,
57149
- friendAvatarUrl: reqItem.friendAvatarUrl,
57150
- reqTime: reqItem.reqTime,
57151
- extWords: reqItem.extWords,
57152
- isDecide: reqItem.isDecide,
57153
- reqType: reqItem.reqType,
57154
- addSource: reqItem.addSource || "",
57197
+ friendNick: nick,
57198
+ reqTime: reqItem.timestamp.toString(),
57199
+ extWords: reqItem.comment,
57200
+ isDecide: ![BuddyReqType.PeerInitiator, BuddyReqType.MeInitiatorWaitPeerConfirm].includes(reqItem.state),
57201
+ reqType: reqItem.state,
57202
+ addSource: reqItem.source,
57155
57203
  flag: reqItem.friendUid
57156
57204
  };
57157
57205
  }));
@@ -57170,18 +57218,15 @@ function createNotificationRoutes(ctx) {
57170
57218
  });
57171
57219
  router.get("/notifications/friend/doubt", async (c) => {
57172
57220
  try {
57173
- const enriched = ((await ctx.ntFriendApi.getDoubtBuddyReq(50)).doubtList || []).map((item) => ({
57174
- uid: item.uid,
57175
- nick: item.nick,
57176
- age: item.age,
57177
- sex: item.sex,
57178
- reqTime: item.reqTime,
57179
- msg: item.msg,
57221
+ const enriched = (await ctx.ntFriendApi.getDoubtFriendRequests(50)).map((item) => ({
57222
+ uid: item.sourceUid,
57223
+ nick: item.sourceNickname,
57224
+ reqTime: item.timestamp.toString(),
57225
+ msg: item.comment,
57180
57226
  source: item.source,
57181
- reason: item.reason,
57227
+ reason: item.warningInfo,
57182
57228
  groupCode: item.groupCode,
57183
- commFriendNum: item.commFriendNum,
57184
- flag: `doubt|${item.uid}|${item.reqTime}`
57229
+ flag: item.sourceUid
57185
57230
  }));
57186
57231
  return c.json({
57187
57232
  success: true,
@@ -57821,7 +57866,6 @@ var WebuiServer = class extends Service {
57821
57866
  friendUid: req.friendUid,
57822
57867
  friendUin: uin,
57823
57868
  friendNick: req.friendNick,
57824
- friendAvatarUrl: req.friendAvatarUrl,
57825
57869
  reqTime: req.reqTime,
57826
57870
  extWords: req.extWords,
57827
57871
  isDecide: req.isDecide,
@@ -58452,7 +58496,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
58452
58496
  var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
58453
58497
  var urllib$2 = __require("url");
58454
58498
  var util$1 = __require("util");
58455
- var fs$5 = __require("fs");
58499
+ var fs$4 = __require("fs");
58456
58500
  var nmfetch = require_fetch();
58457
58501
  var dns$1 = __require("dns");
58458
58502
  var net$4 = __require("net");
@@ -58788,7 +58832,7 @@ var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
58788
58832
  const parsedDataUri = module.exports.parseDataURI(content.path || content.href);
58789
58833
  if (!parsedDataUri || !parsedDataUri.data) return callback(null, Buffer.from(0));
58790
58834
  return callback(null, parsedDataUri.data);
58791
- } else if (content.path) return resolveStream(fs$5.createReadStream(content.path), callback);
58835
+ } else if (content.path) return resolveStream(fs$4.createReadStream(content.path), callback);
58792
58836
  }
58793
58837
  if (typeof data[key].content === "string" && ![
58794
58838
  "utf8",
@@ -62728,7 +62772,7 @@ var require_le_unix = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62728
62772
  //#region node_modules/nodemailer/lib/mime-node/index.js
62729
62773
  var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62730
62774
  var crypto$8 = __require("crypto");
62731
- var fs$4 = __require("fs");
62775
+ var fs$3 = __require("fs");
62732
62776
  var punycode = require_punycode();
62733
62777
  var { PassThrough: PassThrough$2 } = __require("stream");
62734
62778
  var shared = require_shared();
@@ -63437,7 +63481,7 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63437
63481
  });
63438
63482
  return contentStream;
63439
63483
  }
63440
- return fs$4.createReadStream(content.path);
63484
+ return fs$3.createReadStream(content.path);
63441
63485
  }
63442
63486
  if (content && typeof content.href === "string") {
63443
63487
  if (this.disableUrlAccess) {
@@ -64276,7 +64320,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
64276
64320
  var RelaxedBody = require_relaxed_body();
64277
64321
  var sign = require_sign();
64278
64322
  var { PassThrough: PassThrough$1 } = __require("stream");
64279
- var fs$3 = __require("fs");
64323
+ var fs$2 = __require("fs");
64280
64324
  var path$2 = __require("path");
64281
64325
  var crypto$5 = __require("crypto");
64282
64326
  var DKIM_ALGO = "sha256";
@@ -64309,10 +64353,10 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
64309
64353
  }
64310
64354
  cleanup() {
64311
64355
  if (!this.cache || !this.cachePath) return;
64312
- fs$3.unlink(this.cachePath, () => false);
64356
+ fs$2.unlink(this.cachePath, () => false);
64313
64357
  }
64314
64358
  createReadCache() {
64315
- this.cache = fs$3.createReadStream(this.cachePath);
64359
+ this.cache = fs$2.createReadStream(this.cachePath);
64316
64360
  this.cache.once("error", (err) => {
64317
64361
  this.cleanup();
64318
64362
  this.output.emit("error", err);
@@ -64358,7 +64402,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
64358
64402
  }
64359
64403
  createWriteCache() {
64360
64404
  this.output.usingCache = true;
64361
- this.cache = fs$3.createWriteStream(this.cachePath);
64405
+ this.cache = fs$2.createWriteStream(this.cachePath);
64362
64406
  this.cache.once("error", (err) => {
64363
64407
  this.cleanup();
64364
64408
  this.relaxedBody.unpipe(this.cache);
@@ -69676,6 +69720,7 @@ function FriendMixin(Base) {
69676
69720
  20009,
69677
69721
  20031,
69678
69722
  20037,
69723
+ 27372,
69679
69724
  27394
69680
69725
  ] }
69681
69726
  }]
@@ -69704,6 +69749,87 @@ function FriendMixin(Base) {
69704
69749
  const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
69705
69750
  return Oidb.GetFriendRecommendContactArkResp.decode(oidbRespBody);
69706
69751
  }
69752
+ async setFriendRemark(uid, remark) {
69753
+ const body = Oidb.SetFriendRemarkReq.encode({
69754
+ uid,
69755
+ remark
69756
+ });
69757
+ const data = Oidb.Base.encode({
69758
+ command: 4300,
69759
+ subCommand: 1,
69760
+ body
69761
+ });
69762
+ await this.httpSendPB("OidbSvcTrpcTcp.0x10cc_1", data);
69763
+ }
69764
+ async deleteFriend(targetUid, block, bothDelete) {
69765
+ const body = Oidb.DeleteFriendReq.encode({ field1: {
69766
+ targetUid,
69767
+ field2: {
69768
+ field1: 130,
69769
+ field2: 109,
69770
+ field3: {
69771
+ field1: 8,
69772
+ field2: 8,
69773
+ field3: 50
69774
+ }
69775
+ },
69776
+ block,
69777
+ bothDelete
69778
+ } });
69779
+ const data = Oidb.Base.encode({
69780
+ command: 4715,
69781
+ subCommand: 0,
69782
+ body
69783
+ });
69784
+ await this.httpSendPB("OidbSvcTrpcTcp.0x126b_0", data);
69785
+ }
69786
+ async setFriendCategory(uid, categoryId) {
69787
+ const body = Oidb.SetFriendCategoryReq.encode({
69788
+ uid,
69789
+ categoryId
69790
+ });
69791
+ const data = Oidb.Base.encode({
69792
+ command: 4331,
69793
+ subCommand: 1,
69794
+ body
69795
+ });
69796
+ await this.httpSendPB("OidbSvcTrpcTcp.0x10eb_1", data);
69797
+ }
69798
+ async fetchFriendRequests(selfUid, reqNum) {
69799
+ const body = Oidb.FetchFriendRequestsReq.encode({
69800
+ version: 1,
69801
+ type: 6,
69802
+ selfUid,
69803
+ startIndex: 0,
69804
+ reqNum,
69805
+ getFlag: 2,
69806
+ startTime: 0,
69807
+ needCommFriend: 1,
69808
+ field22: 1
69809
+ });
69810
+ const data = Oidb.Base.encode({
69811
+ command: 1487,
69812
+ subCommand: 11,
69813
+ body
69814
+ });
69815
+ const res = await this.httpSendPB("OidbSvcTrpcTcp.0x5cf_11", data);
69816
+ const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
69817
+ return Oidb.FetchFriendRequestsResp.decode(oidbRespBody);
69818
+ }
69819
+ async fetchFilteredFriendRequests(count) {
69820
+ const body = Oidb.FetchFilteredFriendRequestsReq.encode({
69821
+ field1: 1,
69822
+ field2: { count }
69823
+ });
69824
+ const data = Oidb.Base.encode({
69825
+ command: 3433,
69826
+ subCommand: 0,
69827
+ body
69828
+ });
69829
+ const res = await this.httpSendPB("OidbSvcTrpcTcp.0xd69_0", data);
69830
+ const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
69831
+ return Oidb.FetchFilteredFriendRequestsResp.decode(oidbRespBody);
69832
+ }
69707
69833
  };
69708
69834
  }
69709
69835
  //#endregion