llonebot-dist 7.12.3 → 7.12.4
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
|
|
5
|
-
import fs
|
|
6
|
-
import * as fs$
|
|
7
|
-
import fs$
|
|
4
|
+
import fsPromise, { access, 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";
|
|
@@ -20,7 +20,7 @@ import http, { STATUS_CODES, createServer, request } from "node:http";
|
|
|
20
20
|
import { Http2ServerRequest, constants as constants$1 } from "node:http2";
|
|
21
21
|
import { Readable, Transform } from "node:stream";
|
|
22
22
|
import { deflateSync, gunzipSync, gzipSync, inflateSync } from "node:zlib";
|
|
23
|
-
import fsPromise, { stat as stat$2, unlink as unlink$1 } from "fs/promises";
|
|
23
|
+
import fsPromise$1, { stat as stat$2, unlink as unlink$1 } from "fs/promises";
|
|
24
24
|
import { inspect, isDeepStrictEqual } from "node:util";
|
|
25
25
|
import net, { connect } from "node:net";
|
|
26
26
|
import https from "node:https";
|
|
@@ -3972,7 +3972,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3972
3972
|
//#endregion
|
|
3973
3973
|
//#region node_modules/qrcode/lib/renderer/png.js
|
|
3974
3974
|
var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3975
|
-
var fs$
|
|
3975
|
+
var fs$10 = __require("fs");
|
|
3976
3976
|
var PNG = require_png$1().PNG;
|
|
3977
3977
|
var Utils = require_utils$1();
|
|
3978
3978
|
exports.render = function render(qrData, options) {
|
|
@@ -4024,7 +4024,7 @@ var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4024
4024
|
called = true;
|
|
4025
4025
|
cb.apply(null, args);
|
|
4026
4026
|
};
|
|
4027
|
-
const stream = fs$
|
|
4027
|
+
const stream = fs$10.createWriteStream(path);
|
|
4028
4028
|
stream.on("error", done);
|
|
4029
4029
|
stream.on("close", done);
|
|
4030
4030
|
exports.renderToFileStream(stream, qrData, options);
|
|
@@ -6462,7 +6462,8 @@ var FaceIndex = /* @__PURE__ */ function(FaceIndex) {
|
|
|
6462
6462
|
return FaceIndex;
|
|
6463
6463
|
}({});
|
|
6464
6464
|
var FaceType = /* @__PURE__ */ function(FaceType) {
|
|
6465
|
-
FaceType[FaceType["
|
|
6465
|
+
FaceType[FaceType["Old"] = 1] = "Old";
|
|
6466
|
+
FaceType[FaceType["Normal"] = 2] = "Normal";
|
|
6466
6467
|
FaceType[FaceType["Super"] = 3] = "Super";
|
|
6467
6468
|
FaceType[FaceType["Poke"] = 5] = "Poke";
|
|
6468
6469
|
return FaceType;
|
|
@@ -6622,7 +6623,7 @@ async function logSummaryMessage(ctx, message) {
|
|
|
6622
6623
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6623
6624
|
module.exports = isexe;
|
|
6624
6625
|
isexe.sync = sync;
|
|
6625
|
-
var fs$
|
|
6626
|
+
var fs$9 = __require("fs");
|
|
6626
6627
|
function checkPathExt(path, options) {
|
|
6627
6628
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
6628
6629
|
if (!pathext) return true;
|
|
@@ -6639,12 +6640,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6639
6640
|
return checkPathExt(path, options);
|
|
6640
6641
|
}
|
|
6641
6642
|
function isexe(path, options, cb) {
|
|
6642
|
-
fs$
|
|
6643
|
+
fs$9.stat(path, function(er, stat) {
|
|
6643
6644
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
6644
6645
|
});
|
|
6645
6646
|
}
|
|
6646
6647
|
function sync(path, options) {
|
|
6647
|
-
return checkStat(fs$
|
|
6648
|
+
return checkStat(fs$9.statSync(path), path, options);
|
|
6648
6649
|
}
|
|
6649
6650
|
}));
|
|
6650
6651
|
//#endregion
|
|
@@ -6652,14 +6653,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6652
6653
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6653
6654
|
module.exports = isexe;
|
|
6654
6655
|
isexe.sync = sync;
|
|
6655
|
-
var fs$
|
|
6656
|
+
var fs$8 = __require("fs");
|
|
6656
6657
|
function isexe(path, options, cb) {
|
|
6657
|
-
fs$
|
|
6658
|
+
fs$8.stat(path, function(er, stat) {
|
|
6658
6659
|
cb(er, er ? false : checkStat(stat, options));
|
|
6659
6660
|
});
|
|
6660
6661
|
}
|
|
6661
6662
|
function sync(path, options) {
|
|
6662
|
-
return checkStat(fs$
|
|
6663
|
+
return checkStat(fs$8.statSync(path), options);
|
|
6663
6664
|
}
|
|
6664
6665
|
function checkStat(stat, options) {
|
|
6665
6666
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -9151,7 +9152,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9151
9152
|
//#endregion
|
|
9152
9153
|
//#region node_modules/fluent-ffmpeg/lib/capabilities.js
|
|
9153
9154
|
var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9154
|
-
var fs$
|
|
9155
|
+
var fs$7 = __require("fs");
|
|
9155
9156
|
var path$7 = __require("path");
|
|
9156
9157
|
var async = require_async();
|
|
9157
9158
|
var utils = require_utils();
|
|
@@ -9227,7 +9228,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9227
9228
|
proto._getFfmpegPath = function(callback) {
|
|
9228
9229
|
if ("ffmpegPath" in cache) return callback(null, cache.ffmpegPath);
|
|
9229
9230
|
async.waterfall([function(cb) {
|
|
9230
|
-
if (process.env.FFMPEG_PATH) fs$
|
|
9231
|
+
if (process.env.FFMPEG_PATH) fs$7.exists(process.env.FFMPEG_PATH, function(exists) {
|
|
9231
9232
|
if (exists) cb(null, process.env.FFMPEG_PATH);
|
|
9232
9233
|
else cb(null, "");
|
|
9233
9234
|
});
|
|
@@ -9258,7 +9259,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9258
9259
|
if ("ffprobePath" in cache) return callback(null, cache.ffprobePath);
|
|
9259
9260
|
async.waterfall([
|
|
9260
9261
|
function(cb) {
|
|
9261
|
-
if (process.env.FFPROBE_PATH) fs$
|
|
9262
|
+
if (process.env.FFPROBE_PATH) fs$7.exists(process.env.FFPROBE_PATH, function(exists) {
|
|
9262
9263
|
cb(null, exists ? process.env.FFPROBE_PATH : "");
|
|
9263
9264
|
});
|
|
9264
9265
|
else cb(null, "");
|
|
@@ -9276,7 +9277,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9276
9277
|
else if (ffmpeg.length) {
|
|
9277
9278
|
var name = utils.isWindows ? "ffprobe.exe" : "ffprobe";
|
|
9278
9279
|
var ffprobe = path$7.join(path$7.dirname(ffmpeg), name);
|
|
9279
|
-
fs$
|
|
9280
|
+
fs$7.exists(ffprobe, function(exists) {
|
|
9280
9281
|
cb(null, exists ? ffprobe : "");
|
|
9281
9282
|
});
|
|
9282
9283
|
} else cb(null, "");
|
|
@@ -9301,14 +9302,14 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9301
9302
|
if ("flvtoolPath" in cache) return callback(null, cache.flvtoolPath);
|
|
9302
9303
|
async.waterfall([
|
|
9303
9304
|
function(cb) {
|
|
9304
|
-
if (process.env.FLVMETA_PATH) fs$
|
|
9305
|
+
if (process.env.FLVMETA_PATH) fs$7.exists(process.env.FLVMETA_PATH, function(exists) {
|
|
9305
9306
|
cb(null, exists ? process.env.FLVMETA_PATH : "");
|
|
9306
9307
|
});
|
|
9307
9308
|
else cb(null, "");
|
|
9308
9309
|
},
|
|
9309
9310
|
function(flvtool, cb) {
|
|
9310
9311
|
if (flvtool.length) return cb(null, flvtool);
|
|
9311
|
-
if (process.env.FLVTOOL2_PATH) fs$
|
|
9312
|
+
if (process.env.FLVTOOL2_PATH) fs$7.exists(process.env.FLVTOOL2_PATH, function(exists) {
|
|
9312
9313
|
cb(null, exists ? process.env.FLVTOOL2_PATH : "");
|
|
9313
9314
|
});
|
|
9314
9315
|
else cb(null, "");
|
|
@@ -9813,7 +9814,7 @@ var require_ffprobe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9813
9814
|
//#endregion
|
|
9814
9815
|
//#region node_modules/fluent-ffmpeg/lib/recipes.js
|
|
9815
9816
|
var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9816
|
-
var fs$
|
|
9817
|
+
var fs$6 = __require("fs");
|
|
9817
9818
|
var path$6 = __require("path");
|
|
9818
9819
|
var PassThrough$4 = __require("stream").PassThrough;
|
|
9819
9820
|
var async = require_async();
|
|
@@ -10019,8 +10020,8 @@ var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10019
10020
|
next(null, filenames);
|
|
10020
10021
|
},
|
|
10021
10022
|
function createDirectory(filenames, next) {
|
|
10022
|
-
fs$
|
|
10023
|
-
if (!exists) fs$
|
|
10023
|
+
fs$6.exists(config.folder, function(exists) {
|
|
10024
|
+
if (!exists) fs$6.mkdir(config.folder, function(err) {
|
|
10024
10025
|
if (err) next(err);
|
|
10025
10026
|
else next(null, filenames);
|
|
10026
10027
|
});
|
|
@@ -10268,7 +10269,7 @@ function setFFMpegPath(ffmpegPath) {
|
|
|
10268
10269
|
path.join(import.meta.dirname, "ffmpeg.exe"),
|
|
10269
10270
|
process.env["FFMPEG_PATH"] || ""
|
|
10270
10271
|
];
|
|
10271
|
-
for (const p of paths) if (fs$
|
|
10272
|
+
for (const p of paths) if (fs$1.existsSync(p)) {
|
|
10272
10273
|
import_fluent_ffmpeg.default.setFfmpegPath(p);
|
|
10273
10274
|
console.log("set ffmpeg successfully", p);
|
|
10274
10275
|
break;
|
|
@@ -11235,10 +11236,11 @@ var OB11Entities;
|
|
|
11235
11236
|
async function recallEvent(ctx, msg, shortId) {
|
|
11236
11237
|
const revokeElement = msg.elements[0].grayTipElement.revokeElement;
|
|
11237
11238
|
if (msg.chatType === ChatType.Group) {
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11239
|
+
let operatorUin;
|
|
11240
|
+
if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operatorUin = msg.senderUin;
|
|
11241
|
+
else operatorUin = await ctx.ntUserApi.getUinByUid(revokeElement.operatorUid);
|
|
11242
|
+
if (msg.senderUin === "0" || !msg.senderUin) ctx.logger.warn(`发生异常 senderUin: ${msg.senderUin}`);
|
|
11243
|
+
return new OB11GroupRecallNoticeEvent(Number(msg.peerUid), Number(msg.senderUin), Number(operatorUin), shortId);
|
|
11242
11244
|
} else return new OB11FriendRecallNoticeEvent(+msg.senderUin, shortId);
|
|
11243
11245
|
}
|
|
11244
11246
|
_OB11Entities.recallEvent = recallEvent;
|
|
@@ -11382,7 +11384,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
|
|
|
11382
11384
|
};
|
|
11383
11385
|
//#endregion
|
|
11384
11386
|
//#region src/version.ts
|
|
11385
|
-
var version$2 = "7.12.
|
|
11387
|
+
var version$2 = "7.12.4";
|
|
11386
11388
|
//#endregion
|
|
11387
11389
|
//#region node_modules/sift/es5m/index.js
|
|
11388
11390
|
/******************************************************************************
|
|
@@ -12126,7 +12128,7 @@ var OB11WebSocket = class {
|
|
|
12126
12128
|
if (emitEvent && socket.readyState === WebSocket$1.OPEN) {
|
|
12127
12129
|
socket.send(JSON.stringify(event));
|
|
12128
12130
|
const eventName = event.getSummaryEventName();
|
|
12129
|
-
this.ctx.logger.info("WebSocket 事件上报",
|
|
12131
|
+
this.ctx.logger.info("WebSocket 事件上报", eventName);
|
|
12130
12132
|
}
|
|
12131
12133
|
});
|
|
12132
12134
|
}
|
|
@@ -12150,7 +12152,7 @@ var OB11WebSocket = class {
|
|
|
12150
12152
|
reply(socket, data) {
|
|
12151
12153
|
if (socket.readyState !== WebSocket$1.OPEN) return;
|
|
12152
12154
|
socket.send(JSON.stringify(data));
|
|
12153
|
-
if ("post_type" in data) this.ctx.logger.info("WebSocket 事件上报",
|
|
12155
|
+
if ("post_type" in data) this.ctx.logger.info("WebSocket 事件上报", data.post_type);
|
|
12154
12156
|
}
|
|
12155
12157
|
authorize(socket, req) {
|
|
12156
12158
|
const url = req.url?.split("?").shift();
|
|
@@ -17042,7 +17044,7 @@ var processQueue = async () => {
|
|
|
17042
17044
|
const promises = queue.splice(0, concurrency).map(async ({ filePath, resolve, reject }) => {
|
|
17043
17045
|
let handle;
|
|
17044
17046
|
try {
|
|
17045
|
-
handle = await fs$
|
|
17047
|
+
handle = await fs$5.promises.open(path$4.resolve(filePath), "r");
|
|
17046
17048
|
} catch (err) {
|
|
17047
17049
|
return reject(err);
|
|
17048
17050
|
}
|
|
@@ -17089,7 +17091,7 @@ function checkUriType(uri) {
|
|
|
17089
17091
|
if (uri.startsWith("data:")) return { type: FileUriType.DataURL };
|
|
17090
17092
|
if (uri.startsWith("http://") || uri.startsWith("https://")) return { type: FileUriType.RemoteURL };
|
|
17091
17093
|
if (uri.startsWith("file://")) return { type: FileUriType.FileURL };
|
|
17092
|
-
if (fs$
|
|
17094
|
+
if (fs$1.existsSync(uri)) return { type: FileUriType.Path };
|
|
17093
17095
|
return { type: FileUriType.Unknown };
|
|
17094
17096
|
}
|
|
17095
17097
|
async function fetchFile(url, headersInit) {
|
|
@@ -17119,7 +17121,7 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17119
17121
|
const { type } = checkUriType(uri);
|
|
17120
17122
|
if (type === FileUriType.FileURL) {
|
|
17121
17123
|
const filePath = fileURLToPath(uri);
|
|
17122
|
-
if (!fs$
|
|
17124
|
+
if (!fs$1.existsSync(filePath)) return {
|
|
17123
17125
|
success: false,
|
|
17124
17126
|
errMsg: "路径不存在",
|
|
17125
17127
|
fileName: "",
|
|
@@ -17145,12 +17147,12 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17145
17147
|
const res = await fetchFile(uri);
|
|
17146
17148
|
let fileName = randomUUID();
|
|
17147
17149
|
let filePath = path.join(TEMP_DIR, fileName);
|
|
17148
|
-
await
|
|
17150
|
+
await fsPromise.writeFile(filePath, res.data);
|
|
17149
17151
|
if (needExt) {
|
|
17150
17152
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
17151
17153
|
fileName += `.${ext}`;
|
|
17152
17154
|
const newPath = `${filePath}.${ext}`;
|
|
17153
|
-
await
|
|
17155
|
+
await fsPromise.rename(filePath, newPath);
|
|
17154
17156
|
filePath = newPath;
|
|
17155
17157
|
}
|
|
17156
17158
|
return {
|
|
@@ -17173,11 +17175,11 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17173
17175
|
let filename = randomUUID();
|
|
17174
17176
|
let filePath = path.join(TEMP_DIR, filename);
|
|
17175
17177
|
const base64 = uri.replace(/^base64:\/\//, "");
|
|
17176
|
-
await
|
|
17178
|
+
await fsPromise.writeFile(filePath, base64, "base64");
|
|
17177
17179
|
if (needExt) {
|
|
17178
17180
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
17179
17181
|
filename += `.${ext}`;
|
|
17180
|
-
await
|
|
17182
|
+
await fsPromise.rename(filePath, `${filePath}.${ext}`);
|
|
17181
17183
|
filePath = `${filePath}.${ext}`;
|
|
17182
17184
|
}
|
|
17183
17185
|
return {
|
|
@@ -17194,11 +17196,11 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17194
17196
|
let filename = randomUUID();
|
|
17195
17197
|
const [, _type, base64] = capture;
|
|
17196
17198
|
let filePath = path.join(TEMP_DIR, filename);
|
|
17197
|
-
await
|
|
17199
|
+
await fsPromise.writeFile(filePath, base64, "base64");
|
|
17198
17200
|
if (needExt) {
|
|
17199
17201
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
17200
17202
|
filename += `.${ext}`;
|
|
17201
|
-
await
|
|
17203
|
+
await fsPromise.rename(filePath, `${filePath}.${ext}`);
|
|
17202
17204
|
filePath = `${filePath}.${ext}`;
|
|
17203
17205
|
}
|
|
17204
17206
|
return {
|
|
@@ -17256,13 +17258,13 @@ async function getImageSize(path) {
|
|
|
17256
17258
|
}
|
|
17257
17259
|
async function getMd5HexFromFile(filePath) {
|
|
17258
17260
|
const hash = createHash("md5");
|
|
17259
|
-
const stream = fs$
|
|
17261
|
+
const stream = fs$1.createReadStream(filePath);
|
|
17260
17262
|
for await (const chunk of stream) hash.update(chunk);
|
|
17261
17263
|
return hash.digest("hex");
|
|
17262
17264
|
}
|
|
17263
17265
|
async function getSha1HexFromFile(filePath) {
|
|
17264
17266
|
const hash = createHash("sha1");
|
|
17265
|
-
const stream = fs$
|
|
17267
|
+
const stream = fs$1.createReadStream(filePath);
|
|
17266
17268
|
for await (const chunk of stream) hash.update(chunk);
|
|
17267
17269
|
return hash.digest("hex");
|
|
17268
17270
|
}
|
|
@@ -17271,13 +17273,13 @@ function getMd5BufferFromBuffer(buf) {
|
|
|
17271
17273
|
}
|
|
17272
17274
|
async function getMd5BufferFromFile(filePath) {
|
|
17273
17275
|
const hash = createHash("md5");
|
|
17274
|
-
const stream = fs$
|
|
17276
|
+
const stream = fs$1.createReadStream(filePath);
|
|
17275
17277
|
for await (const chunk of stream) hash.update(chunk);
|
|
17276
17278
|
return hash.digest();
|
|
17277
17279
|
}
|
|
17278
17280
|
async function getSha1BufferFromFile(filePath) {
|
|
17279
17281
|
const hash = createHash("sha1");
|
|
17280
|
-
const stream = fs$
|
|
17282
|
+
const stream = fs$1.createReadStream(filePath);
|
|
17281
17283
|
for await (const chunk of stream) hash.update(chunk);
|
|
17282
17284
|
return hash.digest();
|
|
17283
17285
|
}
|
|
@@ -17513,7 +17515,7 @@ async function calculateSha1StreamBytes(filePath) {
|
|
|
17513
17515
|
let bytesRead = 0;
|
|
17514
17516
|
let nextBlockBoundary = blockSize;
|
|
17515
17517
|
const byteArrayList = [];
|
|
17516
|
-
const readable = fs$
|
|
17518
|
+
const readable = fs$1.createReadStream(filePath);
|
|
17517
17519
|
for await (const chunk of readable) {
|
|
17518
17520
|
let buf;
|
|
17519
17521
|
if (tail.length > 0) {
|
|
@@ -17538,7 +17540,7 @@ async function calculateSha1StreamBytes(filePath) {
|
|
|
17538
17540
|
}
|
|
17539
17541
|
async function readAndHash10M(filePath) {
|
|
17540
17542
|
const maxSize = 10002432;
|
|
17541
|
-
const fd = await
|
|
17543
|
+
const fd = await fsPromise.open(filePath, "r");
|
|
17542
17544
|
const buffer = Buffer.allocUnsafe(maxSize);
|
|
17543
17545
|
const { bytesRead } = await fd.read(buffer, 0, maxSize, 0);
|
|
17544
17546
|
await fd.close();
|
|
@@ -17580,13 +17582,13 @@ var TriSha1 = class {
|
|
|
17580
17582
|
};
|
|
17581
17583
|
async function calculateTriSha1(filePath, fileSize) {
|
|
17582
17584
|
const hash = new TriSha1(fileSize);
|
|
17583
|
-
const stream = fs$
|
|
17585
|
+
const stream = fs$1.createReadStream(filePath);
|
|
17584
17586
|
for await (const chunk of stream) hash.update(chunk);
|
|
17585
17587
|
return hash.finalize();
|
|
17586
17588
|
}
|
|
17587
17589
|
var defaultVideoThumb = Buffer.from("/9j/4AAQSkZJRgABAQAAA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QAmaYwzQAuaADNAC0AFABQAUAFAhKACgBKACgAoAWgAoELQAlAxKAJqk0EoAWgQooELTEFADaBCUABoENNMY00ANNAwzQAZoAXNAC0AFAC0CFoASgAoASgBKACgAoAWgQtABQAUANNAyWpNAoAKBCimIWgQUCEoASmIQ0ANNADTQMaaAEoGLmgAzQAtADhQIWgBaACgQhoASgYlACUALQIWgBaACgBKAENAyWpNBKYBQIcKBC0CEoEJTAKBCUANNADDQMQ0ANoGFAC5oAUGgBwNAhRQIWgBaAENACGgBtAwoAKAFzQIXNABmgAoAQ0DJKRoJQAtAhRQSLQIKYCUCCgBDQA00AMNAxpoGNoAM0AGaAFBoAcDQIcKBDqACgBDQAhoAQ0DEoAKADNAC5oEGaBhmgAoAkpGgUCCgQooELQIKYhKACgBKAGmgBpoGMNAxDQAlAwzQIUUAOFAhwoAcKBC0AJQAhoGNNACUAFABQAZoAXNABQAUAS0ixKACgQoNAhaYgoEFACUABoAaaAGmgYw0DENAxtABQAooEOFADhQIcKAFoASgBDQAhoGJQAUAFACUALQIKBi0CJDSLEoATNAhc0CHZpiCgQUAJQIKBjTQAhoGNNAxpoATFABigBQKAHCgBwoAWgAoAKACgBKAEoASgAoASgBaAAUAOoEONIoaTQAZoAUGmIUGgQtAgzQISgAoAQ0DGmgYlAxKACgAxQAtACigBRQAtAxaACgAoATFABigBCKAG0CEoAWgBRTAUUAf//Z", "base64");
|
|
17588
17590
|
async function getVideoInfo(filePath) {
|
|
17589
|
-
const size = fs$
|
|
17591
|
+
const size = fs$1.statSync(filePath).size;
|
|
17590
17592
|
return new Promise((resolve, reject) => {
|
|
17591
17593
|
(0, import_fluent_ffmpeg.default)(filePath).ffprobe((err, metadata) => {
|
|
17592
17594
|
if (err) reject(err);
|
|
@@ -17663,7 +17665,7 @@ function convert(ctx, input, options, outputPath) {
|
|
|
17663
17665
|
});
|
|
17664
17666
|
}
|
|
17665
17667
|
async function encodeSilk(ctx, filePath) {
|
|
17666
|
-
const file = await
|
|
17668
|
+
const file = await fsPromise.readFile(filePath);
|
|
17667
17669
|
if (!isSilk(file)) {
|
|
17668
17670
|
ctx.logger.info(`语音文件${filePath}需要转换成silk`);
|
|
17669
17671
|
let result;
|
|
@@ -17682,7 +17684,7 @@ async function encodeSilk(ctx, filePath) {
|
|
|
17682
17684
|
"-f s16le"
|
|
17683
17685
|
] }), 24e3);
|
|
17684
17686
|
const pttPath = path.join(TEMP_DIR, randomUUID());
|
|
17685
|
-
await
|
|
17687
|
+
await fsPromise.writeFile(pttPath, result.data);
|
|
17686
17688
|
ctx.logger.info(`语音文件${filePath}转换成功!`, pttPath, `时长:`, result.duration);
|
|
17687
17689
|
return {
|
|
17688
17690
|
converted: true,
|
|
@@ -17705,11 +17707,11 @@ async function encodeSilk(ctx, filePath) {
|
|
|
17705
17707
|
}
|
|
17706
17708
|
}
|
|
17707
17709
|
async function decodeSilk(ctx, inputFilePath, outFormat) {
|
|
17708
|
-
const { data } = await decode(await
|
|
17710
|
+
const { data } = await decode(await fsPromise.readFile(inputFilePath), 24e3);
|
|
17709
17711
|
const tmpPath = path.join(TEMP_DIR, path.basename(inputFilePath));
|
|
17710
17712
|
const outFilePath = tmpPath + `.${outFormat}`;
|
|
17711
17713
|
const pcmFilePath = tmpPath + ".pcm";
|
|
17712
|
-
await
|
|
17714
|
+
await fsPromise.writeFile(pcmFilePath, data);
|
|
17713
17715
|
return convert(ctx, pcmFilePath, { input: [
|
|
17714
17716
|
"-f s16le",
|
|
17715
17717
|
"-ar 24000",
|
|
@@ -23855,7 +23857,8 @@ var MessageEncoder$1 = class MessageEncoder$1 {
|
|
|
23855
23857
|
"node",
|
|
23856
23858
|
"video",
|
|
23857
23859
|
"file",
|
|
23858
|
-
"at"
|
|
23860
|
+
"at",
|
|
23861
|
+
"reply"
|
|
23859
23862
|
];
|
|
23860
23863
|
results;
|
|
23861
23864
|
children;
|
|
@@ -24162,6 +24165,28 @@ var MessageEncoder$1 = class MessageEncoder$1 {
|
|
|
24162
24165
|
}
|
|
24163
24166
|
this.children.push({ text: { str } });
|
|
24164
24167
|
this.preview += str;
|
|
24168
|
+
} else if (type === OB11MessageDataType.Reply) {
|
|
24169
|
+
const msgInfo = await this.ctx.store.getMsgInfoByShortId(+data.id);
|
|
24170
|
+
if (!msgInfo) throw new Error(`消息 ${data.id} 不存在`);
|
|
24171
|
+
const res = await this.ctx.ntMsgApi.getMsgsByMsgId(msgInfo.peer, [msgInfo.msgId]);
|
|
24172
|
+
if (res.msgList.length === 0) throw new Error(`无法获取消息 ${data.id} 的内容`);
|
|
24173
|
+
const msg = res.msgList[0];
|
|
24174
|
+
const elems = [];
|
|
24175
|
+
for (const element of msg.elements) if (element.elementType === ElementType.Text) elems.push({ text: { str: element.textElement.content } });
|
|
24176
|
+
else if (element.elementType === ElementType.Pic) elems.push({ text: { str: element.picElement.summary } });
|
|
24177
|
+
else if (element.elementType === ElementType.Video) elems.push({ text: { str: "[视频]" } });
|
|
24178
|
+
else if (element.elementType === ElementType.Face) {
|
|
24179
|
+
const { faceType, faceIndex, faceText } = element.faceElement;
|
|
24180
|
+
if (faceType === FaceType.Old || faceType === FaceType.Normal) elems.push({ face: { index: faceIndex } });
|
|
24181
|
+
else elems.push({ text: { str: faceText } });
|
|
24182
|
+
} else if (element.elementType === ElementType.File) elems.push({ text: { str: "[文件]" } });
|
|
24183
|
+
this.children.push({ srcMsg: {
|
|
24184
|
+
origSeqs: [+msg.msgSeq],
|
|
24185
|
+
senderUin: +msg.senderUin,
|
|
24186
|
+
time: +msg.msgTime,
|
|
24187
|
+
elems: elems.map((e) => Msg.Elem.encode(e)),
|
|
24188
|
+
toUin: 0
|
|
24189
|
+
} });
|
|
24165
24190
|
}
|
|
24166
24191
|
}
|
|
24167
24192
|
async render(segments) {
|
|
@@ -24849,17 +24874,17 @@ var DownloadFile = class extends BaseAction {
|
|
|
24849
24874
|
const isRandomName = !payload.name;
|
|
24850
24875
|
const name = payload.name ? path.basename(payload.name) : randomUUID();
|
|
24851
24876
|
const filePath = path.join(TEMP_DIR, name);
|
|
24852
|
-
if (payload.base64) await fsPromise.writeFile(filePath, payload.base64, "base64");
|
|
24877
|
+
if (payload.base64) await fsPromise$1.writeFile(filePath, payload.base64, "base64");
|
|
24853
24878
|
else if (payload.url) {
|
|
24854
24879
|
const headers = this.getHeaders(payload.headers);
|
|
24855
24880
|
const res = await fetchFile(payload.url, headers);
|
|
24856
|
-
await fsPromise.writeFile(filePath, res.data);
|
|
24881
|
+
await fsPromise$1.writeFile(filePath, res.data);
|
|
24857
24882
|
} else throw new Error("不存在任何文件, 无法下载");
|
|
24858
|
-
if (fs
|
|
24883
|
+
if (fs.existsSync(filePath)) {
|
|
24859
24884
|
if (isRandomName) {
|
|
24860
24885
|
const md5 = await getMd5HexFromFile(filePath);
|
|
24861
24886
|
const newPath = path.join(TEMP_DIR, md5);
|
|
24862
|
-
await fsPromise.rename(filePath, newPath);
|
|
24887
|
+
await fsPromise$1.rename(filePath, newPath);
|
|
24863
24888
|
return { file: newPath };
|
|
24864
24889
|
}
|
|
24865
24890
|
return { file: filePath };
|
|
@@ -29173,8 +29198,10 @@ async function parseMessageDeleted(bot, input) {
|
|
|
29173
29198
|
if (!origin) return;
|
|
29174
29199
|
const message = await decodeMessage(bot.ctx, origin);
|
|
29175
29200
|
if (!message) return;
|
|
29176
|
-
const
|
|
29177
|
-
|
|
29201
|
+
const revokeElement = input.elements[0].grayTipElement.revokeElement;
|
|
29202
|
+
let operator;
|
|
29203
|
+
if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operator = message.user;
|
|
29204
|
+
else operator = decodeUser((await bot.ctx.ntUserApi.getUserSimpleInfo(revokeElement.operatorUid)).coreInfo);
|
|
29178
29205
|
return bot.event("message-deleted", {
|
|
29179
29206
|
message: omit(message, [
|
|
29180
29207
|
"member",
|
|
@@ -29186,7 +29213,7 @@ async function parseMessageDeleted(bot, input) {
|
|
|
29186
29213
|
user: message.user,
|
|
29187
29214
|
channel: message.channel,
|
|
29188
29215
|
guild: message.guild,
|
|
29189
|
-
operator: omit(
|
|
29216
|
+
operator: omit(operator, ["is_bot"])
|
|
29190
29217
|
});
|
|
29191
29218
|
}
|
|
29192
29219
|
//#endregion
|
|
@@ -43532,7 +43559,7 @@ async function download(url, headers) {
|
|
|
43532
43559
|
return Buffer.from(bytes);
|
|
43533
43560
|
}
|
|
43534
43561
|
async function resolveMilkyUri(uri) {
|
|
43535
|
-
if (uri.startsWith("file://")) return await
|
|
43562
|
+
if (uri.startsWith("file://")) return await fsPromise.readFile(fileURLToPath(uri));
|
|
43536
43563
|
if (uri.startsWith("http://") || uri.startsWith("https://")) return await download(uri);
|
|
43537
43564
|
if (uri.startsWith("base64://")) return Buffer.from(uri.slice(9), "base64");
|
|
43538
43565
|
throw new Error(`Unsupported URI scheme: ${uri}`);
|
|
@@ -47196,7 +47223,7 @@ function extractNamespace(rawTagName) {
|
|
|
47196
47223
|
}
|
|
47197
47224
|
}
|
|
47198
47225
|
var OrderedObjParser = class {
|
|
47199
|
-
constructor(options) {
|
|
47226
|
+
constructor(options, externalEntities) {
|
|
47200
47227
|
this.options = options;
|
|
47201
47228
|
this.currentNode = null;
|
|
47202
47229
|
this.tagsNodeStack = [];
|
|
@@ -47221,7 +47248,10 @@ var OrderedObjParser = class {
|
|
|
47221
47248
|
...CURRENCY
|
|
47222
47249
|
};
|
|
47223
47250
|
this.entityDecoder = new EntityDecoder({
|
|
47224
|
-
namedEntities
|
|
47251
|
+
namedEntities: {
|
|
47252
|
+
...namedEntities,
|
|
47253
|
+
...externalEntities
|
|
47254
|
+
},
|
|
47225
47255
|
numericAllowed: this.options.htmlEntities,
|
|
47226
47256
|
limit: {
|
|
47227
47257
|
maxTotalExpansions: this.options.processEntities.maxTotalExpansions,
|
|
@@ -47325,7 +47355,7 @@ function buildAttributesMap(attrStr, jPath, tagName, force = false) {
|
|
|
47325
47355
|
}
|
|
47326
47356
|
}
|
|
47327
47357
|
if (!hasAttrs) return;
|
|
47328
|
-
if (options.attributesGroupName) {
|
|
47358
|
+
if (options.attributesGroupName && !options.preserveOrder) {
|
|
47329
47359
|
const attrCollection = {};
|
|
47330
47360
|
attrCollection[options.attributesGroupName] = attrs;
|
|
47331
47361
|
return attrCollection;
|
|
@@ -47543,29 +47573,35 @@ function isItStopNode() {
|
|
|
47543
47573
|
*/
|
|
47544
47574
|
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
47545
47575
|
let attrBoundary = 0;
|
|
47546
|
-
const chars = [];
|
|
47547
47576
|
const len = xmlData.length;
|
|
47548
47577
|
const closeCode0 = closingChar.charCodeAt(0);
|
|
47549
47578
|
const closeCode1 = closingChar.length > 1 ? closingChar.charCodeAt(1) : -1;
|
|
47579
|
+
let result = "";
|
|
47580
|
+
let segmentStart = i;
|
|
47550
47581
|
for (let index = i; index < len; index++) {
|
|
47551
47582
|
const code = xmlData.charCodeAt(index);
|
|
47552
47583
|
if (attrBoundary) {
|
|
47553
47584
|
if (code === attrBoundary) attrBoundary = 0;
|
|
47554
47585
|
} else if (code === 34 || code === 39) attrBoundary = code;
|
|
47555
47586
|
else if (code === closeCode0) if (closeCode1 !== -1) {
|
|
47556
|
-
if (xmlData.charCodeAt(index + 1) === closeCode1)
|
|
47557
|
-
|
|
47587
|
+
if (xmlData.charCodeAt(index + 1) === closeCode1) {
|
|
47588
|
+
result += xmlData.substring(segmentStart, index);
|
|
47589
|
+
return {
|
|
47590
|
+
data: result,
|
|
47591
|
+
index
|
|
47592
|
+
};
|
|
47593
|
+
}
|
|
47594
|
+
} else {
|
|
47595
|
+
result += xmlData.substring(segmentStart, index);
|
|
47596
|
+
return {
|
|
47597
|
+
data: result,
|
|
47558
47598
|
index
|
|
47559
47599
|
};
|
|
47560
|
-
} else return {
|
|
47561
|
-
data: String.fromCharCode(...chars),
|
|
47562
|
-
index
|
|
47563
|
-
};
|
|
47564
|
-
else if (code === 9) {
|
|
47565
|
-
chars.push(32);
|
|
47566
|
-
continue;
|
|
47567
47600
|
}
|
|
47568
|
-
|
|
47601
|
+
else if (code === 9 && !attrBoundary) {
|
|
47602
|
+
result += xmlData.substring(segmentStart, index) + " ";
|
|
47603
|
+
segmentStart = index + 1;
|
|
47604
|
+
}
|
|
47569
47605
|
}
|
|
47570
47606
|
}
|
|
47571
47607
|
function findClosingIndex(xmlData, str, i, errMsg) {
|
|
@@ -47785,8 +47821,7 @@ var XMLParser = class {
|
|
|
47785
47821
|
const result = validate(xmlData, validationOption);
|
|
47786
47822
|
if (result !== true) throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
|
|
47787
47823
|
}
|
|
47788
|
-
const orderedObjParser = new OrderedObjParser(this.options);
|
|
47789
|
-
orderedObjParser.entityDecoder.setExternalEntities(this.externalEntities);
|
|
47824
|
+
const orderedObjParser = new OrderedObjParser(this.options, this.externalEntities);
|
|
47790
47825
|
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
47791
47826
|
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
47792
47827
|
else return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
|
|
@@ -48768,6 +48803,25 @@ async function transformTempMessageCreated(ctx, message) {
|
|
|
48768
48803
|
}
|
|
48769
48804
|
}
|
|
48770
48805
|
/**
|
|
48806
|
+
* Transform NTQQ message-deleted event to Milky message_recall event (temp)
|
|
48807
|
+
*/
|
|
48808
|
+
async function transformTempMessageDeleted(ctx, message) {
|
|
48809
|
+
try {
|
|
48810
|
+
const revokeElement = message.elements[0].grayTipElement.revokeElement;
|
|
48811
|
+
return {
|
|
48812
|
+
message_scene: "temp",
|
|
48813
|
+
peer_id: Number(message.peerUin),
|
|
48814
|
+
message_seq: Number(message.msgSeq),
|
|
48815
|
+
sender_id: Number(message.senderUin),
|
|
48816
|
+
operator_id: Number(message.senderUin),
|
|
48817
|
+
display_suffix: revokeElement.wording
|
|
48818
|
+
};
|
|
48819
|
+
} catch (error) {
|
|
48820
|
+
ctx.logger.error("Failed to transform temp message deleted event:", error);
|
|
48821
|
+
return null;
|
|
48822
|
+
}
|
|
48823
|
+
}
|
|
48824
|
+
/**
|
|
48771
48825
|
* Transform NTQQ message-deleted event to Milky message_recall event (private)
|
|
48772
48826
|
*/
|
|
48773
48827
|
async function transformPrivateMessageDeleted(ctx, message) {
|
|
@@ -48778,7 +48832,7 @@ async function transformPrivateMessageDeleted(ctx, message) {
|
|
|
48778
48832
|
peer_id: Number(message.peerUin),
|
|
48779
48833
|
message_seq: Number(message.msgSeq),
|
|
48780
48834
|
sender_id: Number(message.senderUin),
|
|
48781
|
-
operator_id: Number(
|
|
48835
|
+
operator_id: Number(message.senderUin),
|
|
48782
48836
|
display_suffix: revokeElement.wording
|
|
48783
48837
|
};
|
|
48784
48838
|
} catch (error) {
|
|
@@ -48792,12 +48846,15 @@ async function transformPrivateMessageDeleted(ctx, message) {
|
|
|
48792
48846
|
async function transformGroupMessageDeleted(ctx, message) {
|
|
48793
48847
|
try {
|
|
48794
48848
|
const revokeElement = message.elements[0].grayTipElement.revokeElement;
|
|
48849
|
+
let operatorUin;
|
|
48850
|
+
if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operatorUin = message.senderUin;
|
|
48851
|
+
else operatorUin = await ctx.ntUserApi.getUinByUid(revokeElement.operatorUid);
|
|
48795
48852
|
return {
|
|
48796
48853
|
message_scene: "group",
|
|
48797
48854
|
peer_id: Number(message.peerUin),
|
|
48798
48855
|
message_seq: Number(message.msgSeq),
|
|
48799
48856
|
sender_id: Number(message.senderUin),
|
|
48800
|
-
operator_id: Number(
|
|
48857
|
+
operator_id: Number(operatorUin),
|
|
48801
48858
|
display_suffix: revokeElement.wording
|
|
48802
48859
|
};
|
|
48803
48860
|
} catch (error) {
|
|
@@ -49209,6 +49266,9 @@ var MilkyAdapter = class extends Service {
|
|
|
49209
49266
|
} else if (message.chatType === ChatType.Group) {
|
|
49210
49267
|
const eventData = await transformGroupMessageDeleted(this.ctx, message);
|
|
49211
49268
|
if (eventData) this.emitEvent("message_recall", eventData);
|
|
49269
|
+
} else if (message.chatType === ChatType.TempC2CFromGroup) {
|
|
49270
|
+
const eventData = await transformTempMessageDeleted(this.ctx, message);
|
|
49271
|
+
if (eventData) this.emitEvent("message_recall", eventData);
|
|
49212
49272
|
}
|
|
49213
49273
|
});
|
|
49214
49274
|
this.ctx.on("nt/message-sent", async (message) => {
|
|
@@ -54363,7 +54423,7 @@ var NTQQWebApi = class extends Service {
|
|
|
54363
54423
|
const iBatchID = Math.floor(Date.now() / 1e3);
|
|
54364
54424
|
for (let i = 0; i < filePathList.length; i++) {
|
|
54365
54425
|
const filePath = filePathList[i];
|
|
54366
|
-
const fileBuffer = await
|
|
54426
|
+
const fileBuffer = await fsPromise.readFile(filePath);
|
|
54367
54427
|
const fileSize = fileBuffer.length;
|
|
54368
54428
|
const checksum = await getMd5HexFromFile(filePath);
|
|
54369
54429
|
const getSessionUrl = `https://${domain}/webapp/json/sliceUpload/FileBatchControl/${checksum}?g_tk=${gtk}`;
|
|
@@ -55836,7 +55896,7 @@ var Config = class extends Service {
|
|
|
55836
55896
|
this.logger.info("配置文件位于", this.configPath);
|
|
55837
55897
|
this.config = this.get();
|
|
55838
55898
|
if (this.configPath) {
|
|
55839
|
-
fs$
|
|
55899
|
+
fs$1.watchFile(this.configPath, {
|
|
55840
55900
|
persistent: true,
|
|
55841
55901
|
interval: 1e3
|
|
55842
55902
|
}, () => {
|
|
@@ -55854,7 +55914,7 @@ var Config = class extends Service {
|
|
|
55854
55914
|
}
|
|
55855
55915
|
getDefaultConfig() {
|
|
55856
55916
|
const _defaultConfig = { ...defaultConfig };
|
|
55857
|
-
const defaultConfigFromFile = fs$
|
|
55917
|
+
const defaultConfigFromFile = fs$1.readFileSync(this.defaultConfigPath, "utf-8");
|
|
55858
55918
|
try {
|
|
55859
55919
|
const parsedDefaultConfig = import_dist.default.parse(defaultConfigFromFile);
|
|
55860
55920
|
Object.assign(_defaultConfig, parsedDefaultConfig);
|
|
@@ -55865,12 +55925,12 @@ var Config = class extends Service {
|
|
|
55865
55925
|
}
|
|
55866
55926
|
reloadConfig() {
|
|
55867
55927
|
if (!this.configPath) return this.getDefaultConfig();
|
|
55868
|
-
if (!fs$
|
|
55928
|
+
if (!fs$1.existsSync(this.configPath)) {
|
|
55869
55929
|
this.config = this.getDefaultConfig();
|
|
55870
55930
|
this.set(this.config);
|
|
55871
55931
|
return this.config;
|
|
55872
55932
|
} else {
|
|
55873
|
-
const data = fs$
|
|
55933
|
+
const data = fs$1.readFileSync(this.configPath, "utf-8");
|
|
55874
55934
|
let jsonData = defaultConfig;
|
|
55875
55935
|
try {
|
|
55876
55936
|
jsonData = import_dist.default.parse(data);
|
|
@@ -55896,7 +55956,7 @@ var Config = class extends Service {
|
|
|
55896
55956
|
writeConfig(config) {
|
|
55897
55957
|
if (!this.configPath) return;
|
|
55898
55958
|
this.watch = false;
|
|
55899
|
-
fs$
|
|
55959
|
+
fs$1.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
55900
55960
|
setTimeout(() => {
|
|
55901
55961
|
this.watch = true;
|
|
55902
55962
|
}, 1500);
|
|
@@ -56002,13 +56062,13 @@ var WebUITokenUtil = class {
|
|
|
56002
56062
|
}
|
|
56003
56063
|
getToken() {
|
|
56004
56064
|
if (!this.token) {
|
|
56005
|
-
if (fs$
|
|
56065
|
+
if (fs$1.existsSync(this.tokenPath)) this.token = fs$1.readFileSync(this.tokenPath, "utf-8").trim();
|
|
56006
56066
|
}
|
|
56007
56067
|
return this.token;
|
|
56008
56068
|
}
|
|
56009
56069
|
setToken(token) {
|
|
56010
56070
|
this.token = token.trim();
|
|
56011
|
-
fs$
|
|
56071
|
+
fs$1.writeFileSync(this.tokenPath, token, "utf-8");
|
|
56012
56072
|
}
|
|
56013
56073
|
};
|
|
56014
56074
|
var webuiTokenUtil = new WebUITokenUtil(path.join(DATA_DIR, "webui_token.txt"));
|
|
@@ -57984,7 +58044,7 @@ var package_exports = /* @__PURE__ */ __exportAll({
|
|
|
57984
58044
|
var name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, engines, package_default;
|
|
57985
58045
|
var init_package = __esmMin((() => {
|
|
57986
58046
|
name = "nodemailer";
|
|
57987
|
-
version = "8.0.
|
|
58047
|
+
version = "8.0.6";
|
|
57988
58048
|
description = "Easy as cake e-mail sending from your Node.js applications";
|
|
57989
58049
|
main = "lib/nodemailer.js";
|
|
57990
58050
|
scripts = {
|
|
@@ -58284,7 +58344,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
58284
58344
|
var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
58285
58345
|
var urllib$2 = __require("url");
|
|
58286
58346
|
var util$1 = __require("util");
|
|
58287
|
-
var fs$
|
|
58347
|
+
var fs$4 = __require("fs");
|
|
58288
58348
|
var nmfetch = require_fetch();
|
|
58289
58349
|
var dns$1 = __require("dns");
|
|
58290
58350
|
var net$4 = __require("net");
|
|
@@ -58620,7 +58680,7 @@ var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
58620
58680
|
const parsedDataUri = module.exports.parseDataURI(content.path || content.href);
|
|
58621
58681
|
if (!parsedDataUri || !parsedDataUri.data) return callback(null, Buffer.from(0));
|
|
58622
58682
|
return callback(null, parsedDataUri.data);
|
|
58623
|
-
} else if (content.path) return resolveStream(fs$
|
|
58683
|
+
} else if (content.path) return resolveStream(fs$4.createReadStream(content.path), callback);
|
|
58624
58684
|
}
|
|
58625
58685
|
if (typeof data[key].content === "string" && ![
|
|
58626
58686
|
"utf8",
|
|
@@ -61568,11 +61628,11 @@ var require_base64 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61568
61628
|
const chunkLength = lineLength * 1024;
|
|
61569
61629
|
const wrapRegex = new RegExp(".{" + lineLength + "}", "g");
|
|
61570
61630
|
while (pos < str.length) {
|
|
61571
|
-
const wrappedLines = str.substr(pos, chunkLength).replace(wrapRegex, "$&\r\n");
|
|
61631
|
+
const wrappedLines = str.substr(pos, chunkLength).replace(wrapRegex, "$&\r\n").trim();
|
|
61572
61632
|
result.push(wrappedLines);
|
|
61573
61633
|
pos += chunkLength;
|
|
61574
61634
|
}
|
|
61575
|
-
return result.join("");
|
|
61635
|
+
return result.join("\r\n").trim();
|
|
61576
61636
|
}
|
|
61577
61637
|
/**
|
|
61578
61638
|
* Creates a transform stream for encoding data to base64 encoding
|
|
@@ -61610,12 +61670,12 @@ var require_base64 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61610
61670
|
if (lastLF < 0) {
|
|
61611
61671
|
this._curLine = b64;
|
|
61612
61672
|
b64 = "";
|
|
61613
|
-
} else
|
|
61673
|
+
} else if (lastLF === b64.length - 1) this._curLine = "";
|
|
61674
|
+
else {
|
|
61614
61675
|
this._curLine = b64.substring(lastLF + 1);
|
|
61615
61676
|
b64 = b64.substring(0, lastLF + 1);
|
|
61616
|
-
if (b64 && !b64.endsWith("\r\n")) b64 += "\r\n";
|
|
61617
61677
|
}
|
|
61618
|
-
}
|
|
61678
|
+
}
|
|
61619
61679
|
if (b64) {
|
|
61620
61680
|
this.outputBytes += b64.length;
|
|
61621
61681
|
this.push(Buffer.from(b64, "ascii"));
|
|
@@ -61625,6 +61685,7 @@ var require_base64 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61625
61685
|
_flush(done) {
|
|
61626
61686
|
if (this._remainingBytes && this._remainingBytes.length) this._curLine += encode(this._remainingBytes);
|
|
61627
61687
|
if (this._curLine) {
|
|
61688
|
+
this._curLine = wrap(this._curLine, this.options.lineLength);
|
|
61628
61689
|
this.outputBytes += this._curLine.length;
|
|
61629
61690
|
this.push(Buffer.from(this._curLine, "ascii"));
|
|
61630
61691
|
this._curLine = "";
|
|
@@ -62559,7 +62620,7 @@ var require_le_unix = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62559
62620
|
//#region node_modules/nodemailer/lib/mime-node/index.js
|
|
62560
62621
|
var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
62561
62622
|
var crypto$8 = __require("crypto");
|
|
62562
|
-
var fs$
|
|
62623
|
+
var fs$3 = __require("fs");
|
|
62563
62624
|
var punycode = require_punycode();
|
|
62564
62625
|
var { PassThrough: PassThrough$2 } = __require("stream");
|
|
62565
62626
|
var shared = require_shared();
|
|
@@ -63268,7 +63329,7 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
63268
63329
|
});
|
|
63269
63330
|
return contentStream;
|
|
63270
63331
|
}
|
|
63271
|
-
return fs$
|
|
63332
|
+
return fs$3.createReadStream(content.path);
|
|
63272
63333
|
}
|
|
63273
63334
|
if (content && typeof content.href === "string") {
|
|
63274
63335
|
if (this.disableUrlAccess) {
|
|
@@ -64106,7 +64167,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
64106
64167
|
var RelaxedBody = require_relaxed_body();
|
|
64107
64168
|
var sign = require_sign();
|
|
64108
64169
|
var { PassThrough: PassThrough$1 } = __require("stream");
|
|
64109
|
-
var fs$
|
|
64170
|
+
var fs$2 = __require("fs");
|
|
64110
64171
|
var path$2 = __require("path");
|
|
64111
64172
|
var crypto$5 = __require("crypto");
|
|
64112
64173
|
var DKIM_ALGO = "sha256";
|
|
@@ -64139,10 +64200,10 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
64139
64200
|
}
|
|
64140
64201
|
cleanup() {
|
|
64141
64202
|
if (!this.cache || !this.cachePath) return;
|
|
64142
|
-
fs$
|
|
64203
|
+
fs$2.unlink(this.cachePath, () => false);
|
|
64143
64204
|
}
|
|
64144
64205
|
createReadCache() {
|
|
64145
|
-
this.cache = fs$
|
|
64206
|
+
this.cache = fs$2.createReadStream(this.cachePath);
|
|
64146
64207
|
this.cache.once("error", (err) => {
|
|
64147
64208
|
this.cleanup();
|
|
64148
64209
|
this.output.emit("error", err);
|
|
@@ -64188,7 +64249,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
64188
64249
|
}
|
|
64189
64250
|
createWriteCache() {
|
|
64190
64251
|
this.output.usingCache = true;
|
|
64191
|
-
this.cache = fs$
|
|
64252
|
+
this.cache = fs$2.createWriteStream(this.cachePath);
|
|
64192
64253
|
this.cache.once("error", (err) => {
|
|
64193
64254
|
this.cleanup();
|
|
64194
64255
|
this.relaxedBody.unpipe(this.cache);
|
|
@@ -70227,7 +70288,7 @@ function UserMixin(Base) {
|
|
|
70227
70288
|
qid: bytes[27394]?.toString() ?? "",
|
|
70228
70289
|
level: numbers[105],
|
|
70229
70290
|
regTime: numbers[20026] ?? 0,
|
|
70230
|
-
longNick: bytes[102]
|
|
70291
|
+
longNick: bytes[102]?.toString() ?? "",
|
|
70231
70292
|
city: bytes[20020]?.toString() ?? "",
|
|
70232
70293
|
country: bytes[20003]?.toString() ?? "",
|
|
70233
70294
|
birthdayYear: bytes[20031]?.[0] << 8 | bytes[20031]?.[1],
|