llonebot-dist 7.12.7 → 7.12.8
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, { existsSync } from "fs";
|
|
6
|
-
import * as fs$
|
|
7
|
-
import fs$
|
|
4
|
+
import fs, { access, 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";
|
|
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
|
|
24
|
+
import fsPromise, { 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$
|
|
3976
|
+
var fs$11 = __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$
|
|
4028
|
+
const stream = fs$11.createWriteStream(path);
|
|
4029
4029
|
stream.on("error", done);
|
|
4030
4030
|
stream.on("close", done);
|
|
4031
4031
|
exports.renderToFileStream(stream, qrData, options);
|
|
@@ -6624,7 +6624,7 @@ async function logSummaryMessage(ctx, message) {
|
|
|
6624
6624
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6625
6625
|
module.exports = isexe;
|
|
6626
6626
|
isexe.sync = sync;
|
|
6627
|
-
var fs$
|
|
6627
|
+
var fs$10 = __require("fs");
|
|
6628
6628
|
function checkPathExt(path, options) {
|
|
6629
6629
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
6630
6630
|
if (!pathext) return true;
|
|
@@ -6641,12 +6641,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6641
6641
|
return checkPathExt(path, options);
|
|
6642
6642
|
}
|
|
6643
6643
|
function isexe(path, options, cb) {
|
|
6644
|
-
fs$
|
|
6644
|
+
fs$10.stat(path, function(er, stat) {
|
|
6645
6645
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
6646
6646
|
});
|
|
6647
6647
|
}
|
|
6648
6648
|
function sync(path, options) {
|
|
6649
|
-
return checkStat(fs$
|
|
6649
|
+
return checkStat(fs$10.statSync(path), path, options);
|
|
6650
6650
|
}
|
|
6651
6651
|
}));
|
|
6652
6652
|
//#endregion
|
|
@@ -6654,14 +6654,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6654
6654
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6655
6655
|
module.exports = isexe;
|
|
6656
6656
|
isexe.sync = sync;
|
|
6657
|
-
var fs$
|
|
6657
|
+
var fs$9 = __require("fs");
|
|
6658
6658
|
function isexe(path, options, cb) {
|
|
6659
|
-
fs$
|
|
6659
|
+
fs$9.stat(path, function(er, stat) {
|
|
6660
6660
|
cb(er, er ? false : checkStat(stat, options));
|
|
6661
6661
|
});
|
|
6662
6662
|
}
|
|
6663
6663
|
function sync(path, options) {
|
|
6664
|
-
return checkStat(fs$
|
|
6664
|
+
return checkStat(fs$9.statSync(path), options);
|
|
6665
6665
|
}
|
|
6666
6666
|
function checkStat(stat, options) {
|
|
6667
6667
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -9153,7 +9153,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9153
9153
|
//#endregion
|
|
9154
9154
|
//#region node_modules/fluent-ffmpeg/lib/capabilities.js
|
|
9155
9155
|
var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9156
|
-
var fs$
|
|
9156
|
+
var fs$8 = __require("fs");
|
|
9157
9157
|
var path$7 = __require("path");
|
|
9158
9158
|
var async = require_async();
|
|
9159
9159
|
var utils = require_utils();
|
|
@@ -9229,7 +9229,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9229
9229
|
proto._getFfmpegPath = function(callback) {
|
|
9230
9230
|
if ("ffmpegPath" in cache) return callback(null, cache.ffmpegPath);
|
|
9231
9231
|
async.waterfall([function(cb) {
|
|
9232
|
-
if (process.env.FFMPEG_PATH) fs$
|
|
9232
|
+
if (process.env.FFMPEG_PATH) fs$8.exists(process.env.FFMPEG_PATH, function(exists) {
|
|
9233
9233
|
if (exists) cb(null, process.env.FFMPEG_PATH);
|
|
9234
9234
|
else cb(null, "");
|
|
9235
9235
|
});
|
|
@@ -9260,7 +9260,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9260
9260
|
if ("ffprobePath" in cache) return callback(null, cache.ffprobePath);
|
|
9261
9261
|
async.waterfall([
|
|
9262
9262
|
function(cb) {
|
|
9263
|
-
if (process.env.FFPROBE_PATH) fs$
|
|
9263
|
+
if (process.env.FFPROBE_PATH) fs$8.exists(process.env.FFPROBE_PATH, function(exists) {
|
|
9264
9264
|
cb(null, exists ? process.env.FFPROBE_PATH : "");
|
|
9265
9265
|
});
|
|
9266
9266
|
else cb(null, "");
|
|
@@ -9278,7 +9278,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9278
9278
|
else if (ffmpeg.length) {
|
|
9279
9279
|
var name = utils.isWindows ? "ffprobe.exe" : "ffprobe";
|
|
9280
9280
|
var ffprobe = path$7.join(path$7.dirname(ffmpeg), name);
|
|
9281
|
-
fs$
|
|
9281
|
+
fs$8.exists(ffprobe, function(exists) {
|
|
9282
9282
|
cb(null, exists ? ffprobe : "");
|
|
9283
9283
|
});
|
|
9284
9284
|
} else cb(null, "");
|
|
@@ -9303,14 +9303,14 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9303
9303
|
if ("flvtoolPath" in cache) return callback(null, cache.flvtoolPath);
|
|
9304
9304
|
async.waterfall([
|
|
9305
9305
|
function(cb) {
|
|
9306
|
-
if (process.env.FLVMETA_PATH) fs$
|
|
9306
|
+
if (process.env.FLVMETA_PATH) fs$8.exists(process.env.FLVMETA_PATH, function(exists) {
|
|
9307
9307
|
cb(null, exists ? process.env.FLVMETA_PATH : "");
|
|
9308
9308
|
});
|
|
9309
9309
|
else cb(null, "");
|
|
9310
9310
|
},
|
|
9311
9311
|
function(flvtool, cb) {
|
|
9312
9312
|
if (flvtool.length) return cb(null, flvtool);
|
|
9313
|
-
if (process.env.FLVTOOL2_PATH) fs$
|
|
9313
|
+
if (process.env.FLVTOOL2_PATH) fs$8.exists(process.env.FLVTOOL2_PATH, function(exists) {
|
|
9314
9314
|
cb(null, exists ? process.env.FLVTOOL2_PATH : "");
|
|
9315
9315
|
});
|
|
9316
9316
|
else cb(null, "");
|
|
@@ -9815,7 +9815,7 @@ var require_ffprobe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9815
9815
|
//#endregion
|
|
9816
9816
|
//#region node_modules/fluent-ffmpeg/lib/recipes.js
|
|
9817
9817
|
var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9818
|
-
var fs$
|
|
9818
|
+
var fs$7 = __require("fs");
|
|
9819
9819
|
var path$6 = __require("path");
|
|
9820
9820
|
var PassThrough$4 = __require("stream").PassThrough;
|
|
9821
9821
|
var async = require_async();
|
|
@@ -10021,8 +10021,8 @@ var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10021
10021
|
next(null, filenames);
|
|
10022
10022
|
},
|
|
10023
10023
|
function createDirectory(filenames, next) {
|
|
10024
|
-
fs$
|
|
10025
|
-
if (!exists) fs$
|
|
10024
|
+
fs$7.exists(config.folder, function(exists) {
|
|
10025
|
+
if (!exists) fs$7.mkdir(config.folder, function(err) {
|
|
10026
10026
|
if (err) next(err);
|
|
10027
10027
|
else next(null, filenames);
|
|
10028
10028
|
});
|
|
@@ -10270,7 +10270,7 @@ function setFFMpegPath(ffmpegPath) {
|
|
|
10270
10270
|
path.join(import.meta.dirname, "ffmpeg.exe"),
|
|
10271
10271
|
process.env["FFMPEG_PATH"] || ""
|
|
10272
10272
|
];
|
|
10273
|
-
for (const p of paths) if (fs$
|
|
10273
|
+
for (const p of paths) if (fs$2.existsSync(p)) {
|
|
10274
10274
|
import_fluent_ffmpeg.default.setFfmpegPath(p);
|
|
10275
10275
|
console.log("set ffmpeg successfully", p);
|
|
10276
10276
|
break;
|
|
@@ -11385,7 +11385,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
|
|
|
11385
11385
|
};
|
|
11386
11386
|
//#endregion
|
|
11387
11387
|
//#region src/version.ts
|
|
11388
|
-
var version$2 = "7.12.
|
|
11388
|
+
var version$2 = "7.12.8";
|
|
11389
11389
|
//#endregion
|
|
11390
11390
|
//#region node_modules/sift/es5m/index.js
|
|
11391
11391
|
/******************************************************************************
|
|
@@ -17045,7 +17045,7 @@ var processQueue = async () => {
|
|
|
17045
17045
|
const promises = queue.splice(0, concurrency).map(async ({ filePath, resolve, reject }) => {
|
|
17046
17046
|
let handle;
|
|
17047
17047
|
try {
|
|
17048
|
-
handle = await fs$
|
|
17048
|
+
handle = await fs$6.promises.open(path$4.resolve(filePath), "r");
|
|
17049
17049
|
} catch (err) {
|
|
17050
17050
|
return reject(err);
|
|
17051
17051
|
}
|
|
@@ -17092,7 +17092,7 @@ function checkUriType(uri) {
|
|
|
17092
17092
|
if (uri.startsWith("data:")) return { type: FileUriType.DataURL };
|
|
17093
17093
|
if (uri.startsWith("http://") || uri.startsWith("https://")) return { type: FileUriType.RemoteURL };
|
|
17094
17094
|
if (uri.startsWith("file://")) return { type: FileUriType.FileURL };
|
|
17095
|
-
if (fs$
|
|
17095
|
+
if (fs$2.existsSync(uri)) return { type: FileUriType.Path };
|
|
17096
17096
|
return { type: FileUriType.Unknown };
|
|
17097
17097
|
}
|
|
17098
17098
|
async function fetchFile(url, headersInit) {
|
|
@@ -17122,7 +17122,7 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17122
17122
|
const { type } = checkUriType(uri);
|
|
17123
17123
|
if (type === FileUriType.FileURL) {
|
|
17124
17124
|
const filePath = fileURLToPath(uri);
|
|
17125
|
-
if (!fs$
|
|
17125
|
+
if (!fs$2.existsSync(filePath)) return {
|
|
17126
17126
|
success: false,
|
|
17127
17127
|
errMsg: "路径不存在",
|
|
17128
17128
|
fileName: "",
|
|
@@ -17148,12 +17148,12 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17148
17148
|
const res = await fetchFile(uri);
|
|
17149
17149
|
let fileName = randomUUID();
|
|
17150
17150
|
let filePath = path.join(TEMP_DIR, fileName);
|
|
17151
|
-
await
|
|
17151
|
+
await fs.writeFile(filePath, res.data);
|
|
17152
17152
|
if (needExt) {
|
|
17153
17153
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
17154
17154
|
fileName += `.${ext}`;
|
|
17155
17155
|
const newPath = `${filePath}.${ext}`;
|
|
17156
|
-
await
|
|
17156
|
+
await fs.rename(filePath, newPath);
|
|
17157
17157
|
filePath = newPath;
|
|
17158
17158
|
}
|
|
17159
17159
|
return {
|
|
@@ -17176,11 +17176,11 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17176
17176
|
let filename = randomUUID();
|
|
17177
17177
|
let filePath = path.join(TEMP_DIR, filename);
|
|
17178
17178
|
const base64 = uri.replace(/^base64:\/\//, "");
|
|
17179
|
-
await
|
|
17179
|
+
await fs.writeFile(filePath, base64, "base64");
|
|
17180
17180
|
if (needExt) {
|
|
17181
17181
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
17182
17182
|
filename += `.${ext}`;
|
|
17183
|
-
await
|
|
17183
|
+
await fs.rename(filePath, `${filePath}.${ext}`);
|
|
17184
17184
|
filePath = `${filePath}.${ext}`;
|
|
17185
17185
|
}
|
|
17186
17186
|
return {
|
|
@@ -17197,11 +17197,11 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17197
17197
|
let filename = randomUUID();
|
|
17198
17198
|
const [, _type, base64] = capture;
|
|
17199
17199
|
let filePath = path.join(TEMP_DIR, filename);
|
|
17200
|
-
await
|
|
17200
|
+
await fs.writeFile(filePath, base64, "base64");
|
|
17201
17201
|
if (needExt) {
|
|
17202
17202
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
17203
17203
|
filename += `.${ext}`;
|
|
17204
|
-
await
|
|
17204
|
+
await fs.rename(filePath, `${filePath}.${ext}`);
|
|
17205
17205
|
filePath = `${filePath}.${ext}`;
|
|
17206
17206
|
}
|
|
17207
17207
|
return {
|
|
@@ -17265,13 +17265,13 @@ function getSha1HexFromBuffer(buf) {
|
|
|
17265
17265
|
}
|
|
17266
17266
|
async function getMd5HexFromFile(filePath) {
|
|
17267
17267
|
const hash = createHash("md5");
|
|
17268
|
-
const stream = fs$
|
|
17268
|
+
const stream = fs$2.createReadStream(filePath);
|
|
17269
17269
|
for await (const chunk of stream) hash.update(chunk);
|
|
17270
17270
|
return hash.digest("hex");
|
|
17271
17271
|
}
|
|
17272
17272
|
async function getSha1HexFromFile(filePath) {
|
|
17273
17273
|
const hash = createHash("sha1");
|
|
17274
|
-
const stream = fs$
|
|
17274
|
+
const stream = fs$2.createReadStream(filePath);
|
|
17275
17275
|
for await (const chunk of stream) hash.update(chunk);
|
|
17276
17276
|
return hash.digest("hex");
|
|
17277
17277
|
}
|
|
@@ -17280,13 +17280,13 @@ function getMd5BufferFromBuffer(buf) {
|
|
|
17280
17280
|
}
|
|
17281
17281
|
async function getMd5BufferFromFile(filePath) {
|
|
17282
17282
|
const hash = createHash("md5");
|
|
17283
|
-
const stream = fs$
|
|
17283
|
+
const stream = fs$2.createReadStream(filePath);
|
|
17284
17284
|
for await (const chunk of stream) hash.update(chunk);
|
|
17285
17285
|
return hash.digest();
|
|
17286
17286
|
}
|
|
17287
17287
|
async function getSha1BufferFromFile(filePath) {
|
|
17288
17288
|
const hash = createHash("sha1");
|
|
17289
|
-
const stream = fs$
|
|
17289
|
+
const stream = fs$2.createReadStream(filePath);
|
|
17290
17290
|
for await (const chunk of stream) hash.update(chunk);
|
|
17291
17291
|
return hash.digest();
|
|
17292
17292
|
}
|
|
@@ -17522,7 +17522,7 @@ async function calculateSha1StreamBytes(filePath) {
|
|
|
17522
17522
|
let bytesRead = 0;
|
|
17523
17523
|
let nextBlockBoundary = blockSize;
|
|
17524
17524
|
const byteArrayList = [];
|
|
17525
|
-
const readable = fs$
|
|
17525
|
+
const readable = fs$2.createReadStream(filePath);
|
|
17526
17526
|
for await (const chunk of readable) {
|
|
17527
17527
|
let buf;
|
|
17528
17528
|
if (tail.length > 0) {
|
|
@@ -17547,7 +17547,7 @@ async function calculateSha1StreamBytes(filePath) {
|
|
|
17547
17547
|
}
|
|
17548
17548
|
async function readAndHash10M(filePath) {
|
|
17549
17549
|
const maxSize = 10002432;
|
|
17550
|
-
const fd = await
|
|
17550
|
+
const fd = await fs.open(filePath, "r");
|
|
17551
17551
|
const buffer = Buffer.allocUnsafe(maxSize);
|
|
17552
17552
|
const { bytesRead } = await fd.read(buffer, 0, maxSize, 0);
|
|
17553
17553
|
await fd.close();
|
|
@@ -17589,13 +17589,13 @@ var TriSha1 = class {
|
|
|
17589
17589
|
};
|
|
17590
17590
|
async function calculateTriSha1(filePath, fileSize) {
|
|
17591
17591
|
const hash = new TriSha1(fileSize);
|
|
17592
|
-
const stream = fs$
|
|
17592
|
+
const stream = fs$2.createReadStream(filePath);
|
|
17593
17593
|
for await (const chunk of stream) hash.update(chunk);
|
|
17594
17594
|
return hash.finalize();
|
|
17595
17595
|
}
|
|
17596
17596
|
var defaultVideoThumb = Buffer.from("/9j/4AAQSkZJRgABAQAAAQABAAD//gAXR2VuZXJhdGVkIGJ5IFNuaXBhc3Rl/9sAhAAKBwcIBwYKCAgICwoKCw4YEA4NDQ4dFRYRGCMfJSQiHyIhJis3LyYpNCkhIjBBMTQ5Oz4+PiUuRElDPEg3PT47AQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAF/APADAREAAhEBAxEB/8QBogAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoLEAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR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AgzQBPWZqFAgoAWgBaYC0CGmmBG1AyM0ANJoATNACZoAXNABmgAzQAUAJQAhoAQ0xDTQISmAUALQAUgHA0AKDTAdmgQuaBBQAtAFiszQKACgBaAFFMAoEIaYEbUDI2oAYaAEoASgAzQAuaACgAoAKAENMQ00AJTEFAhKACgAoAXNACg0AOBoAWgQtAC0AWazNAoAKACgBaYBQIQ0AMNMYw0AMIoAbQAlMAoAKACgAzSAKYhKAENACUxBQIKACgBKACgBaAHCgQ4UALQAUAWqzNAoAKACgApgFACGgQ00xjTQAwigBCKAG4pgJQAlABQAUCCgBKACgBKYgoEFABQISgAoAWgBRQA4UALQAUCLdZmoUAFABQAlMAoASgBDQA00wENACYoATFMBpFADSKAEoEJQAUAFABQAlMQtAgoASgQUAJQAUAKKAHCgBaBBQBbrM1CgAoAKACmAUAJQAlADaYBQAlACYpgIRQA0igBpFAhtABQAUAFMAoEFABQIKAEoASgQUALQAooAWgQUAW81mbC0CCgApgFACUAIaAEpgJQAUAFABQAhFMBpFADSKAGkUCExQAYoAMUAGKADFMQYoAMUCExSATFABQIKYBQAtABQIt5qDYM0ALmgQtIApgIaAENADaACmAlAC0ALQAUwGkUANIoAaRQAmKBBigAxQAYoAMUAGKBBigBMUAJigQmKAExTAKBC0AFAFnNQaig0AKDQAtAgoASgBDQAlMBKACgAFADhQAtMBCKAGkUAIRQAmKADFABigQmKADFACYoAXFABigQmKAExQAmKBCYpgJigAoAnzUGgZoAcDQAuaBC0AJQAhoASmAlABQAtADhQAtMAoATFACEUAJigAxQAYoATFAhMUAFABQAuKADFABigBpWgBCKBCYpgJigB+ag0DNADgaBDgaAFzQITNACUAJTAKACgBRQAopgOoAWgBKAEoAKACgAoASgBpoEJQAooAWgBaBhigBMUCEIoAQigBMUAJSLCgBQaBDgaQC5oEFACUwCgBKACmAtADhQA4UALQAUAJQAUAJQAUAJQAhoENoAWgBRQAooGLQAUAGKAGkUAIRQIZSKEoGKKBDhQAUCCgAoAKBBQAUwFoGKKAHCgB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KYhKACgBKAGmgBpoGMNAxDQAlAwzQIUUAOFAhwoAcKBC0AJQAhoGNNACUAFABQAZoAXNABQAUAS0ixKACgQoNAhaYgoEFACUABoAaaAGmgYw0DENAxtABQAooEOFADhQIcKAFoASgBDQAhoGJQAUAFACUALQIKBi0CJDSLEoATNAhc0CHZpiCgQUAJQIKBjTQAhoGNNAxpoATFABigBQKAHCgBwoAWgAoAKACgBKAEoASgAoASgBaAAUAOoEONIoaTQAZoAUGmIUGgQtAgzQISgAoAQ0DGmgYlAxKACgAxQAtACigBRQAtAxaACgAoATFABigBCKAG0CEoAWgBRTAUUAf//Z", "base64");
|
|
17597
17597
|
async function getVideoInfo(filePath) {
|
|
17598
|
-
const size = fs$
|
|
17598
|
+
const size = fs$2.statSync(filePath).size;
|
|
17599
17599
|
return new Promise((resolve, reject) => {
|
|
17600
17600
|
(0, import_fluent_ffmpeg.default)(filePath).ffprobe((err, metadata) => {
|
|
17601
17601
|
if (err) reject(err);
|
|
@@ -17672,7 +17672,7 @@ function convert(ctx, input, options, outputPath) {
|
|
|
17672
17672
|
});
|
|
17673
17673
|
}
|
|
17674
17674
|
async function encodeSilk(ctx, filePath) {
|
|
17675
|
-
const file = await
|
|
17675
|
+
const file = await fs.readFile(filePath);
|
|
17676
17676
|
if (!isSilk(file)) {
|
|
17677
17677
|
ctx.logger.info(`语音文件${filePath}需要转换成silk`);
|
|
17678
17678
|
let result;
|
|
@@ -17691,7 +17691,7 @@ async function encodeSilk(ctx, filePath) {
|
|
|
17691
17691
|
"-f s16le"
|
|
17692
17692
|
] }), 24e3);
|
|
17693
17693
|
const pttPath = path.join(TEMP_DIR, randomUUID());
|
|
17694
|
-
await
|
|
17694
|
+
await fs.writeFile(pttPath, result.data);
|
|
17695
17695
|
ctx.logger.info(`语音文件${filePath}转换成功!`, pttPath, `时长:`, result.duration);
|
|
17696
17696
|
return {
|
|
17697
17697
|
converted: true,
|
|
@@ -17714,11 +17714,11 @@ async function encodeSilk(ctx, filePath) {
|
|
|
17714
17714
|
}
|
|
17715
17715
|
}
|
|
17716
17716
|
async function decodeSilk(ctx, inputFilePath, outFormat) {
|
|
17717
|
-
const { data } = await decode(await
|
|
17717
|
+
const { data } = await decode(await fs.readFile(inputFilePath), 24e3);
|
|
17718
17718
|
const tmpPath = path.join(TEMP_DIR, path.basename(inputFilePath));
|
|
17719
17719
|
const outFilePath = tmpPath + `.${outFormat}`;
|
|
17720
17720
|
const pcmFilePath = tmpPath + ".pcm";
|
|
17721
|
-
await
|
|
17721
|
+
await fs.writeFile(pcmFilePath, data);
|
|
17722
17722
|
return convert(ctx, pcmFilePath, { input: [
|
|
17723
17723
|
"-f s16le",
|
|
17724
17724
|
"-ar 24000",
|
|
@@ -21909,7 +21909,7 @@ var GetGroupMemberInfo$1 = class extends BaseAction {
|
|
|
21909
21909
|
} catch (e) {}
|
|
21910
21910
|
}
|
|
21911
21911
|
if (info) {
|
|
21912
|
-
this.ctx.logger.info(info
|
|
21912
|
+
this.ctx.logger.info(info);
|
|
21913
21913
|
ret.sex = OB11Entities.sex(info.simpleInfo.baseInfo.sex);
|
|
21914
21914
|
ret.qq_level = info.commonExt?.qqLevel && calcQQLevel(info.commonExt.qqLevel) || 0;
|
|
21915
21915
|
ret.age = info.simpleInfo.baseInfo.age ?? 0;
|
|
@@ -24883,17 +24883,17 @@ var DownloadFile = class extends BaseAction {
|
|
|
24883
24883
|
const isRandomName = !payload.name;
|
|
24884
24884
|
const name = payload.name ? path.basename(payload.name) : randomUUID();
|
|
24885
24885
|
const filePath = path.join(TEMP_DIR, name);
|
|
24886
|
-
if (payload.base64) await fsPromise
|
|
24886
|
+
if (payload.base64) await fsPromise.writeFile(filePath, payload.base64, "base64");
|
|
24887
24887
|
else if (payload.url) {
|
|
24888
24888
|
const headers = this.getHeaders(payload.headers);
|
|
24889
24889
|
const res = await fetchFile(payload.url, headers);
|
|
24890
|
-
await fsPromise
|
|
24890
|
+
await fsPromise.writeFile(filePath, res.data);
|
|
24891
24891
|
} else throw new Error("不存在任何文件, 无法下载");
|
|
24892
|
-
if (fs.existsSync(filePath)) {
|
|
24892
|
+
if (fs$1.existsSync(filePath)) {
|
|
24893
24893
|
if (isRandomName) {
|
|
24894
24894
|
const md5 = await getMd5HexFromFile(filePath);
|
|
24895
24895
|
const newPath = path.join(TEMP_DIR, md5);
|
|
24896
|
-
await fsPromise
|
|
24896
|
+
await fsPromise.rename(filePath, newPath);
|
|
24897
24897
|
return { file: newPath };
|
|
24898
24898
|
}
|
|
24899
24899
|
return { file: filePath };
|
|
@@ -43432,7 +43432,7 @@ async function download(url, headers) {
|
|
|
43432
43432
|
return Buffer.from(bytes);
|
|
43433
43433
|
}
|
|
43434
43434
|
async function resolveMilkyUri(uri) {
|
|
43435
|
-
if (uri.startsWith("file://")) return await
|
|
43435
|
+
if (uri.startsWith("file://")) return await fs.readFile(fileURLToPath(uri));
|
|
43436
43436
|
if (uri.startsWith("http://") || uri.startsWith("https://")) return await download(uri);
|
|
43437
43437
|
if (uri.startsWith("base64://")) return Buffer.from(uri.slice(9), "base64");
|
|
43438
43438
|
throw new Error(`Unsupported URI scheme: ${uri}`);
|
|
@@ -54298,7 +54298,7 @@ var NTQQWebApi = class extends Service {
|
|
|
54298
54298
|
const iBatchID = Math.floor(Date.now() / 1e3);
|
|
54299
54299
|
for (let i = 0; i < filePathList.length; i++) {
|
|
54300
54300
|
const filePath = filePathList[i];
|
|
54301
|
-
const fileBuffer = await
|
|
54301
|
+
const fileBuffer = await fs.readFile(filePath);
|
|
54302
54302
|
const fileSize = fileBuffer.length;
|
|
54303
54303
|
const fileType = await fileTypeFromBuffer(fileBuffer);
|
|
54304
54304
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
@@ -54483,7 +54483,7 @@ var NTQQWebApi = class extends Service {
|
|
|
54483
54483
|
}
|
|
54484
54484
|
if (sVid) {
|
|
54485
54485
|
const filePath = await createThumb(this.ctx, filePathList[i]);
|
|
54486
|
-
const fileBuffer = await
|
|
54486
|
+
const fileBuffer = await fs.readFile(filePath);
|
|
54487
54487
|
const fileSize = fileBuffer.length;
|
|
54488
54488
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
54489
54489
|
const checksum = getMd5HexFromBuffer(fileBuffer);
|
|
@@ -55975,7 +55975,7 @@ var Config = class extends Service {
|
|
|
55975
55975
|
this.logger.info("配置文件位于", this.configPath);
|
|
55976
55976
|
this.config = this.get();
|
|
55977
55977
|
if (this.configPath) {
|
|
55978
|
-
fs$
|
|
55978
|
+
fs$2.watchFile(this.configPath, {
|
|
55979
55979
|
persistent: true,
|
|
55980
55980
|
interval: 1e3
|
|
55981
55981
|
}, () => {
|
|
@@ -55993,7 +55993,7 @@ var Config = class extends Service {
|
|
|
55993
55993
|
}
|
|
55994
55994
|
getDefaultConfig() {
|
|
55995
55995
|
const _defaultConfig = { ...defaultConfig };
|
|
55996
|
-
const defaultConfigFromFile = fs$
|
|
55996
|
+
const defaultConfigFromFile = fs$2.readFileSync(this.defaultConfigPath, "utf-8");
|
|
55997
55997
|
try {
|
|
55998
55998
|
const parsedDefaultConfig = import_dist.default.parse(defaultConfigFromFile);
|
|
55999
55999
|
Object.assign(_defaultConfig, parsedDefaultConfig);
|
|
@@ -56004,12 +56004,12 @@ var Config = class extends Service {
|
|
|
56004
56004
|
}
|
|
56005
56005
|
reloadConfig() {
|
|
56006
56006
|
if (!this.configPath) return this.getDefaultConfig();
|
|
56007
|
-
if (!fs$
|
|
56007
|
+
if (!fs$2.existsSync(this.configPath)) {
|
|
56008
56008
|
this.config = this.getDefaultConfig();
|
|
56009
56009
|
this.set(this.config);
|
|
56010
56010
|
return this.config;
|
|
56011
56011
|
} else {
|
|
56012
|
-
const data = fs$
|
|
56012
|
+
const data = fs$2.readFileSync(this.configPath, "utf-8");
|
|
56013
56013
|
let jsonData = defaultConfig;
|
|
56014
56014
|
try {
|
|
56015
56015
|
jsonData = import_dist.default.parse(data);
|
|
@@ -56035,7 +56035,7 @@ var Config = class extends Service {
|
|
|
56035
56035
|
writeConfig(config) {
|
|
56036
56036
|
if (!this.configPath) return;
|
|
56037
56037
|
this.watch = false;
|
|
56038
|
-
fs$
|
|
56038
|
+
fs$2.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
56039
56039
|
setTimeout(() => {
|
|
56040
56040
|
this.watch = true;
|
|
56041
56041
|
}, 1500);
|
|
@@ -56141,13 +56141,13 @@ var WebUITokenUtil = class {
|
|
|
56141
56141
|
}
|
|
56142
56142
|
getToken() {
|
|
56143
56143
|
if (!this.token) {
|
|
56144
|
-
if (fs$
|
|
56144
|
+
if (fs$2.existsSync(this.tokenPath)) this.token = fs$2.readFileSync(this.tokenPath, "utf-8").trim();
|
|
56145
56145
|
}
|
|
56146
56146
|
return this.token;
|
|
56147
56147
|
}
|
|
56148
56148
|
setToken(token) {
|
|
56149
56149
|
this.token = token.trim();
|
|
56150
|
-
fs$
|
|
56150
|
+
fs$2.writeFileSync(this.tokenPath, token, "utf-8");
|
|
56151
56151
|
}
|
|
56152
56152
|
};
|
|
56153
56153
|
var webuiTokenUtil = new WebUITokenUtil(path.join(DATA_DIR, "webui_token.txt"));
|
|
@@ -58422,7 +58422,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
58422
58422
|
var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
58423
58423
|
var urllib$2 = __require("url");
|
|
58424
58424
|
var util$1 = __require("util");
|
|
58425
|
-
var fs$
|
|
58425
|
+
var fs$5 = __require("fs");
|
|
58426
58426
|
var nmfetch = require_fetch();
|
|
58427
58427
|
var dns$1 = __require("dns");
|
|
58428
58428
|
var net$4 = __require("net");
|
|
@@ -58758,7 +58758,7 @@ var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
58758
58758
|
const parsedDataUri = module.exports.parseDataURI(content.path || content.href);
|
|
58759
58759
|
if (!parsedDataUri || !parsedDataUri.data) return callback(null, Buffer.from(0));
|
|
58760
58760
|
return callback(null, parsedDataUri.data);
|
|
58761
|
-
} else if (content.path) return resolveStream(fs$
|
|
58761
|
+
} else if (content.path) return resolveStream(fs$5.createReadStream(content.path), callback);
|
|
58762
58762
|
}
|
|
58763
58763
|
if (typeof data[key].content === "string" && ![
|
|
58764
58764
|
"utf8",
|
|
@@ -62698,7 +62698,7 @@ var require_le_unix = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62698
62698
|
//#region node_modules/nodemailer/lib/mime-node/index.js
|
|
62699
62699
|
var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
62700
62700
|
var crypto$8 = __require("crypto");
|
|
62701
|
-
var fs$
|
|
62701
|
+
var fs$4 = __require("fs");
|
|
62702
62702
|
var punycode = require_punycode();
|
|
62703
62703
|
var { PassThrough: PassThrough$2 } = __require("stream");
|
|
62704
62704
|
var shared = require_shared();
|
|
@@ -63407,7 +63407,7 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
63407
63407
|
});
|
|
63408
63408
|
return contentStream;
|
|
63409
63409
|
}
|
|
63410
|
-
return fs$
|
|
63410
|
+
return fs$4.createReadStream(content.path);
|
|
63411
63411
|
}
|
|
63412
63412
|
if (content && typeof content.href === "string") {
|
|
63413
63413
|
if (this.disableUrlAccess) {
|
|
@@ -64246,7 +64246,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
64246
64246
|
var RelaxedBody = require_relaxed_body();
|
|
64247
64247
|
var sign = require_sign();
|
|
64248
64248
|
var { PassThrough: PassThrough$1 } = __require("stream");
|
|
64249
|
-
var fs$
|
|
64249
|
+
var fs$3 = __require("fs");
|
|
64250
64250
|
var path$2 = __require("path");
|
|
64251
64251
|
var crypto$5 = __require("crypto");
|
|
64252
64252
|
var DKIM_ALGO = "sha256";
|
|
@@ -64279,10 +64279,10 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
64279
64279
|
}
|
|
64280
64280
|
cleanup() {
|
|
64281
64281
|
if (!this.cache || !this.cachePath) return;
|
|
64282
|
-
fs$
|
|
64282
|
+
fs$3.unlink(this.cachePath, () => false);
|
|
64283
64283
|
}
|
|
64284
64284
|
createReadCache() {
|
|
64285
|
-
this.cache = fs$
|
|
64285
|
+
this.cache = fs$3.createReadStream(this.cachePath);
|
|
64286
64286
|
this.cache.once("error", (err) => {
|
|
64287
64287
|
this.cleanup();
|
|
64288
64288
|
this.output.emit("error", err);
|
|
@@ -64328,7 +64328,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
64328
64328
|
}
|
|
64329
64329
|
createWriteCache() {
|
|
64330
64330
|
this.output.usingCache = true;
|
|
64331
|
-
this.cache = fs$
|
|
64331
|
+
this.cache = fs$3.createWriteStream(this.cachePath);
|
|
64332
64332
|
this.cache.once("error", (err) => {
|
|
64333
64333
|
this.cleanup();
|
|
64334
64334
|
this.relaxedBody.unpipe(this.cache);
|