llonebot-dist 7.12.4 → 7.12.5
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
|
@@ -15,6 +15,7 @@ import { WebSocket as WebSocket$1, WebSocketServer } from "ws";
|
|
|
15
15
|
import { constants } from "node:buffer";
|
|
16
16
|
import crypto$1, { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
|
|
17
17
|
import * as fileType from "file-type";
|
|
18
|
+
import { fileTypeFromBuffer } from "file-type";
|
|
18
19
|
import { decode, encode, getDuration, getWavFileInfo, isSilk, isWav } from "silk-wasm";
|
|
19
20
|
import http, { STATUS_CODES, createServer, request } from "node:http";
|
|
20
21
|
import { Http2ServerRequest, constants as constants$1 } from "node:http2";
|
|
@@ -11384,7 +11385,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
|
|
|
11384
11385
|
};
|
|
11385
11386
|
//#endregion
|
|
11386
11387
|
//#region src/version.ts
|
|
11387
|
-
var version$2 = "7.12.
|
|
11388
|
+
var version$2 = "7.12.5";
|
|
11388
11389
|
//#endregion
|
|
11389
11390
|
//#region node_modules/sift/es5m/index.js
|
|
11390
11391
|
/******************************************************************************
|
|
@@ -17256,6 +17257,12 @@ async function getFileType(filePath) {
|
|
|
17256
17257
|
async function getImageSize(path) {
|
|
17257
17258
|
return await imageSizeFromFile(path);
|
|
17258
17259
|
}
|
|
17260
|
+
function getMd5HexFromBuffer(buf) {
|
|
17261
|
+
return createHash("md5").update(buf).digest("hex");
|
|
17262
|
+
}
|
|
17263
|
+
function getSha1HexFromBuffer(buf) {
|
|
17264
|
+
return createHash("sha1").update(buf).digest("hex");
|
|
17265
|
+
}
|
|
17259
17266
|
async function getMd5HexFromFile(filePath) {
|
|
17260
17267
|
const hash = createHash("md5");
|
|
17261
17268
|
const stream = fs$1.createReadStream(filePath);
|
|
@@ -21202,7 +21209,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
21202
21209
|
/**
|
|
21203
21210
|
* @link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
|
|
21204
21211
|
*/
|
|
21205
|
-
var CloseEvent
|
|
21212
|
+
var CloseEvent = globalThis.CloseEvent ?? class extends Event {
|
|
21206
21213
|
#eventInitDict;
|
|
21207
21214
|
constructor(type, eventInitDict = {}) {
|
|
21208
21215
|
super(type, eventInitDict);
|
|
@@ -21218,8 +21225,8 @@ var CloseEvent$1 = globalThis.CloseEvent ?? class extends Event {
|
|
|
21218
21225
|
return this.#eventInitDict.reason ?? "";
|
|
21219
21226
|
}
|
|
21220
21227
|
};
|
|
21221
|
-
var generateConnectionSymbol
|
|
21222
|
-
var CONNECTION_SYMBOL_KEY
|
|
21228
|
+
var generateConnectionSymbol = () => Symbol("connection");
|
|
21229
|
+
var CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
|
|
21223
21230
|
var WAIT_FOR_WEBSOCKET_SYMBOL = Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");
|
|
21224
21231
|
var rejectUpgradeRequest = (socket, status) => {
|
|
21225
21232
|
socket.end(`HTTP/1.1 ${status.toString()} ${STATUS_CODES[status] ?? ""}\r\nConnection: close\r
|
|
@@ -21273,7 +21280,7 @@ var setupWebSocket = (options) => {
|
|
|
21273
21280
|
return;
|
|
21274
21281
|
}
|
|
21275
21282
|
const waiter = waiterMap.get(request);
|
|
21276
|
-
if (!waiter || waiter.connectionSymbol !== env[CONNECTION_SYMBOL_KEY
|
|
21283
|
+
if (!waiter || waiter.connectionSymbol !== env[CONNECTION_SYMBOL_KEY]) {
|
|
21277
21284
|
waiterMap.delete(request);
|
|
21278
21285
|
if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, status);
|
|
21279
21286
|
return;
|
|
@@ -21286,13 +21293,13 @@ var setupWebSocket = (options) => {
|
|
|
21286
21293
|
wss.close();
|
|
21287
21294
|
});
|
|
21288
21295
|
};
|
|
21289
|
-
defineWebSocketHelper(async (c, events, options) => {
|
|
21296
|
+
var upgradeWebSocket = defineWebSocketHelper(async (c, events, options) => {
|
|
21290
21297
|
if (c.req.header("upgrade")?.toLowerCase() !== "websocket") return;
|
|
21291
21298
|
const env = c.env;
|
|
21292
21299
|
const waitForWebSocket = env[WAIT_FOR_WEBSOCKET_SYMBOL];
|
|
21293
21300
|
if (!waitForWebSocket || !env.incoming) return new Response(null, { status: 500 });
|
|
21294
|
-
const connectionSymbol = generateConnectionSymbol
|
|
21295
|
-
env[CONNECTION_SYMBOL_KEY
|
|
21301
|
+
const connectionSymbol = generateConnectionSymbol();
|
|
21302
|
+
env[CONNECTION_SYMBOL_KEY] = connectionSymbol;
|
|
21296
21303
|
(async () => {
|
|
21297
21304
|
const ws = await waitForWebSocket(env.incoming, connectionSymbol);
|
|
21298
21305
|
const messagesReceivedInStarting = [];
|
|
@@ -21335,7 +21342,7 @@ defineWebSocketHelper(async (c, events, options) => {
|
|
|
21335
21342
|
});
|
|
21336
21343
|
ws.on("close", (code, reason) => {
|
|
21337
21344
|
try {
|
|
21338
|
-
events?.onClose?.(new CloseEvent
|
|
21345
|
+
events?.onClose?.(new CloseEvent("close", {
|
|
21339
21346
|
code,
|
|
21340
21347
|
reason: reason.toString()
|
|
21341
21348
|
}), ctx);
|
|
@@ -22283,18 +22290,18 @@ var ScalarDeserializerCompiler = {
|
|
|
22283
22290
|
sfixed32: (key, spec) => spec.repeated ? (draft, reader, wireType) => {
|
|
22284
22291
|
if (wireType === WireType$2.LengthDelimited) {
|
|
22285
22292
|
const count = reader.readVarint() / Fixed32Size;
|
|
22286
|
-
for (let i = 0; i < count; i++) draft[key].push(Converter.
|
|
22287
|
-
} else draft[key].push(Converter.
|
|
22293
|
+
for (let i = 0; i < count; i++) draft[key].push(Converter.toSigned32(reader.readFixed32()));
|
|
22294
|
+
} else draft[key].push(Converter.toSigned32(reader.readFixed32()));
|
|
22288
22295
|
} : (draft, reader) => {
|
|
22289
|
-
draft[key] = Converter.
|
|
22296
|
+
draft[key] = Converter.toSigned32(reader.readFixed32());
|
|
22290
22297
|
},
|
|
22291
22298
|
sfixed64: (key, spec) => spec.repeated ? (draft, reader, wireType) => {
|
|
22292
22299
|
if (wireType === WireType$2.LengthDelimited) {
|
|
22293
22300
|
const count = reader.readVarint() / Fixed64Size;
|
|
22294
|
-
for (let i = 0; i < count; i++) draft[key].push(Converter.
|
|
22295
|
-
} else draft[key].push(Converter.
|
|
22301
|
+
for (let i = 0; i < count; i++) draft[key].push(Converter.toSigned64(reader.readFixed64()));
|
|
22302
|
+
} else draft[key].push(Converter.toSigned64(reader.readFixed64()));
|
|
22296
22303
|
} : (draft, reader) => {
|
|
22297
|
-
draft[key] = Converter.
|
|
22304
|
+
draft[key] = Converter.toSigned64(reader.readFixed64());
|
|
22298
22305
|
},
|
|
22299
22306
|
sint32: (key, spec) => spec.repeated ? (draft, reader, wireType) => {
|
|
22300
22307
|
if (wireType === WireType$2.LengthDelimited) {
|
|
@@ -22473,29 +22480,29 @@ var ScalarSerializerCompiler = {
|
|
|
22473
22480
|
const length = data.length * Fixed32Size;
|
|
22474
22481
|
writer.writeVarint(spec[kTag]);
|
|
22475
22482
|
writer.writeVarint(length);
|
|
22476
|
-
for (const value of data) writer.writeFixed32(Converter.
|
|
22483
|
+
for (const value of data) writer.writeFixed32(Converter.toUnsigned32(value));
|
|
22477
22484
|
}) : defineSerializer((data, writer) => {
|
|
22478
22485
|
for (const value of data) {
|
|
22479
22486
|
writer.writeVarint(spec[kTag]);
|
|
22480
|
-
writer.writeFixed32(Converter.
|
|
22487
|
+
writer.writeFixed32(Converter.toUnsigned32(value));
|
|
22481
22488
|
}
|
|
22482
22489
|
}) : defineSerializer((data, writer) => {
|
|
22483
22490
|
writer.writeVarint(spec[kTag]);
|
|
22484
|
-
writer.writeFixed32(Converter.
|
|
22491
|
+
writer.writeFixed32(Converter.toUnsigned32(data));
|
|
22485
22492
|
}),
|
|
22486
22493
|
sfixed64: (spec) => spec.repeated ? spec.packed ? defineSerializer((data, writer) => {
|
|
22487
22494
|
const length = data.length * Fixed64Size;
|
|
22488
22495
|
writer.writeVarint(spec[kTag]);
|
|
22489
22496
|
writer.writeVarint(length);
|
|
22490
|
-
for (const value of data) writer.writeFixed64(Converter.
|
|
22497
|
+
for (const value of data) writer.writeFixed64(Converter.toUnsigned64(value));
|
|
22491
22498
|
}) : defineSerializer((data, writer) => {
|
|
22492
22499
|
for (const value of data) {
|
|
22493
22500
|
writer.writeVarint(spec[kTag]);
|
|
22494
|
-
writer.writeFixed64(Converter.
|
|
22501
|
+
writer.writeFixed64(Converter.toUnsigned64(value));
|
|
22495
22502
|
}
|
|
22496
22503
|
}) : defineSerializer((data, writer) => {
|
|
22497
22504
|
writer.writeVarint(spec[kTag]);
|
|
22498
|
-
writer.writeFixed64(Converter.
|
|
22505
|
+
writer.writeFixed64(Converter.toUnsigned64(data));
|
|
22499
22506
|
}),
|
|
22500
22507
|
sint32: (spec) => spec.repeated ? spec.packed ? defineSerializer((data, writer) => {
|
|
22501
22508
|
const length = data.length * Fixed32Size;
|
|
@@ -22526,23 +22533,6 @@ var ScalarSerializerCompiler = {
|
|
|
22526
22533
|
writer.writeBigVarint(Converter.zigzagEncode64(data));
|
|
22527
22534
|
})
|
|
22528
22535
|
};
|
|
22529
|
-
var ScalarTypeDefaultValue = {
|
|
22530
|
-
double: 0,
|
|
22531
|
-
float: 0,
|
|
22532
|
-
int64: BigInt(0),
|
|
22533
|
-
uint64: BigInt(0),
|
|
22534
|
-
int32: 0,
|
|
22535
|
-
fixed64: BigInt(0),
|
|
22536
|
-
fixed32: 0,
|
|
22537
|
-
bool: false,
|
|
22538
|
-
string: "",
|
|
22539
|
-
bytes: Buffer.alloc(0),
|
|
22540
|
-
uint32: 0,
|
|
22541
|
-
sfixed32: 0,
|
|
22542
|
-
sfixed64: BigInt(0),
|
|
22543
|
-
sint32: 0,
|
|
22544
|
-
sint64: BigInt(0)
|
|
22545
|
-
};
|
|
22546
22536
|
var VARINT32_BYTE_2 = 128;
|
|
22547
22537
|
var VARINT32_BYTE_3 = 16384;
|
|
22548
22538
|
var VARINT32_BYTE_4 = 2097152;
|
|
@@ -22673,6 +22663,23 @@ var ScalarSizeCalculatorCompiler = {
|
|
|
22673
22663
|
return spec[kTagLength] + SizeOf.varint32(bodySize) + bodySize;
|
|
22674
22664
|
} : (data) => sumVarint64Array(data, Converter.zigzagEncode64) + spec[kTagLength] * data.length : (data) => spec[kTagLength] + SizeOf.varint64(Converter.zigzagEncode64(data))
|
|
22675
22665
|
};
|
|
22666
|
+
var ScalarTypeDefaultValue = {
|
|
22667
|
+
double: 0,
|
|
22668
|
+
float: 0,
|
|
22669
|
+
int64: BigInt(0),
|
|
22670
|
+
uint64: BigInt(0),
|
|
22671
|
+
int32: 0,
|
|
22672
|
+
fixed64: BigInt(0),
|
|
22673
|
+
fixed32: 0,
|
|
22674
|
+
bool: false,
|
|
22675
|
+
string: "",
|
|
22676
|
+
bytes: Buffer.alloc(0),
|
|
22677
|
+
uint32: 0,
|
|
22678
|
+
sfixed32: 0,
|
|
22679
|
+
sfixed64: BigInt(0),
|
|
22680
|
+
sint32: 0,
|
|
22681
|
+
sint64: BigInt(0)
|
|
22682
|
+
};
|
|
22676
22683
|
function isMapFieldType(type) {
|
|
22677
22684
|
return Array.isArray(type);
|
|
22678
22685
|
}
|
|
@@ -22912,10 +22919,10 @@ var ProtoMessage = class ProtoMessage {
|
|
|
22912
22919
|
return draft;
|
|
22913
22920
|
}
|
|
22914
22921
|
static of(model) {
|
|
22915
|
-
let message =
|
|
22922
|
+
let message = ProtoMessage.compiledMessages.get(model);
|
|
22916
22923
|
if (message === void 0) {
|
|
22917
22924
|
message = new ProtoMessage(model);
|
|
22918
|
-
|
|
22925
|
+
ProtoMessage.compiledMessages.set(model, message);
|
|
22919
22926
|
}
|
|
22920
22927
|
return message;
|
|
22921
22928
|
}
|
|
@@ -25399,12 +25406,16 @@ var SendGroupNotice = class extends BaseAction {
|
|
|
25399
25406
|
content: lib_default$1.string().required(),
|
|
25400
25407
|
image: lib_default$1.string(),
|
|
25401
25408
|
pinned: lib_default$1.union([Boolean, lib_default$1.transform(String, parseBool)]).default(false),
|
|
25402
|
-
confirm_required: lib_default$1.union([Boolean, lib_default$1.transform(String, parseBool)]).default(true)
|
|
25409
|
+
confirm_required: lib_default$1.union([Boolean, lib_default$1.transform(String, parseBool)]).default(true),
|
|
25410
|
+
is_show_edit_card: lib_default$1.union([Boolean, lib_default$1.transform(String, parseBool)]).default(false),
|
|
25411
|
+
tip_window: lib_default$1.union([Boolean, lib_default$1.transform(String, parseBool)]).default(false)
|
|
25403
25412
|
});
|
|
25404
25413
|
async _handle(payload) {
|
|
25405
25414
|
const groupCode = payload.group_id.toString();
|
|
25406
25415
|
const pinned = +payload.pinned;
|
|
25407
25416
|
const confirmRequired = +payload.confirm_required;
|
|
25417
|
+
const isShowEditCard = +payload.is_show_edit_card;
|
|
25418
|
+
const tipWindowType = +!payload.tip_window;
|
|
25408
25419
|
let picInfo;
|
|
25409
25420
|
if (payload.image) {
|
|
25410
25421
|
const { path, isLocal, success, errMsg } = await uri2local(this.ctx, payload.image, true);
|
|
@@ -25414,14 +25425,8 @@ var SendGroupNotice = class extends BaseAction {
|
|
|
25414
25425
|
if (!isLocal) unlink$1(path).catch(noop);
|
|
25415
25426
|
picInfo = result.picInfo;
|
|
25416
25427
|
}
|
|
25417
|
-
const res = await this.ctx.
|
|
25418
|
-
|
|
25419
|
-
oldFeedsId: "",
|
|
25420
|
-
pinned,
|
|
25421
|
-
confirmRequired,
|
|
25422
|
-
picInfo
|
|
25423
|
-
});
|
|
25424
|
-
if (res.result !== 0) throw new Error(`设置群公告失败, 错误信息: ${res.errMsg}`);
|
|
25428
|
+
const res = await this.ctx.ntWebApi.publishGroupBulletin(groupCode, payload.content, pinned, 1, isShowEditCard, tipWindowType, confirmRequired, picInfo?.id, picInfo?.width, picInfo?.height);
|
|
25429
|
+
if (res.ec !== 0) throw new Error(`设置群公告失败, 错误信息: ${res.em}`);
|
|
25425
25430
|
return null;
|
|
25426
25431
|
}
|
|
25427
25432
|
};
|
|
@@ -25705,6 +25710,11 @@ var GetGroupNotice = class extends BaseAction {
|
|
|
25705
25710
|
id: image.id
|
|
25706
25711
|
};
|
|
25707
25712
|
})
|
|
25713
|
+
},
|
|
25714
|
+
settings: {
|
|
25715
|
+
is_show_edit_card: !!feed.settings.isShowEditCard,
|
|
25716
|
+
tip_window: !feed.settings.tipWindowType,
|
|
25717
|
+
confirm_required: !!feed.settings.confirmRequired
|
|
25708
25718
|
}
|
|
25709
25719
|
});
|
|
25710
25720
|
return result;
|
|
@@ -28892,149 +28902,6 @@ var handlers = {
|
|
|
28892
28902
|
deleteFriend
|
|
28893
28903
|
};
|
|
28894
28904
|
//#endregion
|
|
28895
|
-
//#region node_modules/@hono/node-ws/dist/index.js
|
|
28896
|
-
/**
|
|
28897
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
|
|
28898
|
-
*/
|
|
28899
|
-
var CloseEvent = globalThis.CloseEvent ?? class extends Event {
|
|
28900
|
-
#eventInitDict;
|
|
28901
|
-
constructor(type, eventInitDict = {}) {
|
|
28902
|
-
super(type, eventInitDict);
|
|
28903
|
-
this.#eventInitDict = eventInitDict;
|
|
28904
|
-
}
|
|
28905
|
-
get wasClean() {
|
|
28906
|
-
return this.#eventInitDict.wasClean ?? false;
|
|
28907
|
-
}
|
|
28908
|
-
get code() {
|
|
28909
|
-
return this.#eventInitDict.code ?? 0;
|
|
28910
|
-
}
|
|
28911
|
-
get reason() {
|
|
28912
|
-
return this.#eventInitDict.reason ?? "";
|
|
28913
|
-
}
|
|
28914
|
-
};
|
|
28915
|
-
var generateConnectionSymbol = () => Symbol("connection");
|
|
28916
|
-
/** @example `c.env[CONNECTION_SYMBOL_KEY]` */
|
|
28917
|
-
var CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
|
|
28918
|
-
/**
|
|
28919
|
-
* Create WebSockets for Node.js
|
|
28920
|
-
* @param init Options
|
|
28921
|
-
* @returns NodeWebSocket
|
|
28922
|
-
*/
|
|
28923
|
-
var createNodeWebSocket = (init) => {
|
|
28924
|
-
const wss = new WebSocketServer({ noServer: true });
|
|
28925
|
-
const waiterMap = /* @__PURE__ */ new Map();
|
|
28926
|
-
wss.on("connection", (ws, request) => {
|
|
28927
|
-
const waiter = waiterMap.get(request);
|
|
28928
|
-
if (waiter) {
|
|
28929
|
-
waiter.resolve(ws);
|
|
28930
|
-
waiterMap.delete(request);
|
|
28931
|
-
}
|
|
28932
|
-
});
|
|
28933
|
-
const nodeUpgradeWebSocket = (request, connectionSymbol) => {
|
|
28934
|
-
return new Promise((resolve) => {
|
|
28935
|
-
waiterMap.set(request, {
|
|
28936
|
-
resolve,
|
|
28937
|
-
connectionSymbol
|
|
28938
|
-
});
|
|
28939
|
-
});
|
|
28940
|
-
};
|
|
28941
|
-
return {
|
|
28942
|
-
wss,
|
|
28943
|
-
injectWebSocket(server) {
|
|
28944
|
-
server.on("upgrade", async (request, socket, head) => {
|
|
28945
|
-
const url = new URL(request.url ?? "/", init.baseUrl ?? "http://localhost");
|
|
28946
|
-
const headers = new Headers();
|
|
28947
|
-
for (const key in request.headers) {
|
|
28948
|
-
const value = request.headers[key];
|
|
28949
|
-
if (!value) continue;
|
|
28950
|
-
headers.append(key, Array.isArray(value) ? value[0] : value);
|
|
28951
|
-
}
|
|
28952
|
-
const env = {
|
|
28953
|
-
incoming: request,
|
|
28954
|
-
outgoing: void 0
|
|
28955
|
-
};
|
|
28956
|
-
const response = await init.app.request(url, { headers }, env);
|
|
28957
|
-
const waiter = waiterMap.get(request);
|
|
28958
|
-
if (!waiter || waiter.connectionSymbol !== env[CONNECTION_SYMBOL_KEY]) {
|
|
28959
|
-
socket.end(`HTTP/1.1 ${response.status.toString()} ${STATUS_CODES[response.status] ?? ""}\r\nConnection: close\r
|
|
28960
|
-
Content-Length: 0\r
|
|
28961
|
-
\r
|
|
28962
|
-
`);
|
|
28963
|
-
waiterMap.delete(request);
|
|
28964
|
-
return;
|
|
28965
|
-
}
|
|
28966
|
-
wss.handleUpgrade(request, socket, head, (ws) => {
|
|
28967
|
-
wss.emit("connection", ws, request);
|
|
28968
|
-
});
|
|
28969
|
-
});
|
|
28970
|
-
},
|
|
28971
|
-
upgradeWebSocket: defineWebSocketHelper(async (c, events, options) => {
|
|
28972
|
-
if (c.req.header("upgrade")?.toLowerCase() !== "websocket") return;
|
|
28973
|
-
const connectionSymbol = generateConnectionSymbol();
|
|
28974
|
-
c.env[CONNECTION_SYMBOL_KEY] = connectionSymbol;
|
|
28975
|
-
(async () => {
|
|
28976
|
-
const ws = await nodeUpgradeWebSocket(c.env.incoming, connectionSymbol);
|
|
28977
|
-
const messagesReceivedInStarting = [];
|
|
28978
|
-
const bufferMessage = (data, isBinary) => {
|
|
28979
|
-
messagesReceivedInStarting.push([data, isBinary]);
|
|
28980
|
-
};
|
|
28981
|
-
ws.on("message", bufferMessage);
|
|
28982
|
-
const ctx = {
|
|
28983
|
-
binaryType: "arraybuffer",
|
|
28984
|
-
close(code, reason) {
|
|
28985
|
-
ws.close(code, reason);
|
|
28986
|
-
},
|
|
28987
|
-
protocol: ws.protocol,
|
|
28988
|
-
raw: ws,
|
|
28989
|
-
get readyState() {
|
|
28990
|
-
return ws.readyState;
|
|
28991
|
-
},
|
|
28992
|
-
send(source, opts) {
|
|
28993
|
-
ws.send(source, { compress: opts?.compress });
|
|
28994
|
-
},
|
|
28995
|
-
url: new URL(c.req.url)
|
|
28996
|
-
};
|
|
28997
|
-
try {
|
|
28998
|
-
events?.onOpen?.(new Event("open"), ctx);
|
|
28999
|
-
} catch (e) {
|
|
29000
|
-
(options?.onError ?? console.error)(e);
|
|
29001
|
-
}
|
|
29002
|
-
const handleMessage = (data, isBinary) => {
|
|
29003
|
-
const datas = Array.isArray(data) ? data : [data];
|
|
29004
|
-
for (const data$1 of datas) try {
|
|
29005
|
-
events?.onMessage?.(new MessageEvent("message", { data: isBinary ? data$1 instanceof ArrayBuffer ? data$1 : data$1.buffer.slice(data$1.byteOffset, data$1.byteOffset + data$1.byteLength) : data$1.toString("utf-8") }), ctx);
|
|
29006
|
-
} catch (e) {
|
|
29007
|
-
(options?.onError ?? console.error)(e);
|
|
29008
|
-
}
|
|
29009
|
-
};
|
|
29010
|
-
ws.off("message", bufferMessage);
|
|
29011
|
-
for (const message of messagesReceivedInStarting) handleMessage(...message);
|
|
29012
|
-
ws.on("message", (data, isBinary) => {
|
|
29013
|
-
handleMessage(data, isBinary);
|
|
29014
|
-
});
|
|
29015
|
-
ws.on("close", (code, reason) => {
|
|
29016
|
-
try {
|
|
29017
|
-
events?.onClose?.(new CloseEvent("close", {
|
|
29018
|
-
code,
|
|
29019
|
-
reason: reason.toString()
|
|
29020
|
-
}), ctx);
|
|
29021
|
-
} catch (e) {
|
|
29022
|
-
(options?.onError ?? console.error)(e);
|
|
29023
|
-
}
|
|
29024
|
-
});
|
|
29025
|
-
ws.on("error", (error) => {
|
|
29026
|
-
try {
|
|
29027
|
-
events?.onError?.(new ErrorEvent("error", { error }), ctx);
|
|
29028
|
-
} catch (e) {
|
|
29029
|
-
(options?.onError ?? console.error)(e);
|
|
29030
|
-
}
|
|
29031
|
-
});
|
|
29032
|
-
})();
|
|
29033
|
-
return new Response();
|
|
29034
|
-
})
|
|
29035
|
-
};
|
|
29036
|
-
};
|
|
29037
|
-
//#endregion
|
|
29038
28905
|
//#region src/satori/server.ts
|
|
29039
28906
|
var SatoriServer = class {
|
|
29040
28907
|
app;
|
|
@@ -29043,7 +28910,6 @@ var SatoriServer = class {
|
|
|
29043
28910
|
wsClients = [];
|
|
29044
28911
|
actionMap;
|
|
29045
28912
|
routesRegistered = false;
|
|
29046
|
-
injectWebSocket;
|
|
29047
28913
|
constructor(ctx, config) {
|
|
29048
28914
|
this.ctx = ctx;
|
|
29049
28915
|
this.config = config;
|
|
@@ -29077,18 +28943,20 @@ var SatoriServer = class {
|
|
|
29077
28943
|
this.routesRegistered = true;
|
|
29078
28944
|
}
|
|
29079
28945
|
const { host, port } = this.config;
|
|
28946
|
+
const wss = new WebSocketServer({
|
|
28947
|
+
noServer: true,
|
|
28948
|
+
maxPayload: constants.MAX_STRING_LENGTH
|
|
28949
|
+
});
|
|
29080
28950
|
this.httpServer = serve({
|
|
29081
28951
|
fetch: this.app.fetch,
|
|
28952
|
+
websocket: { server: wss },
|
|
29082
28953
|
port,
|
|
29083
28954
|
hostname: host
|
|
29084
28955
|
}, () => {
|
|
29085
28956
|
this.ctx.logger.info(`Satori server started ${host || "0.0.0.0"}:${port}`);
|
|
29086
28957
|
});
|
|
29087
|
-
this.injectWebSocket?.(this.httpServer);
|
|
29088
28958
|
}
|
|
29089
28959
|
registerRoutes() {
|
|
29090
|
-
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app: this.app });
|
|
29091
|
-
this.injectWebSocket = injectWebSocket;
|
|
29092
28960
|
this.app.get("/v1/events", upgradeWebSocket((c) => {
|
|
29093
28961
|
return { onMessage: async (event, ws) => {
|
|
29094
28962
|
let payload;
|
|
@@ -42366,7 +42234,6 @@ var MilkyHttpHandler = class {
|
|
|
42366
42234
|
this.ctx.logger.info("MilkyHttp", `${c.env.incoming.socket.remoteAddress} -> ${c.req.path} (${response.retcode === 0 ? "OK" : response.retcode} ${end - start}ms)`, payload);
|
|
42367
42235
|
return c.json(response);
|
|
42368
42236
|
});
|
|
42369
|
-
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app: this.app });
|
|
42370
42237
|
this.app.get(`${this.config.prefix}/event`, upgradeWebSocket((c) => {
|
|
42371
42238
|
return {
|
|
42372
42239
|
onOpen: (event, ws) => {
|
|
@@ -42407,15 +42274,19 @@ var MilkyHttpHandler = class {
|
|
|
42407
42274
|
});
|
|
42408
42275
|
});
|
|
42409
42276
|
});
|
|
42277
|
+
const wss = new WebSocketServer({
|
|
42278
|
+
noServer: true,
|
|
42279
|
+
maxPayload: constants.MAX_STRING_LENGTH
|
|
42280
|
+
});
|
|
42410
42281
|
this.httpServer = serve({
|
|
42411
42282
|
fetch: this.app.fetch,
|
|
42283
|
+
websocket: { server: wss },
|
|
42412
42284
|
port: this.config.port,
|
|
42413
42285
|
hostname: this.config.host
|
|
42414
42286
|
}, () => {
|
|
42415
42287
|
const displayHost = this.config.host || "0.0.0.0";
|
|
42416
42288
|
this.ctx.logger.info("MilkyHttp", `HTTP server started at ${displayHost}:${this.config.port}${this.config.prefix}`);
|
|
42417
42289
|
});
|
|
42418
|
-
injectWebSocket(this.httpServer);
|
|
42419
42290
|
}
|
|
42420
42291
|
stop() {
|
|
42421
42292
|
for (const stream of this.sseClients) stream.abort();
|
|
@@ -46434,7 +46305,7 @@ function getIgnoreAttributesFn(ignoreAttributes) {
|
|
|
46434
46305
|
return () => false;
|
|
46435
46306
|
}
|
|
46436
46307
|
//#endregion
|
|
46437
|
-
//#region node_modules/
|
|
46308
|
+
//#region node_modules/path-expression-matcher/src/Expression.js
|
|
46438
46309
|
/**
|
|
46439
46310
|
* Expression - Parses and stores a tag pattern expression
|
|
46440
46311
|
*
|
|
@@ -46586,7 +46457,7 @@ var Expression = class {
|
|
|
46586
46457
|
}
|
|
46587
46458
|
};
|
|
46588
46459
|
//#endregion
|
|
46589
|
-
//#region node_modules/
|
|
46460
|
+
//#region node_modules/path-expression-matcher/src/ExpressionSet.js
|
|
46590
46461
|
/**
|
|
46591
46462
|
* ExpressionSet - An indexed collection of Expressions for efficient bulk matching
|
|
46592
46463
|
*
|
|
@@ -46759,7 +46630,7 @@ var ExpressionSet = class {
|
|
|
46759
46630
|
}
|
|
46760
46631
|
};
|
|
46761
46632
|
//#endregion
|
|
46762
|
-
//#region node_modules/
|
|
46633
|
+
//#region node_modules/path-expression-matcher/src/Matcher.js
|
|
46763
46634
|
/**
|
|
46764
46635
|
* MatcherView - A lightweight read-only view over a Matcher's internal state.
|
|
46765
46636
|
*
|
|
@@ -54186,9 +54057,7 @@ var NTQQUserApi = class extends Service {
|
|
|
54186
54057
|
return await this.ctx.pmhq.invoke("nodeIKernelProfileService/getCoreAndBaseInfo", ["nodeStore", uids]);
|
|
54187
54058
|
}
|
|
54188
54059
|
async getBuddyNick(uid) {
|
|
54189
|
-
|
|
54190
|
-
if (nick === void 0) this.ctx.logger.warn(`获取昵称失败, uid: ${uid}`);
|
|
54191
|
-
return nick ?? "";
|
|
54060
|
+
return (await this.ctx.pmhq.invoke("nodeIKernelBuddyService/getBuddyNick", [[uid]])).get(uid);
|
|
54192
54061
|
}
|
|
54193
54062
|
async getCookies(domain) {
|
|
54194
54063
|
const clientKeyData = await this.forceFetchClientKey();
|
|
@@ -54212,7 +54081,11 @@ var NTQQUserApi = class extends Service {
|
|
|
54212
54081
|
return await this.ctx.pmhq.invoke("nodeIKernelTicketService/forceFetchClientKey", [""]);
|
|
54213
54082
|
}
|
|
54214
54083
|
async getSelfNick(refresh = true) {
|
|
54215
|
-
if ((refresh || !selfInfo.nick) && selfInfo.uid)
|
|
54084
|
+
if ((refresh || !selfInfo.nick) && selfInfo.uid) {
|
|
54085
|
+
let nick = await this.getBuddyNick(selfInfo.uid);
|
|
54086
|
+
if (nick === void 0) nick = (await this.getUserSimpleInfo(selfInfo.uid, refresh)).coreInfo.nick;
|
|
54087
|
+
selfInfo.nick = nick;
|
|
54088
|
+
}
|
|
54216
54089
|
return selfInfo.nick;
|
|
54217
54090
|
}
|
|
54218
54091
|
async setSelfStatus(status, extStatus, batteryStatus) {
|
|
@@ -54425,101 +54298,152 @@ var NTQQWebApi = class extends Service {
|
|
|
54425
54298
|
const filePath = filePathList[i];
|
|
54426
54299
|
const fileBuffer = await fsPromise.readFile(filePath);
|
|
54427
54300
|
const fileSize = fileBuffer.length;
|
|
54428
|
-
const
|
|
54429
|
-
const getSessionUrl = `https://${domain}/webapp/json/sliceUpload/FileBatchControl/${checksum}?g_tk=${gtk}`;
|
|
54301
|
+
const fileType = await fileTypeFromBuffer(fileBuffer);
|
|
54430
54302
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
54431
|
-
const
|
|
54432
|
-
|
|
54433
|
-
|
|
54434
|
-
|
|
54435
|
-
|
|
54436
|
-
|
|
54437
|
-
|
|
54438
|
-
|
|
54439
|
-
|
|
54440
|
-
|
|
54441
|
-
|
|
54442
|
-
"env": {
|
|
54443
|
-
"refer": "qzone",
|
|
54444
|
-
"deviceInfo": "h5"
|
|
54445
|
-
},
|
|
54446
|
-
"model": 0,
|
|
54447
|
-
"biz_req": {
|
|
54448
|
-
"sPicTitle": "",
|
|
54449
|
-
"sPicDesc": "",
|
|
54450
|
-
"sAlbumName": "",
|
|
54451
|
-
"sAlbumID": albumID,
|
|
54452
|
-
"iAlbumTypeID": 0,
|
|
54453
|
-
"iBitmap": 0,
|
|
54454
|
-
"iUploadType": 0,
|
|
54455
|
-
"iUpPicType": 0,
|
|
54456
|
-
"iBatchID": iBatchID,
|
|
54457
|
-
"sPicPath": "",
|
|
54458
|
-
"iPicWidth": 0,
|
|
54459
|
-
"iPicHight": 0,
|
|
54460
|
-
"iWaterType": 0,
|
|
54461
|
-
"iDistinctUse": 0,
|
|
54462
|
-
"iNeedFeeds": 1,
|
|
54463
|
-
"iUploadTime": timestamp,
|
|
54464
|
-
"mapExt": {
|
|
54465
|
-
"appid": "qun",
|
|
54466
|
-
"userid": groupCode
|
|
54303
|
+
const isVideo = fileType?.mime.startsWith("video");
|
|
54304
|
+
let res;
|
|
54305
|
+
if (isVideo) {
|
|
54306
|
+
const checksum = getSha1HexFromBuffer(fileBuffer);
|
|
54307
|
+
const getSessionUrl = `https://${domain}/webapp/json/sliceUpload/FileBatchControl/${checksum}?g_tk=${gtk}`;
|
|
54308
|
+
const getSessionPostData = { "control_req": [{
|
|
54309
|
+
"uin": selfInfo.uin,
|
|
54310
|
+
"token": {
|
|
54311
|
+
"type": 4,
|
|
54312
|
+
"data": cookiesObject.p_skey,
|
|
54313
|
+
"appid": 5
|
|
54467
54314
|
},
|
|
54468
|
-
"
|
|
54469
|
-
|
|
54470
|
-
|
|
54471
|
-
|
|
54472
|
-
|
|
54473
|
-
|
|
54474
|
-
"
|
|
54475
|
-
|
|
54476
|
-
|
|
54477
|
-
|
|
54478
|
-
|
|
54479
|
-
|
|
54480
|
-
|
|
54481
|
-
|
|
54482
|
-
|
|
54483
|
-
|
|
54484
|
-
|
|
54315
|
+
"appid": "video_qun",
|
|
54316
|
+
"checksum": checksum,
|
|
54317
|
+
"check_type": 1,
|
|
54318
|
+
"file_len": fileSize,
|
|
54319
|
+
"env": {
|
|
54320
|
+
"refer": "qzone",
|
|
54321
|
+
"deviceInfo": "h5"
|
|
54322
|
+
},
|
|
54323
|
+
"model": 0,
|
|
54324
|
+
"biz_req": {
|
|
54325
|
+
"sPicTitle": "",
|
|
54326
|
+
"sPicDesc": "",
|
|
54327
|
+
"sAlbumName": "",
|
|
54328
|
+
"sAlbumID": "",
|
|
54329
|
+
"iAlbumTypeID": 0,
|
|
54330
|
+
"iBitmap": 0,
|
|
54331
|
+
"iUploadType": 3,
|
|
54332
|
+
"iUpPicType": 0,
|
|
54333
|
+
"iBatchID": 0,
|
|
54334
|
+
"sPicPath": "",
|
|
54335
|
+
"iPicWidth": 0,
|
|
54336
|
+
"iPicHight": 0,
|
|
54337
|
+
"iWaterType": 0,
|
|
54338
|
+
"iDistinctUse": 0,
|
|
54339
|
+
"sTitle": "",
|
|
54340
|
+
"sDesc": "",
|
|
54341
|
+
"iFlag": 0,
|
|
54342
|
+
"iUploadTime": timestamp,
|
|
54343
|
+
"iPlayTime": 0,
|
|
54344
|
+
"sCoverUrl": "",
|
|
54345
|
+
"iIsNew": 111,
|
|
54346
|
+
"iIsOriginalVideo": 0,
|
|
54347
|
+
"iIsFormatF20": 0,
|
|
54348
|
+
"extend_info": {
|
|
54349
|
+
"video_type": "3",
|
|
54350
|
+
"domainid": "5",
|
|
54351
|
+
"photo_num": "0",
|
|
54352
|
+
"video_num": fileLen,
|
|
54353
|
+
"batch_num": fileLen,
|
|
54354
|
+
"qun_id": groupCode
|
|
54355
|
+
}
|
|
54356
|
+
},
|
|
54357
|
+
"session": "",
|
|
54358
|
+
"asy_upload": 0,
|
|
54359
|
+
"cmd": "FileUploadVideo"
|
|
54360
|
+
}] };
|
|
54361
|
+
res = await HttpUtil.post(getSessionUrl, getSessionPostData, this.cookieToString(cookiesObject));
|
|
54362
|
+
} else {
|
|
54363
|
+
const checksum = getMd5HexFromBuffer(fileBuffer);
|
|
54364
|
+
const getSessionUrl = `https://${domain}/webapp/json/sliceUpload/FileBatchControl/${checksum}?g_tk=${gtk}`;
|
|
54365
|
+
const getSessionPostData = { "control_req": [{
|
|
54366
|
+
"uin": selfInfo.uin,
|
|
54367
|
+
"token": {
|
|
54368
|
+
"type": 4,
|
|
54369
|
+
"data": cookiesObject.p_skey,
|
|
54370
|
+
"appid": 5
|
|
54371
|
+
},
|
|
54372
|
+
"appid": "qun",
|
|
54373
|
+
"checksum": checksum,
|
|
54374
|
+
"check_type": 0,
|
|
54375
|
+
"file_len": fileSize,
|
|
54376
|
+
"env": {
|
|
54377
|
+
"refer": "qzone",
|
|
54378
|
+
"deviceInfo": "h5"
|
|
54379
|
+
},
|
|
54380
|
+
"model": 0,
|
|
54381
|
+
"biz_req": {
|
|
54382
|
+
"sPicTitle": "",
|
|
54383
|
+
"sPicDesc": "",
|
|
54384
|
+
"sAlbumName": "",
|
|
54385
|
+
"sAlbumID": albumID,
|
|
54386
|
+
"iAlbumTypeID": 0,
|
|
54387
|
+
"iBitmap": 0,
|
|
54388
|
+
"iUploadType": 0,
|
|
54389
|
+
"iUpPicType": 0,
|
|
54390
|
+
"iBatchID": iBatchID,
|
|
54391
|
+
"sPicPath": "",
|
|
54392
|
+
"iPicWidth": 0,
|
|
54393
|
+
"iPicHight": 0,
|
|
54394
|
+
"iWaterType": 0,
|
|
54395
|
+
"iDistinctUse": 0,
|
|
54396
|
+
"iNeedFeeds": 1,
|
|
54397
|
+
"iUploadTime": timestamp,
|
|
54398
|
+
"mapExt": {
|
|
54399
|
+
"appid": "qun",
|
|
54400
|
+
"userid": groupCode
|
|
54401
|
+
},
|
|
54402
|
+
"stExtendInfo": { "mapParams": {
|
|
54403
|
+
"photo_num": fileLen,
|
|
54404
|
+
"video_num": "0",
|
|
54405
|
+
"batch_num": fileLen
|
|
54406
|
+
} },
|
|
54407
|
+
"mutliPicInfo": {
|
|
54408
|
+
"iBatUploadNum": fileLen,
|
|
54409
|
+
"iCurUpload": i,
|
|
54410
|
+
"iSuccNum": 0,
|
|
54411
|
+
"iFailNum": 0
|
|
54412
|
+
}
|
|
54413
|
+
},
|
|
54414
|
+
"session": "",
|
|
54415
|
+
"asy_upload": 0,
|
|
54416
|
+
"cmd": "FileUpload"
|
|
54417
|
+
}] };
|
|
54418
|
+
res = await HttpUtil.post(getSessionUrl, getSessionPostData, this.cookieToString(cookiesObject));
|
|
54419
|
+
}
|
|
54420
|
+
const resJson = await res.json();
|
|
54485
54421
|
if (resJson.ret !== 0) {
|
|
54486
54422
|
this.ctx.logger.error(`获取群相册上传 session 失败: ${resJson.msg}`);
|
|
54487
54423
|
errIndexList.push(i);
|
|
54488
54424
|
continue;
|
|
54489
54425
|
}
|
|
54490
|
-
const sessionId = resJson.data.session;
|
|
54491
54426
|
const sliceSize = resJson.data.slice_size;
|
|
54492
54427
|
let offset = 0;
|
|
54493
54428
|
let seq = 1;
|
|
54494
54429
|
const concurrency = 10;
|
|
54495
|
-
|
|
54496
|
-
while (offset < fileSize) {
|
|
54497
|
-
const end = Math.min(offset + sliceSize, fileSize);
|
|
54498
|
-
const chunk = fileBuffer.subarray(offset, end);
|
|
54499
|
-
slices.push({
|
|
54500
|
-
offset,
|
|
54501
|
-
end,
|
|
54502
|
-
seq,
|
|
54503
|
-
chunk
|
|
54504
|
-
});
|
|
54505
|
-
offset = end;
|
|
54506
|
-
seq++;
|
|
54507
|
-
}
|
|
54430
|
+
let sVid;
|
|
54508
54431
|
const uploadSlice = async (slice) => {
|
|
54509
|
-
const
|
|
54432
|
+
const cmd = slice.isVideo ? "FileUploadVideo" : "FileUpload";
|
|
54433
|
+
const uploadUrl = `https://${domain}/webapp/json/sliceUpload/${cmd}?seq=${slice.seq}&retry=0&offset=${slice.offset}&end=${slice.end}&total=${fileSize}&type=form&g_tk=${gtk}`;
|
|
54510
54434
|
const formData = new FormData();
|
|
54511
54435
|
formData.append("uin", selfInfo.uin);
|
|
54512
|
-
formData.append("appid", "qun");
|
|
54436
|
+
formData.append("appid", slice.isVideo ? "video_qun" : "qun");
|
|
54513
54437
|
formData.append("data", new Blob([Uint8Array.from(slice.chunk)]));
|
|
54514
|
-
formData.append("session", sessionId);
|
|
54438
|
+
formData.append("session", slice.sessionId);
|
|
54515
54439
|
formData.append("offset", slice.offset.toString());
|
|
54516
54440
|
formData.append("checksum", "");
|
|
54517
54441
|
formData.append("check_type", "0");
|
|
54518
54442
|
formData.append("retry", "0");
|
|
54519
54443
|
formData.append("seq", slice.seq.toString());
|
|
54520
54444
|
formData.append("end", slice.end.toString());
|
|
54521
|
-
formData.append("cmd",
|
|
54522
|
-
formData.append("slice_size", sliceSize
|
|
54445
|
+
formData.append("cmd", cmd);
|
|
54446
|
+
formData.append("slice_size", slice.sliceSize);
|
|
54523
54447
|
formData.append("biz_req.iUploadType", "0");
|
|
54524
54448
|
const uploadResJson = await (await fetch(uploadUrl, {
|
|
54525
54449
|
method: "POST",
|
|
@@ -54529,8 +54453,24 @@ var NTQQWebApi = class extends Service {
|
|
|
54529
54453
|
if (uploadResJson.ret !== 0) {
|
|
54530
54454
|
if (!errIndexList.includes(i)) errIndexList.push(i);
|
|
54531
54455
|
throw new Error(`群相册分片上传失败 (seq: ${slice.seq}): ${uploadResJson.msg}, file: ${filePath}`);
|
|
54532
|
-
}
|
|
54456
|
+
} else if (uploadResJson.data.biz.sVid) sVid = uploadResJson.data.biz.sVid;
|
|
54533
54457
|
};
|
|
54458
|
+
const slices = [];
|
|
54459
|
+
while (offset < fileSize) {
|
|
54460
|
+
const end = Math.min(offset + sliceSize, fileSize);
|
|
54461
|
+
const chunk = fileBuffer.subarray(offset, end);
|
|
54462
|
+
slices.push({
|
|
54463
|
+
offset,
|
|
54464
|
+
end,
|
|
54465
|
+
seq,
|
|
54466
|
+
chunk,
|
|
54467
|
+
isVideo: !!isVideo,
|
|
54468
|
+
sessionId: resJson.data.session,
|
|
54469
|
+
sliceSize: sliceSize.toString()
|
|
54470
|
+
});
|
|
54471
|
+
offset = end;
|
|
54472
|
+
seq++;
|
|
54473
|
+
}
|
|
54534
54474
|
for (let i = 0; i < slices.length; i += concurrency) {
|
|
54535
54475
|
const batch = slices.slice(i, i + concurrency);
|
|
54536
54476
|
try {
|
|
@@ -54539,6 +54479,112 @@ var NTQQWebApi = class extends Service {
|
|
|
54539
54479
|
this.ctx.logger.error(e);
|
|
54540
54480
|
}
|
|
54541
54481
|
}
|
|
54482
|
+
if (sVid) {
|
|
54483
|
+
const filePath = await createThumb(this.ctx, filePathList[i]);
|
|
54484
|
+
const fileBuffer = await fsPromise.readFile(filePath);
|
|
54485
|
+
const fileSize = fileBuffer.length;
|
|
54486
|
+
const timestamp = Math.floor(Date.now() / 1e3);
|
|
54487
|
+
const checksum = getMd5HexFromBuffer(fileBuffer);
|
|
54488
|
+
const getSessionUrl = `https://${domain}/webapp/json/sliceUpload/FileBatchControl/${checksum}?g_tk=${gtk}`;
|
|
54489
|
+
const getSessionPostData = { "control_req": [{
|
|
54490
|
+
"uin": selfInfo.uin,
|
|
54491
|
+
"token": {
|
|
54492
|
+
"type": 4,
|
|
54493
|
+
"data": cookiesObject.p_skey,
|
|
54494
|
+
"appid": 5
|
|
54495
|
+
},
|
|
54496
|
+
"appid": "qun",
|
|
54497
|
+
"checksum": checksum,
|
|
54498
|
+
"check_type": 0,
|
|
54499
|
+
"file_len": fileSize,
|
|
54500
|
+
"env": {
|
|
54501
|
+
"refer": "huodong",
|
|
54502
|
+
"deviceInfo": "h5"
|
|
54503
|
+
},
|
|
54504
|
+
"model": 0,
|
|
54505
|
+
"biz_req": {
|
|
54506
|
+
"sPicTitle": "",
|
|
54507
|
+
"sPicDesc": "",
|
|
54508
|
+
"sAlbumName": "",
|
|
54509
|
+
"sAlbumID": albumID,
|
|
54510
|
+
"iAlbumTypeID": 0,
|
|
54511
|
+
"iBitmap": 0,
|
|
54512
|
+
"iUploadType": 2,
|
|
54513
|
+
"iUpPicType": 0,
|
|
54514
|
+
"iBatchID": iBatchID,
|
|
54515
|
+
"sPicPath": "",
|
|
54516
|
+
"iPicWidth": 0,
|
|
54517
|
+
"iPicHight": 0,
|
|
54518
|
+
"iWaterType": 0,
|
|
54519
|
+
"iDistinctUse": 0,
|
|
54520
|
+
"mutliPicInfo": {
|
|
54521
|
+
"iBatUploadNum": fileLen,
|
|
54522
|
+
"iCurUpload": i,
|
|
54523
|
+
"iSuccNum": 0,
|
|
54524
|
+
"iFailNum": 0
|
|
54525
|
+
},
|
|
54526
|
+
"iNeedFeeds": 1,
|
|
54527
|
+
"iUploadTime": timestamp,
|
|
54528
|
+
"stExtendInfo": { "mapParams": {
|
|
54529
|
+
"vid": sVid,
|
|
54530
|
+
"photo_num": "0",
|
|
54531
|
+
"video_num": fileLen,
|
|
54532
|
+
"batch_num": fileLen
|
|
54533
|
+
} },
|
|
54534
|
+
"stExternalMapExt": {
|
|
54535
|
+
"is_client_upload_cover": "1",
|
|
54536
|
+
"is_pic_video_mix_feeds": "1"
|
|
54537
|
+
},
|
|
54538
|
+
"mapExt": {
|
|
54539
|
+
"appid": "qun",
|
|
54540
|
+
"userid": groupCode
|
|
54541
|
+
},
|
|
54542
|
+
"sExif_CameraMaker": "",
|
|
54543
|
+
"sExif_CameraModel": "",
|
|
54544
|
+
"sExif_Time": "",
|
|
54545
|
+
"sExif_LatitudeRef": "",
|
|
54546
|
+
"sExif_Latitude": "",
|
|
54547
|
+
"sExif_LongitudeRef": "",
|
|
54548
|
+
"sExif_Longitude": ""
|
|
54549
|
+
},
|
|
54550
|
+
"session": "",
|
|
54551
|
+
"asy_upload": 0
|
|
54552
|
+
}] };
|
|
54553
|
+
const resJson = await (await HttpUtil.post(getSessionUrl, getSessionPostData, this.cookieToString(cookiesObject))).json();
|
|
54554
|
+
if (resJson.ret !== 0) {
|
|
54555
|
+
this.ctx.logger.error(`获取群相册上传 session 失败: ${resJson.msg}`);
|
|
54556
|
+
errIndexList.push(i);
|
|
54557
|
+
continue;
|
|
54558
|
+
}
|
|
54559
|
+
const sliceSize = resJson.data.slice_size;
|
|
54560
|
+
let offset = 0;
|
|
54561
|
+
let seq = 1;
|
|
54562
|
+
const concurrency = 10;
|
|
54563
|
+
const slices = [];
|
|
54564
|
+
while (offset < fileSize) {
|
|
54565
|
+
const end = Math.min(offset + sliceSize, fileSize);
|
|
54566
|
+
const chunk = fileBuffer.subarray(offset, end);
|
|
54567
|
+
slices.push({
|
|
54568
|
+
offset,
|
|
54569
|
+
end,
|
|
54570
|
+
seq,
|
|
54571
|
+
chunk,
|
|
54572
|
+
isVideo: false,
|
|
54573
|
+
sessionId: resJson.data.session,
|
|
54574
|
+
sliceSize: sliceSize.toString()
|
|
54575
|
+
});
|
|
54576
|
+
offset = end;
|
|
54577
|
+
seq++;
|
|
54578
|
+
}
|
|
54579
|
+
for (let i = 0; i < slices.length; i += concurrency) {
|
|
54580
|
+
const batch = slices.slice(i, i + concurrency);
|
|
54581
|
+
try {
|
|
54582
|
+
await Promise.all(batch.map((slice) => uploadSlice(slice)));
|
|
54583
|
+
} catch (e) {
|
|
54584
|
+
this.ctx.logger.error(e);
|
|
54585
|
+
}
|
|
54586
|
+
}
|
|
54587
|
+
}
|
|
54542
54588
|
}
|
|
54543
54589
|
this.ctx.logger.info("群相册上传完成");
|
|
54544
54590
|
return {
|
|
@@ -54547,6 +54593,37 @@ var NTQQWebApi = class extends Service {
|
|
|
54547
54593
|
fail_indexes: errIndexList
|
|
54548
54594
|
};
|
|
54549
54595
|
}
|
|
54596
|
+
async publishGroupBulletin(groupCode, text, pinned, type, isShowEditCard, tipWindowType, confirmRequired, picId, imgWidth, imgHeight) {
|
|
54597
|
+
const cookieObject = await this.ctx.ntUserApi.getCookies("qun.qq.com");
|
|
54598
|
+
const bkn = this.genBkn(cookieObject.skey);
|
|
54599
|
+
const picInfo = {
|
|
54600
|
+
pic: picId,
|
|
54601
|
+
imgWidth: imgWidth?.toString(),
|
|
54602
|
+
imgHeight: imgHeight?.toString()
|
|
54603
|
+
};
|
|
54604
|
+
const res = await fetch("https://web.qun.qq.com/cgi-bin/announce/add_qun_notice", {
|
|
54605
|
+
method: "POST",
|
|
54606
|
+
headers: {
|
|
54607
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
54608
|
+
"Cookie": this.cookieToString(cookieObject)
|
|
54609
|
+
},
|
|
54610
|
+
body: new URLSearchParams({
|
|
54611
|
+
qid: groupCode,
|
|
54612
|
+
bkn,
|
|
54613
|
+
text,
|
|
54614
|
+
pinned: pinned.toString(),
|
|
54615
|
+
type: type.toString(),
|
|
54616
|
+
settings: JSON.stringify({
|
|
54617
|
+
is_show_edit_card: isShowEditCard,
|
|
54618
|
+
tip_window_type: tipWindowType,
|
|
54619
|
+
confirm_required: confirmRequired
|
|
54620
|
+
}),
|
|
54621
|
+
...picId ? picInfo : {}
|
|
54622
|
+
})
|
|
54623
|
+
});
|
|
54624
|
+
if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
|
|
54625
|
+
return await res.json();
|
|
54626
|
+
}
|
|
54550
54627
|
};
|
|
54551
54628
|
//#endregion
|
|
54552
54629
|
//#region src/ntqqapi/api/system.ts
|
|
@@ -58044,7 +58121,7 @@ var package_exports = /* @__PURE__ */ __exportAll({
|
|
|
58044
58121
|
var name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, engines, package_default;
|
|
58045
58122
|
var init_package = __esmMin((() => {
|
|
58046
58123
|
name = "nodemailer";
|
|
58047
|
-
version = "8.0.
|
|
58124
|
+
version = "8.0.7";
|
|
58048
58125
|
description = "Easy as cake e-mail sending from your Node.js applications";
|
|
58049
58126
|
main = "lib/nodemailer.js";
|
|
58050
58127
|
scripts = {
|
|
@@ -58067,20 +58144,19 @@ var init_package = __esmMin((() => {
|
|
|
58067
58144
|
bugs = { "url": "https://github.com/nodemailer/nodemailer/issues" };
|
|
58068
58145
|
homepage = "https://nodemailer.com/";
|
|
58069
58146
|
devDependencies = {
|
|
58070
|
-
"@aws-sdk/client-sesv2": "3.
|
|
58147
|
+
"@aws-sdk/client-sesv2": "3.1037.0",
|
|
58071
58148
|
"bunyan": "1.8.15",
|
|
58072
58149
|
"c8": "11.0.0",
|
|
58073
|
-
"eslint": "10.2.
|
|
58150
|
+
"eslint": "10.2.1",
|
|
58074
58151
|
"eslint-config-prettier": "10.1.8",
|
|
58075
|
-
"globals": "17.
|
|
58152
|
+
"globals": "17.5.0",
|
|
58076
58153
|
"libbase64": "1.3.0",
|
|
58077
|
-
"libmime": "5.3.
|
|
58154
|
+
"libmime": "5.3.8",
|
|
58078
58155
|
"libqp": "2.1.1",
|
|
58079
|
-
"
|
|
58080
|
-
"prettier": "3.8.1",
|
|
58156
|
+
"prettier": "3.8.3",
|
|
58081
58157
|
"proxy": "1.0.2",
|
|
58082
58158
|
"proxy-test-server": "1.0.0",
|
|
58083
|
-
"smtp-server": "3.18.
|
|
58159
|
+
"smtp-server": "3.18.4"
|
|
58084
58160
|
};
|
|
58085
58161
|
engines = { "node": ">=6.0.0" };
|
|
58086
58162
|
package_default = {
|
|
@@ -63478,9 +63554,10 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
63478
63554
|
if (lastAt < 0) return address;
|
|
63479
63555
|
let user = address.substr(0, lastAt);
|
|
63480
63556
|
const domain = address.substr(lastAt + 1);
|
|
63481
|
-
let encodedDomain;
|
|
63557
|
+
let encodedDomain = domain;
|
|
63482
63558
|
try {
|
|
63483
|
-
encodedDomain = punycode.
|
|
63559
|
+
if (/[\x80-\uFFFF]/.test(user)) encodedDomain = punycode.toUnicode(domain.toLowerCase());
|
|
63560
|
+
else encodedDomain = punycode.toASCII(domain.toLowerCase());
|
|
63484
63561
|
} catch (_err) {}
|
|
63485
63562
|
if (user.indexOf(" ") >= 0) {
|
|
63486
63563
|
if (user.charAt(0) !== "\"") user = "\"" + user;
|