llonebot-dist 7.12.13 → 7.12.14
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 +795 -595
- package/llbot.js.map +1 -1
- package/package.json +1 -1
- package/webui/assets/index-CM5wLm3n.css +2 -0
- package/webui/assets/{index-nQk7kGKN.js → index-DKpc1KFv.js} +3 -3
- package/webui/index.html +2 -2
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +6 -0
- package/webui/assets/index-D-XIyK1s.css +0 -2
package/llbot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import * as path$4 from "node:path";
|
|
3
3
|
import path, { dirname, join } from "node:path";
|
|
4
|
-
import fs, {
|
|
4
|
+
import fs, { copyFile, mkdir, readFile, stat, unlink, writeFile } from "node:fs/promises";
|
|
5
5
|
import fs$1, { existsSync } from "fs";
|
|
6
6
|
import * as fs$6 from "node:fs";
|
|
7
7
|
import fs$2, { appendFile, appendFileSync, createReadStream, existsSync as existsSync$1, mkdirSync, promises, stat as stat$1, statSync, watch } from "node:fs";
|
|
@@ -6475,19 +6475,6 @@ var ChatType = /* @__PURE__ */ function(ChatType) {
|
|
|
6475
6475
|
ChatType[ChatType["TempC2CFromGroup"] = 100] = "TempC2CFromGroup";
|
|
6476
6476
|
return ChatType;
|
|
6477
6477
|
}({});
|
|
6478
|
-
var RMBizType = /* @__PURE__ */ function(RMBizType) {
|
|
6479
|
-
RMBizType[RMBizType["Unknown"] = 0] = "Unknown";
|
|
6480
|
-
RMBizType[RMBizType["C2CFile"] = 1] = "C2CFile";
|
|
6481
|
-
RMBizType[RMBizType["GroupFile"] = 2] = "GroupFile";
|
|
6482
|
-
RMBizType[RMBizType["C2CPic"] = 3] = "C2CPic";
|
|
6483
|
-
RMBizType[RMBizType["GroupPic"] = 4] = "GroupPic";
|
|
6484
|
-
RMBizType[RMBizType["DiscPic"] = 5] = "DiscPic";
|
|
6485
|
-
RMBizType[RMBizType["C2CVideo"] = 6] = "C2CVideo";
|
|
6486
|
-
RMBizType[RMBizType["GroupVideo"] = 7] = "GroupVideo";
|
|
6487
|
-
RMBizType[RMBizType["C2CPtt"] = 8] = "C2CPtt";
|
|
6488
|
-
RMBizType[RMBizType["GroupPtt"] = 9] = "GroupPtt";
|
|
6489
|
-
return RMBizType;
|
|
6490
|
-
}({});
|
|
6491
6478
|
var MsgType = /* @__PURE__ */ function(MsgType) {
|
|
6492
6479
|
MsgType[MsgType["ArkStruct"] = 11] = "ArkStruct";
|
|
6493
6480
|
MsgType[MsgType["FaceBubble"] = 24] = "FaceBubble";
|
|
@@ -10801,7 +10788,7 @@ function encodeCQCode(input) {
|
|
|
10801
10788
|
}
|
|
10802
10789
|
//#endregion
|
|
10803
10790
|
//#region src/onebot11/transform/message/incoming.ts
|
|
10804
|
-
async function transformIncomingSegments$1(ctx, message
|
|
10791
|
+
async function transformIncomingSegments$1(ctx, message) {
|
|
10805
10792
|
const segments = [];
|
|
10806
10793
|
let cqCode = "";
|
|
10807
10794
|
for (const element of message.elements) {
|
|
@@ -10873,28 +10860,22 @@ async function transformIncomingSegments$1(ctx, message, rootMsgID, peer) {
|
|
|
10873
10860
|
data: {
|
|
10874
10861
|
file: picElement.fileName,
|
|
10875
10862
|
subType: picElement.picSubType,
|
|
10876
|
-
url: await ctx.ntFileApi.getImageUrl(picElement),
|
|
10863
|
+
url: await ctx.ntFileApi.getImageUrl(picElement.originImageUrl, picElement.md5HexStr),
|
|
10877
10864
|
file_size: fileSize
|
|
10878
10865
|
}
|
|
10879
10866
|
};
|
|
10880
10867
|
ctx.store.addFileCache({
|
|
10881
|
-
peerUid: message.peerUid,
|
|
10882
|
-
msgId: message.msgId,
|
|
10883
10868
|
msgTime: +message.msgTime,
|
|
10884
10869
|
chatType: message.chatType,
|
|
10885
|
-
elementId: element.elementId,
|
|
10886
10870
|
elementType: element.elementType,
|
|
10887
10871
|
fileName: picElement.fileName,
|
|
10888
10872
|
fileUuid: picElement.fileUuid,
|
|
10889
|
-
fileSize
|
|
10890
|
-
|
|
10873
|
+
fileSize,
|
|
10874
|
+
md5HexStr: picElement.md5HexStr
|
|
10875
|
+
});
|
|
10891
10876
|
} else if (element.videoElement) {
|
|
10892
10877
|
const { videoElement } = element;
|
|
10893
|
-
const videoUrl = await ctx.ntFileApi.getVideoUrl(
|
|
10894
|
-
chatType: message.chatType,
|
|
10895
|
-
peerUid: message.peerUid,
|
|
10896
|
-
guildId: ""
|
|
10897
|
-
}, rootMsgID ?? message.msgId, element.elementId);
|
|
10878
|
+
const videoUrl = await ctx.ntFileApi.getVideoUrl(videoElement.fileUuid, message.chatType === ChatType.Group);
|
|
10898
10879
|
const fileSize = videoElement.fileSize ?? "0";
|
|
10899
10880
|
messageSegment = {
|
|
10900
10881
|
type: OB11MessageDataType.Video,
|
|
@@ -10906,16 +10887,14 @@ async function transformIncomingSegments$1(ctx, message, rootMsgID, peer) {
|
|
|
10906
10887
|
}
|
|
10907
10888
|
};
|
|
10908
10889
|
ctx.store.addFileCache({
|
|
10909
|
-
peerUid: message.peerUid,
|
|
10910
|
-
msgId: message.msgId,
|
|
10911
10890
|
msgTime: +message.msgTime,
|
|
10912
10891
|
chatType: message.chatType,
|
|
10913
|
-
elementId: element.elementId,
|
|
10914
10892
|
elementType: element.elementType,
|
|
10915
10893
|
fileName: videoElement.fileName,
|
|
10916
10894
|
fileUuid: videoElement.fileUuid,
|
|
10917
|
-
fileSize
|
|
10918
|
-
|
|
10895
|
+
fileSize,
|
|
10896
|
+
md5HexStr: videoElement.videoMd5
|
|
10897
|
+
});
|
|
10919
10898
|
} else if (element.fileElement) {
|
|
10920
10899
|
const { fileElement } = element;
|
|
10921
10900
|
const fileSize = fileElement.fileSize ?? "0";
|
|
@@ -10930,16 +10909,14 @@ async function transformIncomingSegments$1(ctx, message, rootMsgID, peer) {
|
|
|
10930
10909
|
}
|
|
10931
10910
|
};
|
|
10932
10911
|
ctx.store.addFileCache({
|
|
10933
|
-
peerUid: message.peerUid,
|
|
10934
|
-
msgId: message.msgId,
|
|
10935
10912
|
msgTime: +message.msgTime,
|
|
10936
10913
|
chatType: message.chatType,
|
|
10937
|
-
elementId: element.elementId,
|
|
10938
10914
|
elementType: element.elementType,
|
|
10939
10915
|
fileName: fileElement.fileName,
|
|
10940
10916
|
fileUuid: fileElement.fileUuid,
|
|
10941
|
-
fileSize
|
|
10942
|
-
|
|
10917
|
+
fileSize,
|
|
10918
|
+
md5HexStr: fileElement.fileMd5
|
|
10919
|
+
});
|
|
10943
10920
|
} else if (element.pttElement) {
|
|
10944
10921
|
const { pttElement } = element;
|
|
10945
10922
|
const fileSize = pttElement.fileSize ?? "0";
|
|
@@ -10953,16 +10930,14 @@ async function transformIncomingSegments$1(ctx, message, rootMsgID, peer) {
|
|
|
10953
10930
|
}
|
|
10954
10931
|
};
|
|
10955
10932
|
ctx.store.addFileCache({
|
|
10956
|
-
peerUid: message.peerUid,
|
|
10957
|
-
msgId: message.msgId,
|
|
10958
10933
|
msgTime: +message.msgTime,
|
|
10959
10934
|
chatType: message.chatType,
|
|
10960
|
-
elementId: element.elementId,
|
|
10961
10935
|
elementType: element.elementType,
|
|
10962
10936
|
fileName: pttElement.fileName,
|
|
10963
10937
|
fileUuid: pttElement.fileUuid,
|
|
10964
|
-
fileSize
|
|
10965
|
-
|
|
10938
|
+
fileSize,
|
|
10939
|
+
md5HexStr: pttElement.md5HexStr
|
|
10940
|
+
});
|
|
10966
10941
|
} else if (element.arkElement) {
|
|
10967
10942
|
const { arkElement } = element;
|
|
10968
10943
|
try {
|
|
@@ -11081,11 +11056,11 @@ async function transformIncomingSegments$1(ctx, message, rootMsgID, peer) {
|
|
|
11081
11056
|
//#region src/onebot11/entities.ts
|
|
11082
11057
|
var OB11Entities;
|
|
11083
11058
|
(function(_OB11Entities) {
|
|
11084
|
-
async function message(ctx, msg,
|
|
11059
|
+
async function message(ctx, msg, config) {
|
|
11085
11060
|
if (!msg.senderUin || msg.senderUin === "0" || msg.msgType === 1) return;
|
|
11086
11061
|
const selfUin = selfInfo.uin;
|
|
11087
11062
|
const msgShortId = ctx.store.createMsgShortId(msg);
|
|
11088
|
-
const { segments, cqCode } = await transformIncomingSegments$1(ctx, msg
|
|
11063
|
+
const { segments, cqCode } = await transformIncomingSegments$1(ctx, msg);
|
|
11089
11064
|
const resMsg = {
|
|
11090
11065
|
self_id: Number(selfUin),
|
|
11091
11066
|
user_id: Number(msg.senderUin),
|
|
@@ -11251,16 +11226,16 @@ var OB11Entities;
|
|
|
11251
11226
|
_OB11Entities.recallEvent = recallEvent;
|
|
11252
11227
|
function friend(raw) {
|
|
11253
11228
|
return {
|
|
11254
|
-
user_id:
|
|
11255
|
-
nickname: raw.
|
|
11256
|
-
remark: raw.
|
|
11257
|
-
sex: sex(raw.
|
|
11258
|
-
birthday_year: raw.
|
|
11259
|
-
birthday_month: raw.
|
|
11260
|
-
birthday_day: raw.
|
|
11261
|
-
age: raw.
|
|
11262
|
-
qid: raw.
|
|
11263
|
-
long_nick: raw.
|
|
11229
|
+
user_id: raw.uin,
|
|
11230
|
+
nickname: raw.nick,
|
|
11231
|
+
remark: raw.remark,
|
|
11232
|
+
sex: sex(raw.sex),
|
|
11233
|
+
birthday_year: raw.birthdayYear,
|
|
11234
|
+
birthday_month: raw.birthdayMonth,
|
|
11235
|
+
birthday_day: raw.birthdayDay,
|
|
11236
|
+
age: raw.age,
|
|
11237
|
+
qid: raw.qid,
|
|
11238
|
+
long_nick: raw.longNick
|
|
11264
11239
|
};
|
|
11265
11240
|
}
|
|
11266
11241
|
_OB11Entities.friend = friend;
|
|
@@ -11389,7 +11364,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
|
|
|
11389
11364
|
};
|
|
11390
11365
|
//#endregion
|
|
11391
11366
|
//#region src/version.ts
|
|
11392
|
-
var version$2 = "7.12.
|
|
11367
|
+
var version$2 = "7.12.14";
|
|
11393
11368
|
//#endregion
|
|
11394
11369
|
//#region node_modules/sift/es5m/index.js
|
|
11395
11370
|
/******************************************************************************
|
|
@@ -17152,7 +17127,7 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17152
17127
|
let filePath = path.join(TEMP_DIR, fileName);
|
|
17153
17128
|
await fs.writeFile(filePath, res.data);
|
|
17154
17129
|
if (needExt) {
|
|
17155
|
-
const ext = (await
|
|
17130
|
+
const ext = (await getFileType(filePath)).ext;
|
|
17156
17131
|
fileName += `.${ext}`;
|
|
17157
17132
|
const newPath = `${filePath}.${ext}`;
|
|
17158
17133
|
await fs.rename(filePath, newPath);
|
|
@@ -17180,7 +17155,7 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17180
17155
|
const base64 = uri.replace(/^base64:\/\//, "");
|
|
17181
17156
|
await fs.writeFile(filePath, base64, "base64");
|
|
17182
17157
|
if (needExt) {
|
|
17183
|
-
const ext = (await
|
|
17158
|
+
const ext = (await getFileType(filePath)).ext;
|
|
17184
17159
|
filename += `.${ext}`;
|
|
17185
17160
|
await fs.rename(filePath, `${filePath}.${ext}`);
|
|
17186
17161
|
filePath = `${filePath}.${ext}`;
|
|
@@ -17201,7 +17176,7 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17201
17176
|
let filePath = path.join(TEMP_DIR, filename);
|
|
17202
17177
|
await fs.writeFile(filePath, base64, "base64");
|
|
17203
17178
|
if (needExt) {
|
|
17204
|
-
const ext = (await
|
|
17179
|
+
const ext = (await getFileType(filePath)).ext;
|
|
17205
17180
|
filename += `.${ext}`;
|
|
17206
17181
|
await fs.rename(filePath, `${filePath}.${ext}`);
|
|
17207
17182
|
filePath = `${filePath}.${ext}`;
|
|
@@ -17219,13 +17194,20 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
17219
17194
|
let fileCache = await ctx.store.getFileCacheById(uri);
|
|
17220
17195
|
if (!fileCache?.length) fileCache = await ctx.store.getFileCacheByName(uri);
|
|
17221
17196
|
if (fileCache?.length) {
|
|
17222
|
-
const
|
|
17223
|
-
|
|
17224
|
-
|
|
17225
|
-
|
|
17226
|
-
|
|
17227
|
-
|
|
17228
|
-
|
|
17197
|
+
const isGroup = fileCache[0].chatType === ChatType.Group;
|
|
17198
|
+
let url;
|
|
17199
|
+
if (fileCache[0].elementType === ElementType.Pic) {
|
|
17200
|
+
const originImageUrl = `/download?appid=${isGroup ? 1407 : 1406}&fileid=${fileCache[0].fileUuid}&spec=0`;
|
|
17201
|
+
url = await ctx.ntFileApi.getImageUrl(originImageUrl, fileCache[0].md5HexStr);
|
|
17202
|
+
} else if (fileCache[0].elementType === ElementType.Video) url = await ctx.ntFileApi.getVideoUrl(fileCache[0].fileUuid, isGroup);
|
|
17203
|
+
else if (fileCache[0].elementType === ElementType.Ptt) url = await ctx.ntFileApi.getPttUrl(fileCache[0].fileUuid, isGroup);
|
|
17204
|
+
if (url) return await uri2local(ctx, url, needExt);
|
|
17205
|
+
else return {
|
|
17206
|
+
success: false,
|
|
17207
|
+
errMsg: `不支持的文件类型: ${fileCache[0].elementType}`,
|
|
17208
|
+
fileName: "",
|
|
17209
|
+
path: "",
|
|
17210
|
+
isLocal: false
|
|
17229
17211
|
};
|
|
17230
17212
|
}
|
|
17231
17213
|
}
|
|
@@ -17776,16 +17758,17 @@ var SendElement;
|
|
|
17776
17758
|
const fileSize = (await stat(picPath)).size;
|
|
17777
17759
|
if (fileSize === 0) throw new Error(`文件异常,大小为 0: ${picPath}`);
|
|
17778
17760
|
const { md5, fileName, path } = await ctx.ntFileApi.uploadFile(picPath, ElementType.Pic, subType);
|
|
17779
|
-
const
|
|
17761
|
+
const fileType = await getFileType(picPath);
|
|
17762
|
+
const size = await getImageSize(picPath);
|
|
17780
17763
|
const picElement = {
|
|
17781
17764
|
md5HexStr: md5,
|
|
17782
17765
|
fileSize: fileSize.toString(),
|
|
17783
|
-
picWidth:
|
|
17784
|
-
picHeight:
|
|
17766
|
+
picWidth: size.width,
|
|
17767
|
+
picHeight: size.height,
|
|
17785
17768
|
fileName,
|
|
17786
17769
|
sourcePath: path,
|
|
17787
17770
|
original: true,
|
|
17788
|
-
picType:
|
|
17771
|
+
picType: fileType.ext === "gif" ? PicType.GIF : PicType.JPEG,
|
|
17789
17772
|
picSubType: subType,
|
|
17790
17773
|
fileUuid: "",
|
|
17791
17774
|
fileSubId: "",
|
|
@@ -18066,6 +18049,9 @@ function uint32ToIPV4Addr(value) {
|
|
|
18066
18049
|
function sleep(ms = 0) {
|
|
18067
18050
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
18068
18051
|
}
|
|
18052
|
+
function isHttpUrl(str) {
|
|
18053
|
+
return /^https?:\/\/.+/.test(str);
|
|
18054
|
+
}
|
|
18069
18055
|
//#endregion
|
|
18070
18056
|
//#region src/common/utils/sign.ts
|
|
18071
18057
|
var MusicSign = class {
|
|
@@ -18198,7 +18184,7 @@ async function createSendElements(ctx, messageData, peer, ignoreTypes = []) {
|
|
|
18198
18184
|
case OB11MessageDataType.Contact:
|
|
18199
18185
|
{
|
|
18200
18186
|
const { type, id } = segment.data;
|
|
18201
|
-
const data = type === "qq" ? ctx.ntFriendApi.
|
|
18187
|
+
const data = type === "qq" ? ctx.ntFriendApi.getFriendRecommendContactArk(+id) : ctx.ntGroupApi.getGroupRecommendContact(id);
|
|
18202
18188
|
sendElements.push(SendElement.ark(await data));
|
|
18203
18189
|
}
|
|
18204
18190
|
break;
|
|
@@ -18314,7 +18300,7 @@ async function createPeer(ctx, payload, mode = CreatePeerMode.Normal) {
|
|
|
18314
18300
|
if ((mode === CreatePeerMode.Private || mode === CreatePeerMode.Normal) && payload.user_id) {
|
|
18315
18301
|
const uid = await ctx.ntUserApi.getUidByUin(payload.user_id.toString(), payload.group_id?.toString());
|
|
18316
18302
|
if (!uid) throw new Error("无法获取用户信息");
|
|
18317
|
-
if (!await ctx.ntFriendApi.
|
|
18303
|
+
if (!await ctx.ntFriendApi.isFriend(uid)) {
|
|
18318
18304
|
if ((await ctx.ntMsgApi.getTempChatInfo(ChatType.TempC2CFromGroup, uid)).tmpChatInfo.groupCode) return {
|
|
18319
18305
|
chatType: ChatType.TempC2CFromGroup,
|
|
18320
18306
|
peerUid: uid,
|
|
@@ -18391,12 +18377,8 @@ async function handleMsg(ctx, msg, quickAction) {
|
|
|
18391
18377
|
}
|
|
18392
18378
|
async function handleFriendRequest$1(ctx, request, quickAction) {
|
|
18393
18379
|
if (!isNullable(quickAction.approve)) {
|
|
18394
|
-
|
|
18395
|
-
if (
|
|
18396
|
-
const uid = data[0];
|
|
18397
|
-
const reqTime = data[1];
|
|
18398
|
-
await ctx.ntFriendApi.handleFriendRequest(uid, reqTime, quickAction.approve).catch((e) => ctx.logger.error(e));
|
|
18399
|
-
if (!isNullable(quickAction.remark)) ctx.ntFriendApi.setBuddyRemark(uid, quickAction.remark).catch((e) => ctx.logger.error(e));
|
|
18380
|
+
await ctx.ntFriendApi.approvalFriendRequest(request.flag, quickAction.approve).catch((e) => ctx.logger.error(e));
|
|
18381
|
+
if (!isNullable(quickAction.remark)) ctx.ntFriendApi.setBuddyRemark(request.flag, quickAction.remark).catch((e) => ctx.logger.error(e));
|
|
18400
18382
|
}
|
|
18401
18383
|
}
|
|
18402
18384
|
async function handleGroupRequest(ctx, request, quickAction) {
|
|
@@ -21234,10 +21216,31 @@ var CloseEvent = globalThis.CloseEvent ?? class extends Event {
|
|
|
21234
21216
|
var generateConnectionSymbol = () => Symbol("connection");
|
|
21235
21217
|
var CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
|
|
21236
21218
|
var WAIT_FOR_WEBSOCKET_SYMBOL = Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");
|
|
21237
|
-
var
|
|
21238
|
-
|
|
21239
|
-
|
|
21240
|
-
|
|
21219
|
+
var responseHeadersToSkip = new Set([
|
|
21220
|
+
"connection",
|
|
21221
|
+
"content-length",
|
|
21222
|
+
"keep-alive",
|
|
21223
|
+
"proxy-authenticate",
|
|
21224
|
+
"proxy-authorization",
|
|
21225
|
+
"te",
|
|
21226
|
+
"trailer",
|
|
21227
|
+
"transfer-encoding",
|
|
21228
|
+
"upgrade",
|
|
21229
|
+
"sec-websocket-accept",
|
|
21230
|
+
"sec-websocket-extensions",
|
|
21231
|
+
"sec-websocket-protocol"
|
|
21232
|
+
]);
|
|
21233
|
+
var appendResponseHeaders = (headers, responseHeaders) => {
|
|
21234
|
+
if (!responseHeaders) return;
|
|
21235
|
+
responseHeaders.forEach((value, key) => {
|
|
21236
|
+
if (responseHeadersToSkip.has(key.toLowerCase())) return;
|
|
21237
|
+
headers.push(`${key}: ${value}`);
|
|
21238
|
+
});
|
|
21239
|
+
};
|
|
21240
|
+
var rejectUpgradeRequest = (socket, status, responseHeaders) => {
|
|
21241
|
+
const responseLines = ["Connection: close", "Content-Length: 0"];
|
|
21242
|
+
appendResponseHeaders(responseLines, responseHeaders);
|
|
21243
|
+
socket.end(`HTTP/1.1 ${status.toString()} ${STATUS_CODES[status] ?? ""}\r\n${responseLines.join("\r\n")}\r\n\r
|
|
21241
21244
|
`);
|
|
21242
21245
|
};
|
|
21243
21246
|
var createUpgradeRequest = (request) => {
|
|
@@ -21278,9 +21281,13 @@ var setupWebSocket = (options) => {
|
|
|
21278
21281
|
[WAIT_FOR_WEBSOCKET_SYMBOL]: waitForWebSocket
|
|
21279
21282
|
};
|
|
21280
21283
|
let status = 400;
|
|
21284
|
+
let responseHeaders;
|
|
21281
21285
|
try {
|
|
21282
21286
|
const response = await fetchCallback(createUpgradeRequest(request), env);
|
|
21283
|
-
if (response instanceof Response)
|
|
21287
|
+
if (response instanceof Response) {
|
|
21288
|
+
status = response.status;
|
|
21289
|
+
responseHeaders = response.headers;
|
|
21290
|
+
}
|
|
21284
21291
|
} catch {
|
|
21285
21292
|
if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, 500);
|
|
21286
21293
|
return;
|
|
@@ -21288,12 +21295,20 @@ var setupWebSocket = (options) => {
|
|
|
21288
21295
|
const waiter = waiterMap.get(request);
|
|
21289
21296
|
if (!waiter || waiter.connectionSymbol !== env[CONNECTION_SYMBOL_KEY]) {
|
|
21290
21297
|
waiterMap.delete(request);
|
|
21291
|
-
if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, status);
|
|
21298
|
+
if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, status, responseHeaders);
|
|
21292
21299
|
return;
|
|
21293
21300
|
}
|
|
21294
|
-
|
|
21295
|
-
|
|
21296
|
-
}
|
|
21301
|
+
const addResponseHeaders = (headers) => {
|
|
21302
|
+
appendResponseHeaders(headers, responseHeaders);
|
|
21303
|
+
};
|
|
21304
|
+
wss.on("headers", addResponseHeaders);
|
|
21305
|
+
try {
|
|
21306
|
+
wss.handleUpgrade(request, socket, head, (ws) => {
|
|
21307
|
+
wss.emit("connection", ws, request);
|
|
21308
|
+
});
|
|
21309
|
+
} finally {
|
|
21310
|
+
wss.off("headers", addResponseHeaders);
|
|
21311
|
+
}
|
|
21297
21312
|
});
|
|
21298
21313
|
server.on("close", () => {
|
|
21299
21314
|
wss.close();
|
|
@@ -21773,7 +21788,7 @@ var GetMsg = class extends BaseAction {
|
|
|
21773
21788
|
status = "deleted";
|
|
21774
21789
|
}
|
|
21775
21790
|
} else msg = res.msgList[0];
|
|
21776
|
-
const retMsg = await OB11Entities.message(this.ctx, msg,
|
|
21791
|
+
const retMsg = await OB11Entities.message(this.ctx, msg, config);
|
|
21777
21792
|
if (!retMsg) throw new Error("消息为空");
|
|
21778
21793
|
retMsg.real_id = retMsg.message_seq;
|
|
21779
21794
|
retMsg.status = status;
|
|
@@ -21802,8 +21817,8 @@ var GetLoginInfo$1 = class extends BaseAction {
|
|
|
21802
21817
|
var GetFriendList$1 = class extends BaseAction {
|
|
21803
21818
|
actionName = ActionName.GetFriendList;
|
|
21804
21819
|
async _handle() {
|
|
21805
|
-
const
|
|
21806
|
-
return OB11Entities.friends(
|
|
21820
|
+
const result = await this.ctx.ntFriendApi.getFriendList(true);
|
|
21821
|
+
return OB11Entities.friends(result.friends);
|
|
21807
21822
|
}
|
|
21808
21823
|
};
|
|
21809
21824
|
//#endregion
|
|
@@ -23669,6 +23684,103 @@ var Oidb;
|
|
|
23669
23684
|
allFileCount: ProtoField(7, "uint32"),
|
|
23670
23685
|
nextIndex: ProtoField(13, "uint32")
|
|
23671
23686
|
}) });
|
|
23687
|
+
_Oidb.ImageOcrReq = ProtoMessage.of({
|
|
23688
|
+
version: ProtoField(1, "uint32"),
|
|
23689
|
+
client: ProtoField(2, "uint32"),
|
|
23690
|
+
entrance: ProtoField(3, "uint32"),
|
|
23691
|
+
ocrReqBody: ProtoField(10, {
|
|
23692
|
+
imageUrl: ProtoField(1, "string"),
|
|
23693
|
+
languageType: ProtoField(2, "uint32"),
|
|
23694
|
+
scene: ProtoField(3, "uint32"),
|
|
23695
|
+
originMd5: ProtoField(10, "string"),
|
|
23696
|
+
afterCompressMd5: ProtoField(11, "string"),
|
|
23697
|
+
afterCompressFileSize: ProtoField(12, "string"),
|
|
23698
|
+
afterCompressWeight: ProtoField(13, "string"),
|
|
23699
|
+
afterCompressHeight: ProtoField(14, "string"),
|
|
23700
|
+
isCut: ProtoField(15, "bool")
|
|
23701
|
+
})
|
|
23702
|
+
});
|
|
23703
|
+
_Oidb.ImageOcrResp = ProtoMessage.of({
|
|
23704
|
+
retCode: ProtoField(1, "int32", "optional"),
|
|
23705
|
+
errMsg: ProtoField(2, "string"),
|
|
23706
|
+
wording: ProtoField(3, "string", "optional"),
|
|
23707
|
+
ocrRspBody: ProtoField(10, {
|
|
23708
|
+
textDetections: ProtoField(1, {
|
|
23709
|
+
detectedText: ProtoField(1, "string"),
|
|
23710
|
+
confidence: ProtoField(2, "uint32"),
|
|
23711
|
+
polygon: ProtoField(3, { coordinates: ProtoField(1, {
|
|
23712
|
+
x: ProtoField(1, "int32"),
|
|
23713
|
+
y: ProtoField(2, "int32")
|
|
23714
|
+
}, "repeated") }),
|
|
23715
|
+
advancedInfo: ProtoField(4, "string")
|
|
23716
|
+
}, "repeated"),
|
|
23717
|
+
language: ProtoField(2, "string"),
|
|
23718
|
+
requestId: ProtoField(3, "string"),
|
|
23719
|
+
ocrLanguageList: ProtoField(101, "string", "repeated"),
|
|
23720
|
+
dstTranslateLanguageList: ProtoField(102, "string", "repeated"),
|
|
23721
|
+
languageList: ProtoField(103, {
|
|
23722
|
+
languageCode: ProtoField(1, "string"),
|
|
23723
|
+
languageDesc: ProtoField(2, "string")
|
|
23724
|
+
}, "repeated"),
|
|
23725
|
+
afterCompressWeight: ProtoField(111, "uint32"),
|
|
23726
|
+
afterCompressHeight: ProtoField(112, "uint32")
|
|
23727
|
+
})
|
|
23728
|
+
});
|
|
23729
|
+
_Oidb.SetFriendRequestReq = ProtoMessage.of({
|
|
23730
|
+
accept: ProtoField(1, "uint32"),
|
|
23731
|
+
targetUid: ProtoField(2, "string")
|
|
23732
|
+
});
|
|
23733
|
+
_Oidb.SetFilteredFriendRequestReq = ProtoMessage.of({
|
|
23734
|
+
selfUid: ProtoField(1, "string"),
|
|
23735
|
+
requestUid: ProtoField(2, "string")
|
|
23736
|
+
});
|
|
23737
|
+
_Oidb.IncPullReq = ProtoMessage.of({
|
|
23738
|
+
reqCount: ProtoField(2, "uint32"),
|
|
23739
|
+
time: ProtoField(3, "uint32"),
|
|
23740
|
+
localSeq: ProtoField(4, "uint32"),
|
|
23741
|
+
cookie: ProtoField(5, "bytes", "optional"),
|
|
23742
|
+
flag: ProtoField(6, "int32"),
|
|
23743
|
+
proxySeq: ProtoField(7, "uint32"),
|
|
23744
|
+
requestBiz: ProtoField(10001, {
|
|
23745
|
+
bizType: ProtoField(1, "int32"),
|
|
23746
|
+
bizData: ProtoField(2, { extBusi: ProtoField(1, "int32", "repeated") })
|
|
23747
|
+
}, "repeated"),
|
|
23748
|
+
extSnsFlagKey: ProtoField(10002, "uint32", "repeated"),
|
|
23749
|
+
extPrivateIdListKey: ProtoField(10003, "uint32", "repeated")
|
|
23750
|
+
});
|
|
23751
|
+
_Oidb.IncPullResp = ProtoMessage.of({
|
|
23752
|
+
seq: ProtoField(1, "uint32"),
|
|
23753
|
+
cookie: ProtoField(2, "bytes", "optional"),
|
|
23754
|
+
isEnd: ProtoField(3, "bool"),
|
|
23755
|
+
time: ProtoField(6, "uint32"),
|
|
23756
|
+
selfUin: ProtoField(7, "uint32"),
|
|
23757
|
+
smallSeq: ProtoField(8, "uint32"),
|
|
23758
|
+
friendList: ProtoField(101, {
|
|
23759
|
+
uid: ProtoField(1, "string"),
|
|
23760
|
+
categoryId: ProtoField(2, "int32"),
|
|
23761
|
+
uin: ProtoField(3, "uint32"),
|
|
23762
|
+
subBiz: ProtoField(10001, ["int32", {
|
|
23763
|
+
numData: ProtoField(1, ["int32", "int32"]),
|
|
23764
|
+
data: ProtoField(2, ["int32", "bytes"])
|
|
23765
|
+
}])
|
|
23766
|
+
}, "repeated"),
|
|
23767
|
+
category: ProtoField(102, {
|
|
23768
|
+
categoryId: ProtoField(1, "int32"),
|
|
23769
|
+
categoryName: ProtoField(2, "string"),
|
|
23770
|
+
categoryMemberCount: ProtoField(3, "int32"),
|
|
23771
|
+
categorySortId: ProtoField(4, "int32")
|
|
23772
|
+
}, "repeated")
|
|
23773
|
+
});
|
|
23774
|
+
_Oidb.FetchPinsResp = ProtoMessage.of({
|
|
23775
|
+
friends: ProtoField(1, { uid: ProtoField(1, "string") }, "repeated"),
|
|
23776
|
+
groups: ProtoField(3, { groupCode: ProtoField(1, "uint32") }, "repeated")
|
|
23777
|
+
});
|
|
23778
|
+
_Oidb.GetFriendRecommendContactArkReq = ProtoMessage.of({
|
|
23779
|
+
uin: ProtoField(1, "uint32"),
|
|
23780
|
+
phoneNumber: ProtoField(2, "string"),
|
|
23781
|
+
jumpUrl: ProtoField(3, "string")
|
|
23782
|
+
});
|
|
23783
|
+
_Oidb.GetFriendRecommendContactArkResp = ProtoMessage.of({ ark: ProtoField(1, "string") });
|
|
23672
23784
|
})(Oidb || (Oidb = {}));
|
|
23673
23785
|
//#endregion
|
|
23674
23786
|
//#region src/ntqqapi/proto/msg.ts
|
|
@@ -23956,53 +24068,10 @@ var MessageEncoder$1 = class MessageEncoder$1 {
|
|
|
23956
24068
|
this.content = void 0;
|
|
23957
24069
|
this.preview = "";
|
|
23958
24070
|
}
|
|
23959
|
-
async packImage(
|
|
23960
|
-
const imageSize = await this.ctx.ntFileApi.getImageSize(data.filePath);
|
|
24071
|
+
async packImage(msgInfo) {
|
|
23961
24072
|
return { commonElem: {
|
|
23962
24073
|
serviceType: 48,
|
|
23963
|
-
pbElem: Media.MsgInfo.encode(
|
|
23964
|
-
msgInfoBody: [{
|
|
23965
|
-
index: {
|
|
23966
|
-
info: {
|
|
23967
|
-
fileSize: +data.commonFileInfo.fileSize,
|
|
23968
|
-
md5HexStr: data.commonFileInfo.md5,
|
|
23969
|
-
sha1HexStr: data.commonFileInfo.sha,
|
|
23970
|
-
fileName: data.commonFileInfo.fileName,
|
|
23971
|
-
fileType: {
|
|
23972
|
-
type: 1,
|
|
23973
|
-
picFormat: imageSize.type === "gif" ? 2e3 : 1e3
|
|
23974
|
-
},
|
|
23975
|
-
width: imageSize.width,
|
|
23976
|
-
height: imageSize.height,
|
|
23977
|
-
time: 0,
|
|
23978
|
-
original: 1
|
|
23979
|
-
},
|
|
23980
|
-
fileUuid: data.fileId,
|
|
23981
|
-
storeID: 1,
|
|
23982
|
-
expire: this.isGroup ? 2678400 : 15768e4
|
|
23983
|
-
},
|
|
23984
|
-
pic: {
|
|
23985
|
-
urlPath: `/download?appid=${this.isGroup ? 1407 : 1406}&fileid=${data.fileId}`,
|
|
23986
|
-
ext: {
|
|
23987
|
-
originalParam: "&spec=0",
|
|
23988
|
-
bigParam: "&spec=720",
|
|
23989
|
-
thumbParam: "&spec=198"
|
|
23990
|
-
},
|
|
23991
|
-
domain: "multimedia.nt.qq.com.cn"
|
|
23992
|
-
},
|
|
23993
|
-
fileExist: true
|
|
23994
|
-
}],
|
|
23995
|
-
extBizInfo: {
|
|
23996
|
-
pic: {
|
|
23997
|
-
bizType: 0,
|
|
23998
|
-
summary: "",
|
|
23999
|
-
fromScene: this.isGroup ? 2 : 1,
|
|
24000
|
-
toScene: this.isGroup ? 2 : 1,
|
|
24001
|
-
oldFileId: this.isGroup ? 574859779 : void 0
|
|
24002
|
-
},
|
|
24003
|
-
busiType
|
|
24004
|
-
}
|
|
24005
|
-
}),
|
|
24074
|
+
pbElem: Media.MsgInfo.encode(msgInfo),
|
|
24006
24075
|
businessType: this.isGroup ? 20 : 10
|
|
24007
24076
|
} };
|
|
24008
24077
|
}
|
|
@@ -24084,11 +24153,11 @@ var MessageEncoder$1 = class MessageEncoder$1 {
|
|
|
24084
24153
|
const busiType = Number(segment.data.subType) || 0;
|
|
24085
24154
|
const { path: picPath } = await handleOb11RichMedia(this.ctx, segment, this.deleteAfterSentFiles);
|
|
24086
24155
|
if ((await stat(picPath)).size === 0) throw new Error(`文件异常,大小为 0: ${picPath}`);
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
this.
|
|
24156
|
+
let data;
|
|
24157
|
+
if (this.isGroup) data = await this.ctx.ntFileApi.uploadGroupImage(this.peer.peerUid, picPath);
|
|
24158
|
+
else data = await this.ctx.ntFileApi.uploadC2CImage(this.peer.peerUid, picPath);
|
|
24159
|
+
this.children.push(await this.packImage(data.msgInfo));
|
|
24090
24160
|
this.preview += busiType === 1 ? "[动画表情]" : "[图片]";
|
|
24091
|
-
this.deleteAfterSentFiles.push(path);
|
|
24092
24161
|
} else if (type === OB11MessageDataType.Forward) {
|
|
24093
24162
|
const forwardData = data;
|
|
24094
24163
|
if (forwardData.id) this.children.push(this.packForwardMessage(forwardData.id, void 0, forwardData));
|
|
@@ -24607,14 +24676,9 @@ var SetFriendAddRequest = class extends BaseAction {
|
|
|
24607
24676
|
remark: lib_default$1.string()
|
|
24608
24677
|
});
|
|
24609
24678
|
async _handle(payload) {
|
|
24610
|
-
|
|
24611
|
-
if (data.length < 2) throw new Error("无效的flag");
|
|
24612
|
-
const uid = data[0];
|
|
24613
|
-
const reqTime = data[1];
|
|
24614
|
-
const res = await this.ctx.ntFriendApi.handleFriendRequest(uid, reqTime, payload.approve);
|
|
24615
|
-
if (res.result !== 0) throw new Error(res.errMsg);
|
|
24679
|
+
await this.ctx.ntFriendApi.approvalFriendRequest(payload.flag, payload.approve);
|
|
24616
24680
|
if (payload.remark) {
|
|
24617
|
-
const res = await this.ctx.ntFriendApi.setBuddyRemark(
|
|
24681
|
+
const res = await this.ctx.ntFriendApi.setBuddyRemark(payload.flag, payload.remark);
|
|
24618
24682
|
if (res.result !== 0) throw new Error(res.errMsg);
|
|
24619
24683
|
}
|
|
24620
24684
|
return null;
|
|
@@ -24740,26 +24804,23 @@ var GetFileBase = class extends BaseAction {
|
|
|
24740
24804
|
if (!fileCache?.length) fileCache = await this.ctx.store.getFileCacheByName(payload.file);
|
|
24741
24805
|
if (fileCache?.length) {
|
|
24742
24806
|
let downloadPath = "";
|
|
24743
|
-
if (payload.download)
|
|
24807
|
+
if (payload.download) {
|
|
24808
|
+
const file = await uri2local(this.ctx, fileCache[0].fileUuid, true);
|
|
24809
|
+
if (file.errMsg) throw new Error(file.errMsg);
|
|
24810
|
+
downloadPath = file.path;
|
|
24811
|
+
}
|
|
24744
24812
|
const res = {
|
|
24745
24813
|
file: downloadPath,
|
|
24746
24814
|
url: "",
|
|
24747
24815
|
file_size: fileCache[0].fileSize,
|
|
24748
24816
|
file_name: fileCache[0].fileName
|
|
24749
24817
|
};
|
|
24750
|
-
const
|
|
24751
|
-
chatType: fileCache[0].chatType,
|
|
24752
|
-
peerUid: fileCache[0].peerUid,
|
|
24753
|
-
guildId: ""
|
|
24754
|
-
};
|
|
24818
|
+
const isGroup = fileCache[0].chatType === ChatType.Group;
|
|
24755
24819
|
if (fileCache[0].elementType === ElementType.Pic) {
|
|
24756
|
-
const
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
res.url = await this.ctx.ntFileApi.getImageUrl(findEle.picElement);
|
|
24761
|
-
} else if (fileCache[0].elementType === ElementType.Video) res.url = await this.ctx.ntFileApi.getVideoUrl(peer, fileCache[0].msgId, fileCache[0].elementId);
|
|
24762
|
-
else if (fileCache[0].elementType === ElementType.Ptt) res.url = await this.ctx.ntFileApi.getPttUrl(fileCache[0].fileUuid, peer.chatType === 2);
|
|
24820
|
+
const originImageUrl = `/download?appid=${isGroup ? 1407 : 1406}&fileid=${fileCache[0].fileUuid}&spec=0`;
|
|
24821
|
+
res.url = await this.ctx.ntFileApi.getImageUrl(originImageUrl, fileCache[0].md5HexStr);
|
|
24822
|
+
} else if (fileCache[0].elementType === ElementType.Video) res.url = await this.ctx.ntFileApi.getVideoUrl(fileCache[0].fileUuid, isGroup);
|
|
24823
|
+
else if (fileCache[0].elementType === ElementType.Ptt) res.url = await this.ctx.ntFileApi.getPttUrl(fileCache[0].fileUuid, isGroup);
|
|
24763
24824
|
if (enableLocalFile2Url && downloadPath && (res.file === res.url || res.url === void 0)) try {
|
|
24764
24825
|
res.base64 = await readFile(downloadPath, "base64");
|
|
24765
24826
|
} catch (e) {
|
|
@@ -24807,8 +24868,9 @@ var GetRecord = class extends BaseAction {
|
|
|
24807
24868
|
async _handle(payload) {
|
|
24808
24869
|
const fileCache = await this.ctx.store.getFileCacheByName(payload.file);
|
|
24809
24870
|
if (fileCache?.length) {
|
|
24810
|
-
const
|
|
24811
|
-
|
|
24871
|
+
const originFile = await uri2local(this.ctx, fileCache[0].fileUuid, true);
|
|
24872
|
+
if (originFile.errMsg) throw new Error(originFile.errMsg);
|
|
24873
|
+
const file = await decodeSilk(this.ctx, originFile.path, payload.out_format);
|
|
24812
24874
|
const res = {
|
|
24813
24875
|
file,
|
|
24814
24876
|
file_name: path.basename(file),
|
|
@@ -24960,7 +25022,7 @@ var GetGroupMsgHistory = class extends BaseAction {
|
|
|
24960
25022
|
const msg = this.ctx.store.getMsgCache(rawMsg.msgId);
|
|
24961
25023
|
if (msg) rawMsg = msg;
|
|
24962
25024
|
}
|
|
24963
|
-
return OB11Entities.message(this.ctx, rawMsg,
|
|
25025
|
+
return OB11Entities.message(this.ctx, rawMsg, config);
|
|
24964
25026
|
}))),
|
|
24965
25027
|
seq: +msgList[0].msgSeq
|
|
24966
25028
|
};
|
|
@@ -25020,7 +25082,7 @@ async function decodeMultiMessage(ctx, items, messageFormat) {
|
|
|
25020
25082
|
} else if (serviceType === 48 && (businessType === 11 || businessType === 21)) {
|
|
25021
25083
|
const { msgInfoBody } = Media.MsgInfo.decode(pbElem);
|
|
25022
25084
|
const { index } = msgInfoBody[0];
|
|
25023
|
-
const url = await ctx.ntFileApi.
|
|
25085
|
+
const url = await ctx.ntFileApi.getVideoUrl(index.fileUuid, businessType === 21);
|
|
25024
25086
|
segment = {
|
|
25025
25087
|
type: OB11MessageDataType.Video,
|
|
25026
25088
|
data: {
|
|
@@ -25087,7 +25149,7 @@ var GetForwardMsg = class extends BaseAction {
|
|
|
25087
25149
|
throw new Error(data.errMsg);
|
|
25088
25150
|
}
|
|
25089
25151
|
return { messages: filterNullable(await Promise.all(data.msgList.map(async (msg) => {
|
|
25090
|
-
const res = await OB11Entities.message(this.ctx, msg,
|
|
25152
|
+
const res = await OB11Entities.message(this.ctx, msg, config);
|
|
25091
25153
|
if (res) {
|
|
25092
25154
|
const segments = message2List(res.message);
|
|
25093
25155
|
for (const item of segments) if (item.type === OB11MessageDataType.Forward) this.ctx.store.addMultiMsgInfo(rootMsgId, item.data.id, peer);
|
|
@@ -25537,7 +25599,7 @@ var GetFriendMsgHistory = class extends BaseAction {
|
|
|
25537
25599
|
const msg = this.ctx.store.getMsgCache(rawMsg.msgId);
|
|
25538
25600
|
if (msg) rawMsg = msg;
|
|
25539
25601
|
}
|
|
25540
|
-
return OB11Entities.message(this.ctx, rawMsg,
|
|
25602
|
+
return OB11Entities.message(this.ctx, rawMsg, config);
|
|
25541
25603
|
}))),
|
|
25542
25604
|
seq: +msgList[0].msgSeq
|
|
25543
25605
|
};
|
|
@@ -25546,7 +25608,7 @@ var GetFriendMsgHistory = class extends BaseAction {
|
|
|
25546
25608
|
const uid = await this.ctx.ntUserApi.getUidByUin(payload.user_id.toString());
|
|
25547
25609
|
if (!uid) throw new Error(`无法获取用户信息`);
|
|
25548
25610
|
const peer = {
|
|
25549
|
-
chatType: await this.ctx.ntFriendApi.
|
|
25611
|
+
chatType: await this.ctx.ntFriendApi.isFriend(uid) ? ChatType.C2C : ChatType.TempC2CFromGroup,
|
|
25550
25612
|
peerUid: uid,
|
|
25551
25613
|
guildId: ""
|
|
25552
25614
|
};
|
|
@@ -25609,32 +25671,16 @@ var GetGroupFilesByFolder = class extends BaseAction {
|
|
|
25609
25671
|
var GetFriendWithCategory = class extends BaseAction {
|
|
25610
25672
|
actionName = ActionName.GetFriendsWithCategory;
|
|
25611
25673
|
async _handle() {
|
|
25612
|
-
const
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
|
|
25618
|
-
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
...item,
|
|
25623
|
-
buddyList
|
|
25624
|
-
});
|
|
25625
|
-
}
|
|
25626
|
-
return category.map((item) => {
|
|
25627
|
-
return {
|
|
25628
|
-
categoryId: item.categoryId,
|
|
25629
|
-
categorySortId: item.categorySortId,
|
|
25630
|
-
categoryName: item.categroyName,
|
|
25631
|
-
categoryMbCount: item.categroyMbCount,
|
|
25632
|
-
onlineCount: item.onlineCount,
|
|
25633
|
-
buddyList: item.buddyList.map((buddy) => {
|
|
25634
|
-
return OB11Entities.friend(buddy);
|
|
25635
|
-
})
|
|
25636
|
-
};
|
|
25637
|
-
});
|
|
25674
|
+
const result = await this.ctx.ntFriendApi.getFriendList(true);
|
|
25675
|
+
return result.categories.values().map((item) => ({
|
|
25676
|
+
categoryId: item.categoryId,
|
|
25677
|
+
categorySortId: item.categorySortId,
|
|
25678
|
+
categoryName: item.categoryName,
|
|
25679
|
+
categoryMbCount: item.categoryMemberCount,
|
|
25680
|
+
buddyList: result.friends.filter((friend) => friend.categoryId === item.categoryId).map((friend) => {
|
|
25681
|
+
return OB11Entities.friend(friend);
|
|
25682
|
+
})
|
|
25683
|
+
})).toArray();
|
|
25638
25684
|
}
|
|
25639
25685
|
};
|
|
25640
25686
|
//#endregion
|
|
@@ -25792,29 +25838,24 @@ var OCRImage = class extends BaseAction {
|
|
|
25792
25838
|
actionName = ActionName.GoCQHTTP_OCRImage;
|
|
25793
25839
|
payloadSchema = lib_default$1.object({ image: lib_default$1.string().required() });
|
|
25794
25840
|
async _handle(payload) {
|
|
25795
|
-
|
|
25796
|
-
if (
|
|
25797
|
-
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25841
|
+
let url;
|
|
25842
|
+
if (isHttpUrl(payload.image)) url = payload.image;
|
|
25843
|
+
else {
|
|
25844
|
+
const { errMsg, isLocal, path, success } = await uri2local(this.ctx, payload.image);
|
|
25845
|
+
if (!success) throw new Error(errMsg);
|
|
25846
|
+
const { msgInfo } = await this.ctx.ntFileApi.uploadC2CImage(selfInfo.uid, path);
|
|
25847
|
+
if (!isLocal) unlink(path).catch(noop);
|
|
25848
|
+
const { pic, index } = msgInfo.msgInfoBody[0];
|
|
25849
|
+
url = await this.ctx.ntFileApi.getImageUrl(pic.urlPath + pic.ext.originalParam, index.info.md5HexStr);
|
|
25850
|
+
}
|
|
25851
|
+
const { textDetections, language } = await this.ctx.ntFileApi.ocrImage(url);
|
|
25801
25852
|
return {
|
|
25802
|
-
texts:
|
|
25803
|
-
|
|
25804
|
-
|
|
25805
|
-
|
|
25806
|
-
|
|
25807
|
-
|
|
25808
|
-
for (let i = 0; i < 4; i++) {
|
|
25809
|
-
const pt = item[`pt${i + 1}`];
|
|
25810
|
-
ret.coordinates.push({
|
|
25811
|
-
x: +pt.x,
|
|
25812
|
-
y: +pt.y
|
|
25813
|
-
});
|
|
25814
|
-
}
|
|
25815
|
-
return ret;
|
|
25816
|
-
}),
|
|
25817
|
-
language: ""
|
|
25853
|
+
texts: textDetections.map((item) => ({
|
|
25854
|
+
text: item.detectedText,
|
|
25855
|
+
confidence: item.confidence,
|
|
25856
|
+
coordinates: item.polygon.coordinates
|
|
25857
|
+
})),
|
|
25858
|
+
language
|
|
25818
25859
|
};
|
|
25819
25860
|
}
|
|
25820
25861
|
};
|
|
@@ -26483,8 +26524,7 @@ var SetDoubtFriendsAddRequest = class extends BaseAction {
|
|
|
26483
26524
|
actionName = ActionName.SetDoubtFriendsAddRequest;
|
|
26484
26525
|
payloadSchema = lib_default$1.object({ flag: lib_default$1.string().required() });
|
|
26485
26526
|
async _handle(payload) {
|
|
26486
|
-
|
|
26487
|
-
if (res.result !== 0) throw new Error(res.errMsg);
|
|
26527
|
+
await this.ctx.ntFriendApi.approvalDoubtFriendRequest(payload.flag);
|
|
26488
26528
|
return null;
|
|
26489
26529
|
}
|
|
26490
26530
|
};
|
|
@@ -26928,7 +26968,6 @@ var Onebot11Adapter = class extends Service {
|
|
|
26928
26968
|
static inject = [
|
|
26929
26969
|
"ntMsgApi",
|
|
26930
26970
|
"ntFileApi",
|
|
26931
|
-
"ntFileCacheApi",
|
|
26932
26971
|
"ntFriendApi",
|
|
26933
26972
|
"ntGroupApi",
|
|
26934
26973
|
"ntUserApi",
|
|
@@ -27063,7 +27102,7 @@ var Onebot11Adapter = class extends Service {
|
|
|
27063
27102
|
}
|
|
27064
27103
|
async handleFriendRequest(req) {
|
|
27065
27104
|
const uin = await this.ctx.ntUserApi.getUinByUid(req.friendUid);
|
|
27066
|
-
const flag = req.friendUid
|
|
27105
|
+
const flag = req.friendUid;
|
|
27067
27106
|
const friendRequestEvent = new OB11FriendRequestEvent(+uin, req.extWords, flag, req.addSource ?? "");
|
|
27068
27107
|
this.dispatch(friendRequestEvent);
|
|
27069
27108
|
}
|
|
@@ -28013,10 +28052,10 @@ var robotUinRanges = [
|
|
|
28013
28052
|
];
|
|
28014
28053
|
function decodeUser(user) {
|
|
28015
28054
|
return {
|
|
28016
|
-
id: user.uin,
|
|
28055
|
+
id: user.uin.toString(),
|
|
28017
28056
|
name: user.nick,
|
|
28018
28057
|
avatar: `http://q.qlogo.cn/headimg_dl?dst_uin=${user.uin}&spec=640`,
|
|
28019
|
-
is_bot: robotUinRanges.some((e) => user.uin >= e.minUin && user.uin <= e.maxUin)
|
|
28058
|
+
is_bot: robotUinRanges.some((e) => +user.uin >= +e.minUin && +user.uin <= +e.maxUin)
|
|
28020
28059
|
};
|
|
28021
28060
|
}
|
|
28022
28061
|
function decodeGuildChannelId(data) {
|
|
@@ -28059,7 +28098,7 @@ async function decodeElement(ctx, data, quoted = false) {
|
|
|
28059
28098
|
ctx.logger.error("获取不到引用的消息", e, v.replyElement, e.stack);
|
|
28060
28099
|
}
|
|
28061
28100
|
} else if (v.picElement) {
|
|
28062
|
-
const src = await ctx.ntFileApi.getImageUrl(v.picElement);
|
|
28101
|
+
const src = await ctx.ntFileApi.getImageUrl(v.picElement.originImageUrl, v.picElement.md5HexStr);
|
|
28063
28102
|
buffer.push(lib_default.img(src, {
|
|
28064
28103
|
width: v.picElement.picWidth,
|
|
28065
28104
|
height: v.picElement.picHeight,
|
|
@@ -28069,11 +28108,7 @@ async function decodeElement(ctx, data, quoted = false) {
|
|
|
28069
28108
|
const src = await ctx.ntFileApi.getPttUrl(v.pttElement.fileUuid, data.chatType === ChatType.Group);
|
|
28070
28109
|
buffer.push(lib_default.audio(src, { duration: v.pttElement.duration }));
|
|
28071
28110
|
} else if (v.videoElement) {
|
|
28072
|
-
const src = await ctx.ntFileApi.getVideoUrl(
|
|
28073
|
-
chatType: data.chatType,
|
|
28074
|
-
peerUid: data.peerUid,
|
|
28075
|
-
guildId: ""
|
|
28076
|
-
}, data.msgId, v.elementId) || pathToFileURL(v.videoElement.filePath).href;
|
|
28111
|
+
const src = await ctx.ntFileApi.getVideoUrl(v.videoElement.fileUuid, data.chatType === ChatType.Group);
|
|
28077
28112
|
buffer.push(lib_default.video(src));
|
|
28078
28113
|
} else if (v.marketFaceElement) {
|
|
28079
28114
|
const { emojiId, supportSize } = v.marketFaceElement;
|
|
@@ -28166,7 +28201,7 @@ async function getPeer(ctx, channelId) {
|
|
|
28166
28201
|
const uin = channelId.replace("private:", "");
|
|
28167
28202
|
const uid = await ctx.ntUserApi.getUidByUin(uin);
|
|
28168
28203
|
if (!uid) throw new Error("无法获取用户信息");
|
|
28169
|
-
if (!await ctx.ntFriendApi.
|
|
28204
|
+
if (!await ctx.ntFriendApi.isFriend(uid)) {
|
|
28170
28205
|
if ((await ctx.ntMsgApi.getTempChatInfo(ChatType.TempC2CFromGroup, uid)).tmpChatInfo.groupCode) return {
|
|
28171
28206
|
chatType: ChatType.TempC2CFromGroup,
|
|
28172
28207
|
peerUid: uid,
|
|
@@ -28672,53 +28707,13 @@ async function ntToProto(ctx, input, peer) {
|
|
|
28672
28707
|
else if (input.elementType === ElementType.Pic) {
|
|
28673
28708
|
const isGroup = peer.chatType === ChatType.Group;
|
|
28674
28709
|
const path = input.picElement.sourcePath;
|
|
28675
|
-
|
|
28710
|
+
let data;
|
|
28711
|
+
if (isGroup) data = await ctx.ntFileApi.uploadGroupImage(peer.peerUid, path);
|
|
28712
|
+
else data = await ctx.ntFileApi.uploadC2CImage(peer.peerUid, path);
|
|
28676
28713
|
return {
|
|
28677
28714
|
element: { commonElem: {
|
|
28678
28715
|
serviceType: 48,
|
|
28679
|
-
pbElem: Media.MsgInfo.encode(
|
|
28680
|
-
msgInfoBody: [{
|
|
28681
|
-
index: {
|
|
28682
|
-
info: {
|
|
28683
|
-
fileSize: +data.commonFileInfo.fileSize,
|
|
28684
|
-
md5HexStr: data.commonFileInfo.md5,
|
|
28685
|
-
sha1HexStr: data.commonFileInfo.sha,
|
|
28686
|
-
fileName: data.commonFileInfo.fileName,
|
|
28687
|
-
fileType: {
|
|
28688
|
-
type: 1,
|
|
28689
|
-
picFormat: input.picElement.picType
|
|
28690
|
-
},
|
|
28691
|
-
width: input.picElement.picWidth,
|
|
28692
|
-
height: input.picElement.picHeight,
|
|
28693
|
-
time: 0,
|
|
28694
|
-
original: 1
|
|
28695
|
-
},
|
|
28696
|
-
fileUuid: data.fileId,
|
|
28697
|
-
storeID: 1,
|
|
28698
|
-
expire: isGroup ? 2678400 : 15768e4
|
|
28699
|
-
},
|
|
28700
|
-
pic: {
|
|
28701
|
-
urlPath: `/download?appid=${isGroup ? 1407 : 1406}&fileid=${data.fileId}`,
|
|
28702
|
-
ext: {
|
|
28703
|
-
originalParam: "&spec=0",
|
|
28704
|
-
bigParam: "&spec=720",
|
|
28705
|
-
thumbParam: "&spec=198"
|
|
28706
|
-
},
|
|
28707
|
-
domain: "multimedia.nt.qq.com.cn"
|
|
28708
|
-
},
|
|
28709
|
-
fileExist: true
|
|
28710
|
-
}],
|
|
28711
|
-
extBizInfo: {
|
|
28712
|
-
pic: {
|
|
28713
|
-
bizType: 0,
|
|
28714
|
-
summary: "",
|
|
28715
|
-
fromScene: isGroup ? 2 : 1,
|
|
28716
|
-
toScene: isGroup ? 2 : 1,
|
|
28717
|
-
oldFileId: isGroup ? 574859779 : void 0
|
|
28718
|
-
},
|
|
28719
|
-
busiType: input.picElement.picSubType
|
|
28720
|
-
}
|
|
28721
|
-
}),
|
|
28716
|
+
pbElem: Media.MsgInfo.encode(data.msgInfo),
|
|
28722
28717
|
businessType: isGroup ? 20 : 10
|
|
28723
28718
|
} },
|
|
28724
28719
|
preview: input.picElement.picSubType === 1 ? "[动画表情]" : "[图片]"
|
|
@@ -28898,20 +28893,15 @@ var getUser = async (ctx, payload) => {
|
|
|
28898
28893
|
//#endregion
|
|
28899
28894
|
//#region src/satori/api/friend/list.ts
|
|
28900
28895
|
var getFriendList = async (ctx) => {
|
|
28901
|
-
return { data: (await ctx.ntFriendApi.
|
|
28902
|
-
user: decodeUser(e
|
|
28903
|
-
nick: e.
|
|
28896
|
+
return { data: (await ctx.ntFriendApi.getFriendList(true)).friends.map((e) => ({
|
|
28897
|
+
user: decodeUser(e),
|
|
28898
|
+
nick: e.remark
|
|
28904
28899
|
})) };
|
|
28905
28900
|
};
|
|
28906
28901
|
//#endregion
|
|
28907
28902
|
//#region src/satori/api/friend/approve.ts
|
|
28908
28903
|
var handleFriendRequest = async (ctx, payload) => {
|
|
28909
|
-
|
|
28910
|
-
if (data.length < 2) throw new Error("无效的 message_id");
|
|
28911
|
-
const uid = data[0];
|
|
28912
|
-
const reqTime = data[1];
|
|
28913
|
-
const res = await ctx.ntFriendApi.handleFriendRequest(uid, reqTime, payload.approve);
|
|
28914
|
-
if (res.result !== 0) throw new Error(res.errMsg);
|
|
28904
|
+
await ctx.ntFriendApi.approvalFriendRequest(payload.message_id, payload.approve);
|
|
28915
28905
|
return {};
|
|
28916
28906
|
};
|
|
28917
28907
|
//#endregion
|
|
@@ -29209,7 +29199,7 @@ async function parseGuildMemberRequest(bot, input, doubt) {
|
|
|
29209
29199
|
//#endregion
|
|
29210
29200
|
//#region src/satori/event/user.ts
|
|
29211
29201
|
async function parseFriendRequest(bot, input) {
|
|
29212
|
-
const flag = input.friendUid
|
|
29202
|
+
const flag = input.friendUid;
|
|
29213
29203
|
const user = await bot.ctx.ntUserApi.getUserSimpleInfo(input.friendUid);
|
|
29214
29204
|
return bot.event("friend-request", {
|
|
29215
29205
|
user: decodeUser(user.coreInfo),
|
|
@@ -29279,7 +29269,6 @@ var SatoriAdapter = class extends Service {
|
|
|
29279
29269
|
static inject = [
|
|
29280
29270
|
"ntMsgApi",
|
|
29281
29271
|
"ntFileApi",
|
|
29282
|
-
"ntFileCacheApi",
|
|
29283
29272
|
"ntFriendApi",
|
|
29284
29273
|
"ntGroupApi",
|
|
29285
29274
|
"ntUserApi",
|
|
@@ -40911,7 +40900,7 @@ function _null(params) {
|
|
|
40911
40900
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
40912
40901
|
$ZodAny.init(inst, def);
|
|
40913
40902
|
ZodType.init(inst, def);
|
|
40914
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
40903
|
+
inst._zod.processJSONSchema = (ctx, json, params) => void 0;
|
|
40915
40904
|
});
|
|
40916
40905
|
function any() {
|
|
40917
40906
|
return /* @__PURE__ */ _any(ZodAny);
|
|
@@ -40919,7 +40908,7 @@ function any() {
|
|
|
40919
40908
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
40920
40909
|
$ZodUnknown.init(inst, def);
|
|
40921
40910
|
ZodType.init(inst, def);
|
|
40922
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
40911
|
+
inst._zod.processJSONSchema = (ctx, json, params) => void 0;
|
|
40923
40912
|
});
|
|
40924
40913
|
function unknown() {
|
|
40925
40914
|
return /* @__PURE__ */ _unknown(ZodUnknown);
|
|
@@ -42413,14 +42402,14 @@ function transformGender(gender) {
|
|
|
42413
42402
|
}
|
|
42414
42403
|
function transformFriend(friend, category) {
|
|
42415
42404
|
return {
|
|
42416
|
-
user_id:
|
|
42417
|
-
nickname: friend.
|
|
42418
|
-
sex: transformGender(friend.
|
|
42419
|
-
qid: friend.
|
|
42420
|
-
remark: friend.
|
|
42405
|
+
user_id: friend.uin,
|
|
42406
|
+
nickname: friend.nick,
|
|
42407
|
+
sex: transformGender(friend.sex),
|
|
42408
|
+
qid: friend.qid,
|
|
42409
|
+
remark: friend.remark,
|
|
42421
42410
|
category: {
|
|
42422
42411
|
category_id: category.categoryId,
|
|
42423
|
-
category_name: category.
|
|
42412
|
+
category_name: category.categoryName
|
|
42424
42413
|
}
|
|
42425
42414
|
};
|
|
42426
42415
|
}
|
|
@@ -43527,22 +43516,16 @@ var SystemApi = [
|
|
|
43527
43516
|
school: info.school
|
|
43528
43517
|
});
|
|
43529
43518
|
}),
|
|
43530
|
-
defineApi("get_friend_list", GetFriendListInput, GetFriendListOutput, async (ctx) => {
|
|
43531
|
-
const
|
|
43532
|
-
const category = /* @__PURE__ */ new Map();
|
|
43519
|
+
defineApi("get_friend_list", GetFriendListInput, GetFriendListOutput, async (ctx, payload) => {
|
|
43520
|
+
const result = await ctx.ntFriendApi.getFriendList(payload.no_cache);
|
|
43533
43521
|
const friendList = [];
|
|
43534
|
-
for (const friend of friends)
|
|
43535
|
-
const { categoryId } = friend.baseInfo;
|
|
43536
|
-
if (!category.has(categoryId)) category.set(categoryId, await ctx.ntFriendApi.getCategoryById(categoryId));
|
|
43537
|
-
friendList.push(transformFriend(friend, category.get(categoryId)));
|
|
43538
|
-
}
|
|
43522
|
+
for (const friend of result.friends) friendList.push(transformFriend(friend, result.categories.get(friend.categoryId)));
|
|
43539
43523
|
return Ok({ friends: friendList });
|
|
43540
43524
|
}),
|
|
43541
43525
|
defineApi("get_friend_info", GetFriendInfoInput, GetFriendInfoOutput, async (ctx, payload) => {
|
|
43542
|
-
const
|
|
43543
|
-
if (!
|
|
43544
|
-
|
|
43545
|
-
return Ok({ friend: transformFriend(friend, await ctx.ntFriendApi.getCategoryById(friend.baseInfo.categoryId)) });
|
|
43526
|
+
const result = await ctx.ntFriendApi.getFriendInfoByUin(payload.user_id, payload.no_cache);
|
|
43527
|
+
if (!result) return Failed(-404, "Friend not found");
|
|
43528
|
+
return Ok({ friend: transformFriend(result.friend, result.category) });
|
|
43546
43529
|
}),
|
|
43547
43530
|
defineApi("get_group_list", GetGroupListInput, GetGroupListOutput, async (ctx) => {
|
|
43548
43531
|
const { groups } = await ctx.pmhq.fetchGroups();
|
|
@@ -43598,28 +43581,15 @@ var SystemApi = [
|
|
|
43598
43581
|
return Ok({ member: transformGroupMember(await ctx.ntGroupApi.getGroupMember(groupCode, memberUid, payload.no_cache), payload.group_id) });
|
|
43599
43582
|
}),
|
|
43600
43583
|
defineApi("get_peer_pins", zod_default.object({}), GetPeerPinsOutput, async (ctx) => {
|
|
43601
|
-
const
|
|
43602
|
-
const category = /* @__PURE__ */ new Map();
|
|
43603
|
-
const { groups } = await ctx.pmhq.fetchGroups();
|
|
43584
|
+
const result = await ctx.ntSystemApi.getPins();
|
|
43604
43585
|
return Ok({
|
|
43605
|
-
friends: await Promise.all(friends.
|
|
43606
|
-
const
|
|
43607
|
-
|
|
43608
|
-
return transformFriend(e, category.get(categoryId));
|
|
43586
|
+
friends: await Promise.all(result.friends.map(async (e) => {
|
|
43587
|
+
const info = await ctx.ntFriendApi.getFriendInfoByUid(e.uid, false);
|
|
43588
|
+
return transformFriend(info.friend, info.category);
|
|
43609
43589
|
})),
|
|
43610
|
-
groups:
|
|
43611
|
-
return
|
|
43612
|
-
|
|
43613
|
-
group_name: e.info.groupName,
|
|
43614
|
-
member_count: e.info.memberCount,
|
|
43615
|
-
max_member_count: e.info.memberMax,
|
|
43616
|
-
remark: e.customInfo.remark ?? "",
|
|
43617
|
-
created_time: e.info.createdTime,
|
|
43618
|
-
description: e.info.richDescription ?? "",
|
|
43619
|
-
question: e.info.question ?? "",
|
|
43620
|
-
announcement: e.info.announcement ?? ""
|
|
43621
|
-
};
|
|
43622
|
-
})
|
|
43590
|
+
groups: await Promise.all(result.groups.map(async (e) => {
|
|
43591
|
+
return transformGroup(await ctx.ntGroupApi.getGroupDetailInfo(e.groupCode.toString()));
|
|
43592
|
+
}))
|
|
43623
43593
|
});
|
|
43624
43594
|
}),
|
|
43625
43595
|
defineApi("set_peer_pin", SetPeerPinInput, zod_default.object({}), async (ctx, payload) => {
|
|
@@ -43873,53 +43843,10 @@ var ForwardMessageEncoder = class ForwardMessageEncoder {
|
|
|
43873
43843
|
this.children = [];
|
|
43874
43844
|
this.preview = "";
|
|
43875
43845
|
}
|
|
43876
|
-
async packImage(
|
|
43877
|
-
const imageSize = await this.ctx.ntFileApi.getImageSize(data.filePath);
|
|
43846
|
+
async packImage(msgInfo) {
|
|
43878
43847
|
return { commonElem: {
|
|
43879
43848
|
serviceType: 48,
|
|
43880
|
-
pbElem: Media.MsgInfo.encode(
|
|
43881
|
-
msgInfoBody: [{
|
|
43882
|
-
index: {
|
|
43883
|
-
info: {
|
|
43884
|
-
fileSize: +data.commonFileInfo.fileSize,
|
|
43885
|
-
md5HexStr: data.commonFileInfo.md5,
|
|
43886
|
-
sha1HexStr: data.commonFileInfo.sha,
|
|
43887
|
-
fileName: data.commonFileInfo.fileName,
|
|
43888
|
-
fileType: {
|
|
43889
|
-
type: 1,
|
|
43890
|
-
picFormat: imageSize.type === "gif" ? 2e3 : 1e3
|
|
43891
|
-
},
|
|
43892
|
-
width: imageSize.width,
|
|
43893
|
-
height: imageSize.height,
|
|
43894
|
-
time: 0,
|
|
43895
|
-
original: 1
|
|
43896
|
-
},
|
|
43897
|
-
fileUuid: data.fileId,
|
|
43898
|
-
storeID: 1,
|
|
43899
|
-
expire: this.isGroup ? 2678400 : 15768e4
|
|
43900
|
-
},
|
|
43901
|
-
pic: {
|
|
43902
|
-
urlPath: `/download?appid=${this.isGroup ? 1407 : 1406}&fileid=${data.fileId}`,
|
|
43903
|
-
ext: {
|
|
43904
|
-
originalParam: "&spec=0",
|
|
43905
|
-
bigParam: "&spec=720",
|
|
43906
|
-
thumbParam: "&spec=198"
|
|
43907
|
-
},
|
|
43908
|
-
domain: "multimedia.nt.qq.com.cn"
|
|
43909
|
-
},
|
|
43910
|
-
fileExist: true
|
|
43911
|
-
}],
|
|
43912
|
-
extBizInfo: {
|
|
43913
|
-
pic: {
|
|
43914
|
-
bizType: 0,
|
|
43915
|
-
summary: "",
|
|
43916
|
-
fromScene: this.isGroup ? 2 : 1,
|
|
43917
|
-
toScene: this.isGroup ? 2 : 1,
|
|
43918
|
-
oldFileId: this.isGroup ? 574859779 : void 0
|
|
43919
|
-
},
|
|
43920
|
-
busiType
|
|
43921
|
-
}
|
|
43922
|
-
}),
|
|
43849
|
+
pbElem: Media.MsgInfo.encode(msgInfo),
|
|
43923
43850
|
businessType: this.isGroup ? 20 : 10
|
|
43924
43851
|
} };
|
|
43925
43852
|
}
|
|
@@ -43976,9 +43903,11 @@ var ForwardMessageEncoder = class ForwardMessageEncoder {
|
|
|
43976
43903
|
const imageBuffer = await resolveMilkyUri(segment.data.uri);
|
|
43977
43904
|
const tempPath = path.join(TEMP_DIR, `image-${randomUUID()}`);
|
|
43978
43905
|
await writeFile(tempPath, imageBuffer);
|
|
43979
|
-
|
|
43906
|
+
let data;
|
|
43907
|
+
if (this.isGroup) data = await this.ctx.ntFileApi.uploadGroupImage(this.peerUid, tempPath);
|
|
43908
|
+
else data = await this.ctx.ntFileApi.uploadC2CImage(this.peerUid, tempPath);
|
|
43980
43909
|
const busiType = segment.data.sub_type === "sticker" ? 1 : 0;
|
|
43981
|
-
this.children.push(await this.packImage(data
|
|
43910
|
+
this.children.push(await this.packImage(data.msgInfo));
|
|
43982
43911
|
this.preview += busiType === 1 ? "[动画表情]" : "[图片]";
|
|
43983
43912
|
unlink(tempPath).catch(noop);
|
|
43984
43913
|
} else if (type === "forward") {
|
|
@@ -47591,7 +47520,7 @@ function readStopNodeData(xmlData, tagName, i) {
|
|
|
47591
47520
|
else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) i = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
|
|
47592
47521
|
else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 91) i = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
47593
47522
|
else {
|
|
47594
|
-
const tagData = readTagExp(xmlData, i,
|
|
47523
|
+
const tagData = readTagExp(xmlData, i, false);
|
|
47595
47524
|
if (tagData) {
|
|
47596
47525
|
if ((tagData && tagData.tagName) === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") openTagCount++;
|
|
47597
47526
|
i = tagData.closeIndex;
|
|
@@ -47676,6 +47605,7 @@ function compress(arr, options, matcher, readonlyMatcher) {
|
|
|
47676
47605
|
else if (tagObj[property]) {
|
|
47677
47606
|
let val = compress(tagObj[property], options, matcher, readonlyMatcher);
|
|
47678
47607
|
const isLeaf = isLeafTag(val, options);
|
|
47608
|
+
if (Object.keys(val).length === 0 && options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
47679
47609
|
if (tagObj[":@"]) assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
|
|
47680
47610
|
else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) val = val[options.textNodeName];
|
|
47681
47611
|
else if (Object.keys(val).length === 0) if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
@@ -47784,7 +47714,25 @@ async function transformIncomingPrivateMessage(ctx, friend, category, message) {
|
|
|
47784
47714
|
sender_id: +message.senderUin,
|
|
47785
47715
|
time: +message.msgTime,
|
|
47786
47716
|
segments: await transformIncomingSegments(ctx, message),
|
|
47787
|
-
friend: transformFriend(
|
|
47717
|
+
friend: transformFriend({
|
|
47718
|
+
uid: friend.uid,
|
|
47719
|
+
uin: +friend.uin,
|
|
47720
|
+
categoryId: friend.baseInfo.categoryId,
|
|
47721
|
+
nick: friend.coreInfo.nick,
|
|
47722
|
+
longNick: friend.baseInfo.longNick,
|
|
47723
|
+
remark: friend.coreInfo.remark,
|
|
47724
|
+
qid: friend.baseInfo.qid,
|
|
47725
|
+
age: friend.baseInfo.age,
|
|
47726
|
+
sex: friend.baseInfo.sex,
|
|
47727
|
+
birthdayYear: friend.baseInfo.birthday_year,
|
|
47728
|
+
birthdayMonth: friend.baseInfo.birthday_month,
|
|
47729
|
+
birthdayDay: friend.baseInfo.birthday_day
|
|
47730
|
+
}, {
|
|
47731
|
+
categoryId: category.categoryId,
|
|
47732
|
+
categoryName: category.categroyName,
|
|
47733
|
+
categoryMemberCount: category.categroyMbCount,
|
|
47734
|
+
categorySortId: category.categorySortId
|
|
47735
|
+
})
|
|
47788
47736
|
};
|
|
47789
47737
|
}
|
|
47790
47738
|
async function transformIncomingGroupMessage(ctx, group, member, message) {
|
|
@@ -47855,7 +47803,7 @@ async function transformIncomingSegments(ctx, message) {
|
|
|
47855
47803
|
type: "image",
|
|
47856
47804
|
data: {
|
|
47857
47805
|
resource_id: element.picElement.fileUuid,
|
|
47858
|
-
temp_url: await ctx.ntFileApi.getImageUrl(element.picElement),
|
|
47806
|
+
temp_url: await ctx.ntFileApi.getImageUrl(element.picElement.originImageUrl, element.picElement.md5HexStr),
|
|
47859
47807
|
width: element.picElement.picWidth,
|
|
47860
47808
|
height: element.picElement.picHeight,
|
|
47861
47809
|
summary: element.picElement.summary || "[图片]",
|
|
@@ -47878,7 +47826,7 @@ async function transformIncomingSegments(ctx, message) {
|
|
|
47878
47826
|
type: "video",
|
|
47879
47827
|
data: {
|
|
47880
47828
|
resource_id: element.videoElement.fileUuid,
|
|
47881
|
-
temp_url: await ctx.ntFileApi.
|
|
47829
|
+
temp_url: await ctx.ntFileApi.getVideoUrl(element.videoElement.fileUuid, message.chatType === ChatType.Group),
|
|
47882
47830
|
width: element.videoElement.thumbWidth,
|
|
47883
47831
|
height: element.videoElement.thumbHeight,
|
|
47884
47832
|
duration: element.videoElement.fileTime
|
|
@@ -47922,20 +47870,22 @@ async function transformIncomingSegments(ctx, message) {
|
|
|
47922
47870
|
break;
|
|
47923
47871
|
case ElementType.Ark: {
|
|
47924
47872
|
const { arkElement } = element;
|
|
47925
|
-
const
|
|
47926
|
-
if (
|
|
47927
|
-
|
|
47928
|
-
|
|
47929
|
-
|
|
47930
|
-
|
|
47931
|
-
|
|
47932
|
-
|
|
47933
|
-
|
|
47934
|
-
|
|
47935
|
-
|
|
47873
|
+
const match = arkElement.bytesData.match(/"app"\s*:\s*"([^"]*)"/);
|
|
47874
|
+
if (match?.[1]) if (match[1] === "com.tencent.multimsg") {
|
|
47875
|
+
const data = JSON.parse(arkElement.bytesData);
|
|
47876
|
+
segments.push({
|
|
47877
|
+
type: "forward",
|
|
47878
|
+
data: {
|
|
47879
|
+
forward_id: data.meta.detail.resid,
|
|
47880
|
+
title: data.meta.detail.source,
|
|
47881
|
+
preview: data.meta.detail.news.map((item) => item.text),
|
|
47882
|
+
summary: data.meta.detail.summary
|
|
47883
|
+
}
|
|
47884
|
+
});
|
|
47885
|
+
} else segments.push({
|
|
47936
47886
|
type: "light_app",
|
|
47937
47887
|
data: {
|
|
47938
|
-
app_name:
|
|
47888
|
+
app_name: match[1],
|
|
47939
47889
|
json_payload: arkElement.bytesData
|
|
47940
47890
|
}
|
|
47941
47891
|
});
|
|
@@ -47983,7 +47933,7 @@ async function transformIncomingForwardedMessage(ctx, message) {
|
|
|
47983
47933
|
} else if (serviceType === 48 && (businessType === 11 || businessType === 21)) {
|
|
47984
47934
|
const { msgInfoBody } = Media.MsgInfo.decode(elem.commonElem.pbElem);
|
|
47985
47935
|
const { index } = msgInfoBody[0];
|
|
47986
|
-
const url = await ctx.ntFileApi.
|
|
47936
|
+
const url = await ctx.ntFileApi.getVideoUrl(index.fileUuid, businessType === 21);
|
|
47987
47937
|
segments.push({
|
|
47988
47938
|
type: "video",
|
|
47989
47939
|
data: {
|
|
@@ -48044,7 +47994,7 @@ var SendPrivateMessage = defineApi("send_private_message", SendPrivateMessageInp
|
|
|
48044
47994
|
peerUid: uid,
|
|
48045
47995
|
guildId: ""
|
|
48046
47996
|
};
|
|
48047
|
-
if (!await ctx.ntFriendApi.
|
|
47997
|
+
if (!await ctx.ntFriendApi.isFriend(uid)) {
|
|
48048
47998
|
if ((await ctx.ntMsgApi.getTempChatInfo(100, uid)).tmpChatInfo.groupCode) peer.chatType = 100;
|
|
48049
47999
|
}
|
|
48050
48000
|
const { elements, deleteAfterSentFiles } = await transformOutgoingMessage(ctx, payload.message, uid, false);
|
|
@@ -48076,7 +48026,7 @@ var RecallPrivateMessage = defineApi("recall_private_message", RecallPrivateMess
|
|
|
48076
48026
|
peerUid: uid,
|
|
48077
48027
|
guildId: ""
|
|
48078
48028
|
};
|
|
48079
|
-
if (!await ctx.ntFriendApi.
|
|
48029
|
+
if (!await ctx.ntFriendApi.isFriend(uid)) {
|
|
48080
48030
|
if ((await ctx.ntMsgApi.getTempChatInfo(100, uid)).tmpChatInfo.groupCode) peer.chatType = 100;
|
|
48081
48031
|
}
|
|
48082
48032
|
const msg = await ctx.ntMsgApi.getMsgsBySeqAndCount(peer, payload.message_seq.toString(), 1, true, true);
|
|
@@ -48191,7 +48141,7 @@ var MessageApi = [
|
|
|
48191
48141
|
const rkeyData = await ctx.ntFileApi.rkeyManager.getRkey(true);
|
|
48192
48142
|
const rkey = appid === 1406 ? rkeyData.private_rkey : rkeyData.group_rkey;
|
|
48193
48143
|
return Ok({ url: `${IMAGE_HTTP_HOST_NT}/download?appid=${appid}&fileid=${payload.resource_id}&spec=0${rkey}` });
|
|
48194
|
-
} else if (appid === 1413 || appid === 1415) return Ok({ url: await ctx.ntFileApi.
|
|
48144
|
+
} else if (appid === 1413 || appid === 1415) return Ok({ url: await ctx.ntFileApi.getVideoUrl(payload.resource_id, appid === 1415) });
|
|
48195
48145
|
else {
|
|
48196
48146
|
ctx.logger.warn(`GetResourceTempUrl: not yet supported appid: ${appid}`);
|
|
48197
48147
|
return Ok({ url: "" });
|
|
@@ -48286,17 +48236,12 @@ var FriendApi = [
|
|
|
48286
48236
|
}
|
|
48287
48237
|
}),
|
|
48288
48238
|
defineApi("accept_friend_request", AcceptFriendRequestInput, zod_default.object({}), async (ctx, payload) => {
|
|
48289
|
-
|
|
48290
|
-
|
|
48291
|
-
else result = await ctx.ntFriendApi.handleFriendRequest(payload.initiator_uid, "0", true);
|
|
48292
|
-
if (result.result !== 0) return Failed(-500, result.errMsg);
|
|
48239
|
+
if (payload.is_filtered) await ctx.ntFriendApi.approvalDoubtFriendRequest(payload.initiator_uid);
|
|
48240
|
+
else await ctx.ntFriendApi.approvalFriendRequest(payload.initiator_uid, true);
|
|
48293
48241
|
return Ok({});
|
|
48294
48242
|
}),
|
|
48295
48243
|
defineApi("reject_friend_request", RejectFriendRequestInput, zod_default.object({}), async (ctx, payload) => {
|
|
48296
|
-
if (!payload.is_filtered)
|
|
48297
|
-
const result = await ctx.ntFriendApi.handleFriendRequest(payload.initiator_uid, "0", false);
|
|
48298
|
-
if (result.result !== 0) return Failed(-500, result.errMsg);
|
|
48299
|
-
}
|
|
48244
|
+
if (!payload.is_filtered) await ctx.ntFriendApi.approvalFriendRequest(payload.initiator_uid, false);
|
|
48300
48245
|
return Ok({});
|
|
48301
48246
|
})
|
|
48302
48247
|
];
|
|
@@ -52257,16 +52202,14 @@ var Store = class extends Service {
|
|
|
52257
52202
|
uniqueMsgId: "string(64)",
|
|
52258
52203
|
peerUid: "string(24)"
|
|
52259
52204
|
}, { primary: "shortId" });
|
|
52260
|
-
this.ctx.model.extend("
|
|
52205
|
+
this.ctx.model.extend("file", {
|
|
52261
52206
|
fileName: "string",
|
|
52262
52207
|
fileSize: "string",
|
|
52263
52208
|
fileUuid: "string(128)",
|
|
52264
|
-
msgId: "string(24)",
|
|
52265
52209
|
msgTime: "unsigned(10)",
|
|
52266
|
-
peerUid: "string(24)",
|
|
52267
52210
|
chatType: "unsigned",
|
|
52268
|
-
|
|
52269
|
-
|
|
52211
|
+
elementType: "unsigned",
|
|
52212
|
+
md5HexStr: "string(32)"
|
|
52270
52213
|
}, {
|
|
52271
52214
|
primary: "fileUuid",
|
|
52272
52215
|
indexes: ["fileName"]
|
|
@@ -52348,15 +52291,15 @@ var Store = class extends Service {
|
|
|
52348
52291
|
return this.cache.getValue(cacheKey);
|
|
52349
52292
|
}
|
|
52350
52293
|
async addFileCache(data) {
|
|
52351
|
-
const existingFile = await this.ctx.database.get("
|
|
52294
|
+
const existingFile = await this.ctx.database.get("file", { fileUuid: data.fileUuid });
|
|
52352
52295
|
if (existingFile.length) return existingFile;
|
|
52353
|
-
this.ctx.database.upsert("
|
|
52296
|
+
this.ctx.database.upsert("file", [data], "fileUuid").then().catch((e) => this.ctx.logger.error("addFileCache database error:", e));
|
|
52354
52297
|
}
|
|
52355
52298
|
getFileCacheByName(fileName) {
|
|
52356
|
-
return this.ctx.database.get("
|
|
52299
|
+
return this.ctx.database.get("file", { fileName }, { sort: { msgTime: "desc" } });
|
|
52357
52300
|
}
|
|
52358
52301
|
getFileCacheById(fileUuid) {
|
|
52359
|
-
return this.ctx.database.get("
|
|
52302
|
+
return this.ctx.database.get("file", { fileUuid });
|
|
52360
52303
|
}
|
|
52361
52304
|
async addMsgCache(msg) {
|
|
52362
52305
|
const expire = this.config.msgCacheExpire;
|
|
@@ -52652,36 +52595,24 @@ var NTQQFileApi = class extends Service {
|
|
|
52652
52595
|
this.ctx = ctx;
|
|
52653
52596
|
this.rkeyManager = new RkeyManager(ctx, "https://llob.linyuchen.net/rkey");
|
|
52654
52597
|
}
|
|
52655
|
-
async
|
|
52656
|
-
if (isGroup)
|
|
52657
|
-
|
|
52598
|
+
async getVideoUrl(fileUuid, isGroup) {
|
|
52599
|
+
if (isGroup) {
|
|
52600
|
+
const { download } = await this.ctx.pmhq.getGroupVideoUrl(fileUuid);
|
|
52601
|
+
return `https://${download.info.domain}${download.info.urlPath}${download.rKeyParam}`;
|
|
52602
|
+
} else {
|
|
52603
|
+
const { download } = await this.ctx.pmhq.getPrivateVideoUrl(fileUuid);
|
|
52604
|
+
return `https://${download.info.domain}${download.info.urlPath}${download.rKeyParam}`;
|
|
52605
|
+
}
|
|
52658
52606
|
}
|
|
52659
52607
|
async getPttUrl(fileUuid, isGroup) {
|
|
52660
|
-
if (isGroup)
|
|
52661
|
-
|
|
52662
|
-
|
|
52663
|
-
|
|
52664
|
-
|
|
52665
|
-
|
|
52666
|
-
peer,
|
|
52667
|
-
msgId,
|
|
52668
|
-
elementId,
|
|
52669
|
-
0,
|
|
52670
|
-
{
|
|
52671
|
-
downSourceType: 1,
|
|
52672
|
-
triggerType: 0
|
|
52673
|
-
}
|
|
52674
|
-
]);
|
|
52675
|
-
if (data.result !== 0) this.ctx.logger.warn("getVideoUrl", data);
|
|
52676
|
-
return data.urlResult.domainUrl[0]?.url ?? "";
|
|
52677
|
-
} catch (e) {
|
|
52678
|
-
this.ctx.logger.warn("getVideoUrl error", e);
|
|
52679
|
-
return "";
|
|
52608
|
+
if (isGroup) {
|
|
52609
|
+
const { download } = await this.ctx.pmhq.getGroupPttUrl(fileUuid);
|
|
52610
|
+
return `https://${download.info.domain}${download.info.urlPath}${download.rKeyParam}`;
|
|
52611
|
+
} else {
|
|
52612
|
+
const { download } = await this.ctx.pmhq.getPrivatePttUrl(fileUuid);
|
|
52613
|
+
return `https://${download.info.domain}${download.info.urlPath}${download.rKeyParam}`;
|
|
52680
52614
|
}
|
|
52681
52615
|
}
|
|
52682
|
-
async getFileType(filePath) {
|
|
52683
|
-
return await getFileType(filePath);
|
|
52684
|
-
}
|
|
52685
52616
|
async getRichMediaFilePath(md5HexStr, fileName, elementType, elementSubType = 0) {
|
|
52686
52617
|
return await this.ctx.pmhq.invoke(NTMethod.MEDIA_FILE_PATH, [{
|
|
52687
52618
|
md5HexStr,
|
|
@@ -52699,7 +52630,7 @@ var NTQQFileApi = class extends Service {
|
|
|
52699
52630
|
const fileMd5 = await getMd5HexFromFile(filePath);
|
|
52700
52631
|
let fileName = path.basename(filePath);
|
|
52701
52632
|
if (!fileName.includes(".")) {
|
|
52702
|
-
const ext = (await
|
|
52633
|
+
const ext = (await getFileType(filePath))?.ext;
|
|
52703
52634
|
fileName += ext ? "." + ext : "";
|
|
52704
52635
|
}
|
|
52705
52636
|
const mediaPath = await this.getRichMediaFilePath(fileMd5, fileName, elementType, elementSubType);
|
|
@@ -52710,37 +52641,8 @@ var NTQQFileApi = class extends Service {
|
|
|
52710
52641
|
path: mediaPath
|
|
52711
52642
|
};
|
|
52712
52643
|
}
|
|
52713
|
-
async
|
|
52714
|
-
|
|
52715
|
-
else return sourcePath;
|
|
52716
|
-
return (await this.ctx.pmhq.invoke("nodeIKernelMsgService/downloadRichMedia", [{
|
|
52717
|
-
fileModelId: "0",
|
|
52718
|
-
downloadSourceType: 0,
|
|
52719
|
-
triggerType: 1,
|
|
52720
|
-
msgId,
|
|
52721
|
-
chatType,
|
|
52722
|
-
peerUid,
|
|
52723
|
-
elementId,
|
|
52724
|
-
thumbSize: 0,
|
|
52725
|
-
downloadType: 1,
|
|
52726
|
-
filePath: thumbPath
|
|
52727
|
-
}], {
|
|
52728
|
-
resultCmd: ReceiveCmdS.MEDIA_DOWNLOAD_COMPLETE,
|
|
52729
|
-
resultCb: (payload) => payload.msgId === msgId,
|
|
52730
|
-
timeout
|
|
52731
|
-
})).filePath;
|
|
52732
|
-
}
|
|
52733
|
-
async getImageSize(filePath) {
|
|
52734
|
-
const fileType = await getFileType(filePath);
|
|
52735
|
-
const size = await getImageSize(filePath);
|
|
52736
|
-
return {
|
|
52737
|
-
type: fileType.ext,
|
|
52738
|
-
...size
|
|
52739
|
-
};
|
|
52740
|
-
}
|
|
52741
|
-
async getImageUrl(element) {
|
|
52742
|
-
const url = element.originImageUrl;
|
|
52743
|
-
const md5HexStr = element.md5HexStr;
|
|
52644
|
+
async getImageUrl(originImageUrl, md5HexStr) {
|
|
52645
|
+
const url = originImageUrl;
|
|
52744
52646
|
if (url) {
|
|
52745
52647
|
const parsedUrl = new URL(IMAGE_HTTP_HOST + url);
|
|
52746
52648
|
const imageAppid = parsedUrl.searchParams.get("appid");
|
|
@@ -52754,31 +52656,10 @@ var NTQQFileApi = class extends Service {
|
|
|
52754
52656
|
else return IMAGE_HTTP_HOST + url;
|
|
52755
52657
|
} else return `${IMAGE_HTTP_HOST}/gchatpic_new/0/0-0-${md5HexStr.toUpperCase()}/0`;
|
|
52756
52658
|
}
|
|
52757
|
-
async
|
|
52758
|
-
|
|
52759
|
-
|
|
52760
|
-
|
|
52761
|
-
""
|
|
52762
|
-
], {
|
|
52763
|
-
resultCmd: ReceiveCmdS.MEDIA_DOWNLOAD_COMPLETE,
|
|
52764
|
-
resultCb: (payload) => payload.fileModelId === fileModelId,
|
|
52765
|
-
timeout
|
|
52766
|
-
})).filePath;
|
|
52767
|
-
}
|
|
52768
|
-
async ocrImage(path) {
|
|
52769
|
-
return await this.ctx.pmhq.invoke("nodeIKernelNodeMiscService/wantWinScreenOCR", [path], { timeout: 2 * Time.minute });
|
|
52770
|
-
}
|
|
52771
|
-
async uploadRMFileWithoutMsg(filePath, bizType, peerUid) {
|
|
52772
|
-
return await this.ctx.pmhq.invoke("nodeIKernelRichMediaService/uploadRMFileWithoutMsg", [{
|
|
52773
|
-
filePath,
|
|
52774
|
-
bizType,
|
|
52775
|
-
peerUid,
|
|
52776
|
-
useNTV2: true
|
|
52777
|
-
}], {
|
|
52778
|
-
resultCmd: ReceiveCmdS.MEDIA_UPLOAD_COMPLETE,
|
|
52779
|
-
resultCb: (payload) => payload.filePath === filePath,
|
|
52780
|
-
timeout: 20 * Time.second
|
|
52781
|
-
});
|
|
52659
|
+
async ocrImage(imageUrl) {
|
|
52660
|
+
const res = await this.ctx.pmhq.imageOcr(imageUrl);
|
|
52661
|
+
if (res.retCode) throw new Error(res.wording);
|
|
52662
|
+
return res.ocrRspBody;
|
|
52782
52663
|
}
|
|
52783
52664
|
async uploadFlashFile(title, filePaths) {
|
|
52784
52665
|
return await this.ctx.pmhq.invoke("nodeIKernelFlashTransferService/createFlashTransferUploadTask", [(/* @__PURE__ */ new Date()).getTime(), {
|
|
@@ -53111,38 +52992,61 @@ var NTQQFileApi = class extends Service {
|
|
|
53111
52992
|
crcMedia: result.crcMedia
|
|
53112
52993
|
};
|
|
53113
52994
|
}
|
|
53114
|
-
|
|
53115
|
-
|
|
53116
|
-
|
|
53117
|
-
|
|
53118
|
-
|
|
53119
|
-
|
|
53120
|
-
|
|
53121
|
-
|
|
53122
|
-
|
|
53123
|
-
|
|
53124
|
-
|
|
53125
|
-
|
|
53126
|
-
|
|
53127
|
-
|
|
53128
|
-
|
|
53129
|
-
|
|
53130
|
-
|
|
53131
|
-
|
|
53132
|
-
|
|
53133
|
-
|
|
53134
|
-
|
|
53135
|
-
|
|
53136
|
-
|
|
53137
|
-
|
|
53138
|
-
|
|
53139
|
-
|
|
52995
|
+
async uploadGroupImage(groupCode, filePath) {
|
|
52996
|
+
const result = await this.ctx.pmhq.getGroupImageUploadInfo(groupCode, filePath);
|
|
52997
|
+
const highwaySession = await this.ctx.pmhq.getHighwaySession();
|
|
52998
|
+
const maxBlockSize = 1024 * 1024;
|
|
52999
|
+
if (result.ext.uKey) {
|
|
53000
|
+
const { index } = result.ext.msgInfoBody[0];
|
|
53001
|
+
const trans = {
|
|
53002
|
+
uin: selfInfo.uin,
|
|
53003
|
+
cmd: 1004,
|
|
53004
|
+
readable: createReadStream(filePath, { highWaterMark: maxBlockSize }),
|
|
53005
|
+
sum: Buffer.from(index.info.md5HexStr, "hex"),
|
|
53006
|
+
size: index.info.fileSize,
|
|
53007
|
+
ticket: highwaySession.sigSession,
|
|
53008
|
+
ext: Media.NTV2RichMediaHighwayExt.encode(result.ext),
|
|
53009
|
+
server: highwaySession.highwayHostAndPorts[1][0].host,
|
|
53010
|
+
port: highwaySession.highwayHostAndPorts[1][0].port
|
|
53011
|
+
};
|
|
53012
|
+
try {
|
|
53013
|
+
await new HighwayTcpSession(trans).upload();
|
|
53014
|
+
} catch {
|
|
53015
|
+
await new HighwayHttpSession(trans).upload();
|
|
53016
|
+
}
|
|
53017
|
+
}
|
|
53018
|
+
return {
|
|
53019
|
+
msgInfo: result.info,
|
|
53020
|
+
compat: result.compat
|
|
53021
|
+
};
|
|
53140
53022
|
}
|
|
53141
|
-
async
|
|
53142
|
-
|
|
53143
|
-
|
|
53144
|
-
|
|
53145
|
-
|
|
53023
|
+
async uploadC2CImage(peerUid, filePath) {
|
|
53024
|
+
const result = await this.ctx.pmhq.getC2CImageUploadInfo(peerUid, filePath);
|
|
53025
|
+
const highwaySession = await this.ctx.pmhq.getHighwaySession();
|
|
53026
|
+
const maxBlockSize = 1024 * 1024;
|
|
53027
|
+
if (result.ext.uKey) {
|
|
53028
|
+
const { index } = result.ext.msgInfoBody[0];
|
|
53029
|
+
const trans = {
|
|
53030
|
+
uin: selfInfo.uin,
|
|
53031
|
+
cmd: 1003,
|
|
53032
|
+
readable: createReadStream(filePath, { highWaterMark: maxBlockSize }),
|
|
53033
|
+
sum: Buffer.from(index.info.md5HexStr, "hex"),
|
|
53034
|
+
size: index.info.fileSize,
|
|
53035
|
+
ticket: highwaySession.sigSession,
|
|
53036
|
+
ext: Media.NTV2RichMediaHighwayExt.encode(result.ext),
|
|
53037
|
+
server: highwaySession.highwayHostAndPorts[1][0].host,
|
|
53038
|
+
port: highwaySession.highwayHostAndPorts[1][0].port
|
|
53039
|
+
};
|
|
53040
|
+
try {
|
|
53041
|
+
await new HighwayTcpSession(trans).upload();
|
|
53042
|
+
} catch {
|
|
53043
|
+
await new HighwayHttpSession(trans).upload();
|
|
53044
|
+
}
|
|
53045
|
+
}
|
|
53046
|
+
return {
|
|
53047
|
+
msgInfo: result.info,
|
|
53048
|
+
compat: result.compat
|
|
53049
|
+
};
|
|
53146
53050
|
}
|
|
53147
53051
|
};
|
|
53148
53052
|
//#endregion
|
|
@@ -53153,37 +53057,81 @@ var NTQQFriendApi = class extends Service {
|
|
|
53153
53057
|
"ntSystemApi",
|
|
53154
53058
|
"pmhq"
|
|
53155
53059
|
];
|
|
53060
|
+
friendsCache = [];
|
|
53061
|
+
categoriesCache = /* @__PURE__ */ new Map();
|
|
53156
53062
|
constructor(ctx) {
|
|
53157
53063
|
super(ctx, "ntFriendApi");
|
|
53158
53064
|
this.ctx = ctx;
|
|
53159
53065
|
}
|
|
53160
|
-
|
|
53161
|
-
|
|
53162
|
-
return await this.ctx.pmhq.invoke(NTMethod.HANDLE_FRIEND_REQUEST, [{
|
|
53163
|
-
friendUid,
|
|
53164
|
-
reqTime,
|
|
53165
|
-
accept
|
|
53166
|
-
}]);
|
|
53066
|
+
async approvalFriendRequest(friendUid, accept) {
|
|
53067
|
+
await this.ctx.pmhq.setFriendRequest(friendUid, accept ? 3 : 5);
|
|
53167
53068
|
}
|
|
53168
|
-
async
|
|
53169
|
-
|
|
53069
|
+
async getFriendList(forceUpdate) {
|
|
53070
|
+
if (forceUpdate || this.friendsCache.length === 0) {
|
|
53071
|
+
const res = await this.ctx.pmhq.fetchFriends();
|
|
53072
|
+
this.friendsCache = res.friendList.map((friend) => {
|
|
53073
|
+
const biz = friend.subBiz.get(1);
|
|
53074
|
+
return {
|
|
53075
|
+
uid: friend.uid,
|
|
53076
|
+
uin: friend.uin,
|
|
53077
|
+
categoryId: friend.categoryId,
|
|
53078
|
+
nick: biz.data.get(20002).toString(),
|
|
53079
|
+
longNick: biz.data.get(102).toString(),
|
|
53080
|
+
remark: biz.data.get(103).toString(),
|
|
53081
|
+
qid: biz.data.get(27394).toString(),
|
|
53082
|
+
age: biz.numData.get(20037),
|
|
53083
|
+
sex: biz.numData.get(20009),
|
|
53084
|
+
birthdayYear: biz.data.get(20031)[0] << 8 | biz.data.get(20031)[1],
|
|
53085
|
+
birthdayMonth: biz.data.get(20031)[2],
|
|
53086
|
+
birthdayDay: biz.data.get(20031)[3]
|
|
53087
|
+
};
|
|
53088
|
+
});
|
|
53089
|
+
this.categoriesCache.clear();
|
|
53090
|
+
for (const cat of res.category) this.categoriesCache.set(cat.categoryId, cat);
|
|
53091
|
+
}
|
|
53092
|
+
return {
|
|
53093
|
+
friends: this.friendsCache,
|
|
53094
|
+
categories: this.categoriesCache
|
|
53095
|
+
};
|
|
53170
53096
|
}
|
|
53171
|
-
async
|
|
53172
|
-
const
|
|
53173
|
-
let result;
|
|
53174
|
-
|
|
53175
|
-
|
|
53176
|
-
|
|
53177
|
-
|
|
53178
|
-
|
|
53179
|
-
|
|
53180
|
-
return
|
|
53097
|
+
async getFriendInfoByUin(uin, forceUpdate) {
|
|
53098
|
+
const result = await this.getFriendList(forceUpdate);
|
|
53099
|
+
let categories = result.categories;
|
|
53100
|
+
let friend = result.friends.find((e) => e.uin === uin);
|
|
53101
|
+
if (!friend) {
|
|
53102
|
+
const result = await this.getFriendList(true);
|
|
53103
|
+
categories = result.categories;
|
|
53104
|
+
friend = result.friends.find((e) => e.uin === uin);
|
|
53105
|
+
}
|
|
53106
|
+
if (!friend) return;
|
|
53107
|
+
const category = categories.get(friend.categoryId);
|
|
53108
|
+
return {
|
|
53109
|
+
friend,
|
|
53110
|
+
category
|
|
53111
|
+
};
|
|
53181
53112
|
}
|
|
53182
|
-
async
|
|
53183
|
-
|
|
53113
|
+
async getFriendInfoByUid(uid, forceUpdate) {
|
|
53114
|
+
const result = await this.getFriendList(forceUpdate);
|
|
53115
|
+
let categories = result.categories;
|
|
53116
|
+
let friend = result.friends.find((e) => e.uid === uid);
|
|
53117
|
+
if (!friend) {
|
|
53118
|
+
const result = await this.getFriendList(true);
|
|
53119
|
+
categories = result.categories;
|
|
53120
|
+
friend = result.friends.find((e) => e.uid === uid);
|
|
53121
|
+
}
|
|
53122
|
+
if (!friend) return;
|
|
53123
|
+
const category = categories.get(friend.categoryId);
|
|
53124
|
+
return {
|
|
53125
|
+
friend,
|
|
53126
|
+
category
|
|
53127
|
+
};
|
|
53128
|
+
}
|
|
53129
|
+
async isFriend(uid) {
|
|
53130
|
+
return await this.getFriendInfoByUid(uid, false) !== void 0;
|
|
53184
53131
|
}
|
|
53185
|
-
async
|
|
53186
|
-
|
|
53132
|
+
async getFriendRecommendContactArk(uin) {
|
|
53133
|
+
const { ark } = await this.ctx.pmhq.getFriendRecommendContactArk(uin);
|
|
53134
|
+
return ark;
|
|
53187
53135
|
}
|
|
53188
53136
|
async setBuddyRemark(uid, remark = "") {
|
|
53189
53137
|
return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/setBuddyRemark", [{
|
|
@@ -53215,12 +53163,8 @@ var NTQQFriendApi = class extends Service {
|
|
|
53215
53163
|
resultCb: (payload) => payload.reqId === reqId
|
|
53216
53164
|
});
|
|
53217
53165
|
}
|
|
53218
|
-
async
|
|
53219
|
-
return await this.ctx.pmhq.
|
|
53220
|
-
uid,
|
|
53221
|
-
"",
|
|
53222
|
-
""
|
|
53223
|
-
]);
|
|
53166
|
+
async approvalDoubtFriendRequest(requestUid) {
|
|
53167
|
+
return await this.ctx.pmhq.setFilteredFriendRequestReq(selfInfo.uid, requestUid);
|
|
53224
53168
|
}
|
|
53225
53169
|
async getBuddyReq() {
|
|
53226
53170
|
return await this.ctx.pmhq.invoke("nodeIKernelBuddyService/getBuddyReq", [], { resultCmd: "nodeIKernelBuddyListener/onBuddyReqChange" });
|
|
@@ -54704,6 +54648,9 @@ var NTQQSystemApi = class extends Service {
|
|
|
54704
54648
|
async scanQRCode(path) {
|
|
54705
54649
|
return await this.ctx.pmhq.invoke("nodeIKernelNodeMiscService/scanQBar", [path]);
|
|
54706
54650
|
}
|
|
54651
|
+
async getPins() {
|
|
54652
|
+
return await this.ctx.pmhq.fetchPins();
|
|
54653
|
+
}
|
|
54707
54654
|
};
|
|
54708
54655
|
//#endregion
|
|
54709
54656
|
//#region node_modules/get-port/index.js
|
|
@@ -56422,7 +56369,7 @@ function createDashboardRoutes(ctx) {
|
|
|
56422
56369
|
success: false,
|
|
56423
56370
|
message: "服务尚未就绪,请等待登录完成"
|
|
56424
56371
|
}, 503);
|
|
56425
|
-
const friends = await ctx.ntFriendApi.
|
|
56372
|
+
const friends = await ctx.ntFriendApi.getFriendList(false);
|
|
56426
56373
|
const groups = await ctx.ntGroupApi.getGroups(false);
|
|
56427
56374
|
const qqInfo = await ctx.pmhq.getProcessInfo();
|
|
56428
56375
|
const qqMemory = qqInfo?.memory?.rss || 0;
|
|
@@ -56439,7 +56386,7 @@ function createDashboardRoutes(ctx) {
|
|
|
56439
56386
|
return c.json({
|
|
56440
56387
|
success: true,
|
|
56441
56388
|
data: {
|
|
56442
|
-
friendCount: friends.length,
|
|
56389
|
+
friendCount: friends.friends.length,
|
|
56443
56390
|
groupCount: groups.length,
|
|
56444
56391
|
messageReceived: app.messageReceivedCount,
|
|
56445
56392
|
messageSent: app.messageSentCount,
|
|
@@ -57205,7 +57152,7 @@ function createNotificationRoutes(ctx) {
|
|
|
57205
57152
|
isDecide: reqItem.isDecide,
|
|
57206
57153
|
reqType: reqItem.reqType,
|
|
57207
57154
|
addSource: reqItem.addSource || "",
|
|
57208
|
-
flag:
|
|
57155
|
+
flag: reqItem.friendUid
|
|
57209
57156
|
};
|
|
57210
57157
|
}));
|
|
57211
57158
|
return c.json({
|
|
@@ -57256,7 +57203,7 @@ function createNotificationRoutes(ctx) {
|
|
|
57256
57203
|
success: false,
|
|
57257
57204
|
message: "缺少必要参数"
|
|
57258
57205
|
}, 400);
|
|
57259
|
-
await ctx.ntFriendApi.
|
|
57206
|
+
await ctx.ntFriendApi.approvalDoubtFriendRequest(uid);
|
|
57260
57207
|
return c.json({ success: true });
|
|
57261
57208
|
} catch (e) {
|
|
57262
57209
|
ctx.logger.error("处理被过滤好友申请失败:", e);
|
|
@@ -57293,12 +57240,7 @@ function createNotificationRoutes(ctx) {
|
|
|
57293
57240
|
success: false,
|
|
57294
57241
|
message: "缺少必要参数"
|
|
57295
57242
|
}, 400);
|
|
57296
|
-
|
|
57297
|
-
if (!friendUid) return c.json({
|
|
57298
|
-
success: false,
|
|
57299
|
-
message: "无效的 flag 参数"
|
|
57300
|
-
}, 400);
|
|
57301
|
-
await ctx.ntFriendApi.handleFriendRequest(friendUid, reqTime || "0", action === "approve");
|
|
57243
|
+
await ctx.ntFriendApi.approvalFriendRequest(flag, action === "approve");
|
|
57302
57244
|
return c.json({ success: true });
|
|
57303
57245
|
} catch (e) {
|
|
57304
57246
|
ctx.logger.error("处理好友申请失败:", e);
|
|
@@ -57497,6 +57439,65 @@ function createEmailRoutes(ctx) {
|
|
|
57497
57439
|
return router;
|
|
57498
57440
|
}
|
|
57499
57441
|
//#endregion
|
|
57442
|
+
//#region node_modules/@hono/node-server/dist/utils/stream.mjs
|
|
57443
|
+
var pr54206Applied = () => {
|
|
57444
|
+
const [major, minor] = versions.node.split(".").map((component) => parseInt(component));
|
|
57445
|
+
return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18;
|
|
57446
|
+
};
|
|
57447
|
+
var useReadableToWeb = pr54206Applied();
|
|
57448
|
+
var createStreamBody = (stream, useNativeReadableToWeb = useReadableToWeb) => {
|
|
57449
|
+
if (useNativeReadableToWeb) return Readable.toWeb(stream);
|
|
57450
|
+
let controller;
|
|
57451
|
+
let settled = false;
|
|
57452
|
+
const cleanup = () => {
|
|
57453
|
+
stream.off("data", onData);
|
|
57454
|
+
stream.off("error", onError);
|
|
57455
|
+
stream.off("end", onTerminate);
|
|
57456
|
+
stream.off("close", onTerminate);
|
|
57457
|
+
};
|
|
57458
|
+
const settle = (callback) => {
|
|
57459
|
+
if (settled) return;
|
|
57460
|
+
settled = true;
|
|
57461
|
+
cleanup();
|
|
57462
|
+
callback?.();
|
|
57463
|
+
};
|
|
57464
|
+
const onData = (chunk) => {
|
|
57465
|
+
if (settled || !controller) return;
|
|
57466
|
+
controller.enqueue(chunk);
|
|
57467
|
+
if ((controller.desiredSize ?? 0) <= 0) stream.pause();
|
|
57468
|
+
};
|
|
57469
|
+
const onError = (error) => {
|
|
57470
|
+
settle(() => {
|
|
57471
|
+
controller?.error(error);
|
|
57472
|
+
});
|
|
57473
|
+
};
|
|
57474
|
+
const onTerminate = () => {
|
|
57475
|
+
settle(() => {
|
|
57476
|
+
controller?.close();
|
|
57477
|
+
});
|
|
57478
|
+
};
|
|
57479
|
+
return new ReadableStream({
|
|
57480
|
+
start(streamController) {
|
|
57481
|
+
controller = streamController;
|
|
57482
|
+
stream.on("data", onData);
|
|
57483
|
+
stream.on("error", onError);
|
|
57484
|
+
stream.on("end", onTerminate);
|
|
57485
|
+
stream.on("close", onTerminate);
|
|
57486
|
+
stream.pause();
|
|
57487
|
+
},
|
|
57488
|
+
pull() {
|
|
57489
|
+
if (!settled) stream.resume();
|
|
57490
|
+
},
|
|
57491
|
+
cancel() {
|
|
57492
|
+
settle();
|
|
57493
|
+
const ignoreError = () => {};
|
|
57494
|
+
stream.on("error", ignoreError);
|
|
57495
|
+
stream.once("close", () => stream.off("error", ignoreError));
|
|
57496
|
+
stream.destroy();
|
|
57497
|
+
}
|
|
57498
|
+
});
|
|
57499
|
+
};
|
|
57500
|
+
//#endregion
|
|
57500
57501
|
//#region node_modules/hono/dist/utils/mime.js
|
|
57501
57502
|
var getMimeType = (filename, mimes = baseMimes) => {
|
|
57502
57503
|
const match = filename.match(/\.([a-zA-Z0-9]+?)$/);
|
|
@@ -57572,30 +57573,6 @@ var ENCODINGS = {
|
|
|
57572
57573
|
gzip: ".gz"
|
|
57573
57574
|
};
|
|
57574
57575
|
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
57575
|
-
var pr54206Applied = () => {
|
|
57576
|
-
const [major, minor] = versions.node.split(".").map((component) => parseInt(component));
|
|
57577
|
-
return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18;
|
|
57578
|
-
};
|
|
57579
|
-
var useReadableToWeb = pr54206Applied();
|
|
57580
|
-
var createStreamBody = (stream) => {
|
|
57581
|
-
if (useReadableToWeb) return Readable.toWeb(stream);
|
|
57582
|
-
return new ReadableStream({
|
|
57583
|
-
start(controller) {
|
|
57584
|
-
stream.on("data", (chunk) => {
|
|
57585
|
-
controller.enqueue(chunk);
|
|
57586
|
-
});
|
|
57587
|
-
stream.on("error", (err) => {
|
|
57588
|
-
controller.error(err);
|
|
57589
|
-
});
|
|
57590
|
-
stream.on("end", () => {
|
|
57591
|
-
controller.close();
|
|
57592
|
-
});
|
|
57593
|
-
},
|
|
57594
|
-
cancel() {
|
|
57595
|
-
stream.destroy();
|
|
57596
|
-
}
|
|
57597
|
-
});
|
|
57598
|
-
};
|
|
57599
57576
|
var getStats = (path) => {
|
|
57600
57577
|
let stats;
|
|
57601
57578
|
try {
|
|
@@ -57662,6 +57639,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
57662
57639
|
let result;
|
|
57663
57640
|
const size = stats.size;
|
|
57664
57641
|
const range = c.req.header("range") || "";
|
|
57642
|
+
c.header("Last-Modified", stats.mtime.toUTCString());
|
|
57665
57643
|
if (c.req.method == "HEAD" || c.req.method == "OPTIONS") {
|
|
57666
57644
|
c.header("Content-Length", size.toString());
|
|
57667
57645
|
c.status(200);
|
|
@@ -57671,7 +57649,6 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
57671
57649
|
result = c.body(createStreamBody(createReadStream(path)), 200);
|
|
57672
57650
|
} else {
|
|
57673
57651
|
c.header("Accept-Ranges", "bytes");
|
|
57674
|
-
c.header("Date", stats.birthtime.toUTCString());
|
|
57675
57652
|
const parts = range.replace(/bytes=/, "").split("-", 2);
|
|
57676
57653
|
const start = parseInt(parts[0], 10) || 0;
|
|
57677
57654
|
let end = parseInt(parts[1], 10) || size - 1;
|
|
@@ -57850,7 +57827,7 @@ var WebuiServer = class extends Service {
|
|
|
57850
57827
|
isDecide: req.isDecide,
|
|
57851
57828
|
reqType: req.reqType,
|
|
57852
57829
|
addSource: req.addSource || "",
|
|
57853
|
-
flag:
|
|
57830
|
+
flag: req.friendUid
|
|
57854
57831
|
}
|
|
57855
57832
|
});
|
|
57856
57833
|
} catch (e) {
|
|
@@ -69662,6 +69639,71 @@ function FriendMixin(Base) {
|
|
|
69662
69639
|
url: `https://${download.downloadDns}/ftn_handler/${download.downloadUrl.toString("hex")}/?fname=${encodeURIComponent(fileName)}`
|
|
69663
69640
|
};
|
|
69664
69641
|
}
|
|
69642
|
+
async setFriendRequest(targetUid, accept) {
|
|
69643
|
+
const body = Oidb.SetFriendRequestReq.encode({
|
|
69644
|
+
targetUid,
|
|
69645
|
+
accept
|
|
69646
|
+
});
|
|
69647
|
+
const data = Oidb.Base.encode({
|
|
69648
|
+
command: 2909,
|
|
69649
|
+
subCommand: 44,
|
|
69650
|
+
body
|
|
69651
|
+
});
|
|
69652
|
+
await this.httpSendPB("OidbSvcTrpcTcp.0xb5d_44", data);
|
|
69653
|
+
}
|
|
69654
|
+
async setFilteredFriendRequestReq(selfUid, requestUid) {
|
|
69655
|
+
const body = Oidb.SetFilteredFriendRequestReq.encode({
|
|
69656
|
+
selfUid,
|
|
69657
|
+
requestUid
|
|
69658
|
+
});
|
|
69659
|
+
const data = Oidb.Base.encode({
|
|
69660
|
+
command: 3442,
|
|
69661
|
+
subCommand: 0,
|
|
69662
|
+
body
|
|
69663
|
+
});
|
|
69664
|
+
await this.httpSendPB("OidbSvcTrpcTcp.0xd72_0", data);
|
|
69665
|
+
}
|
|
69666
|
+
async fetchFriends() {
|
|
69667
|
+
const body = Oidb.IncPullReq.encode({
|
|
69668
|
+
reqCount: 500,
|
|
69669
|
+
flag: 1,
|
|
69670
|
+
requestBiz: [{
|
|
69671
|
+
bizType: 1,
|
|
69672
|
+
bizData: { extBusi: [
|
|
69673
|
+
102,
|
|
69674
|
+
103,
|
|
69675
|
+
20002,
|
|
69676
|
+
20009,
|
|
69677
|
+
20031,
|
|
69678
|
+
20037,
|
|
69679
|
+
27394
|
|
69680
|
+
] }
|
|
69681
|
+
}]
|
|
69682
|
+
});
|
|
69683
|
+
const data = Oidb.Base.encode({
|
|
69684
|
+
command: 4052,
|
|
69685
|
+
subCommand: 1,
|
|
69686
|
+
body
|
|
69687
|
+
});
|
|
69688
|
+
const res = await this.httpSendPB("OidbSvcTrpcTcp.0xfd4_1", data);
|
|
69689
|
+
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
69690
|
+
return Oidb.IncPullResp.decode(oidbRespBody);
|
|
69691
|
+
}
|
|
69692
|
+
async getFriendRecommendContactArk(uin) {
|
|
69693
|
+
const body = Oidb.GetFriendRecommendContactArkReq.encode({
|
|
69694
|
+
uin,
|
|
69695
|
+
phoneNumber: "-",
|
|
69696
|
+
jumpUrl: `mqqapi://card/show_pslcard?src_type=internal&source=sharecard&version=1&uin=${uin}`
|
|
69697
|
+
});
|
|
69698
|
+
const data = Oidb.Base.encode({
|
|
69699
|
+
command: 4790,
|
|
69700
|
+
subCommand: 0,
|
|
69701
|
+
body
|
|
69702
|
+
});
|
|
69703
|
+
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x12b6_0", data);
|
|
69704
|
+
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
69705
|
+
return Oidb.GetFriendRecommendContactArkResp.decode(oidbRespBody);
|
|
69706
|
+
}
|
|
69665
69707
|
};
|
|
69666
69708
|
}
|
|
69667
69709
|
//#endregion
|
|
@@ -69873,7 +69915,7 @@ var NTV2RichMedia;
|
|
|
69873
69915
|
network: convertIPv4(subFileInfo.ipv4s),
|
|
69874
69916
|
msgInfoBody: upload.msgInfo.msgInfoBody,
|
|
69875
69917
|
blockSize,
|
|
69876
|
-
hash: { fileSha1: [] }
|
|
69918
|
+
hash: { fileSha1: [Buffer.alloc(0)] }
|
|
69877
69919
|
};
|
|
69878
69920
|
else return {
|
|
69879
69921
|
fileUuid: index.fileUuid,
|
|
@@ -69881,7 +69923,7 @@ var NTV2RichMedia;
|
|
|
69881
69923
|
network: convertIPv4(upload.ipv4s),
|
|
69882
69924
|
msgInfoBody: upload.msgInfo.msgInfoBody,
|
|
69883
69925
|
blockSize,
|
|
69884
|
-
hash: { fileSha1: [] }
|
|
69926
|
+
hash: { fileSha1: [Buffer.alloc(0)] }
|
|
69885
69927
|
};
|
|
69886
69928
|
}
|
|
69887
69929
|
_NTV2RichMedia.generateExt = generateExt;
|
|
@@ -70001,8 +70043,7 @@ function MediaMixin(Base) {
|
|
|
70001
70043
|
});
|
|
70002
70044
|
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x126d_200", data);
|
|
70003
70045
|
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70004
|
-
|
|
70005
|
-
return `https://${download?.info?.domain}${download?.info?.urlPath}${download?.rKeyParam}`;
|
|
70046
|
+
return Media.NTV2RichMediaResp.decode(oidbRespBody);
|
|
70006
70047
|
}
|
|
70007
70048
|
async getGroupPttUrl(fileUuid) {
|
|
70008
70049
|
const body = Media.NTV2RichMediaReq.encode({
|
|
@@ -70035,8 +70076,7 @@ function MediaMixin(Base) {
|
|
|
70035
70076
|
});
|
|
70036
70077
|
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x126e_200", data);
|
|
70037
70078
|
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70038
|
-
|
|
70039
|
-
return `https://${download.info.domain}${download.info.urlPath}${download.rKeyParam}`;
|
|
70079
|
+
return Media.NTV2RichMediaResp.decode(oidbRespBody);
|
|
70040
70080
|
}
|
|
70041
70081
|
async getGroupVideoUrl(fileUuid) {
|
|
70042
70082
|
const body = Media.NTV2RichMediaReq.encode({
|
|
@@ -70069,8 +70109,7 @@ function MediaMixin(Base) {
|
|
|
70069
70109
|
});
|
|
70070
70110
|
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x11ea_200", data);
|
|
70071
70111
|
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70072
|
-
|
|
70073
|
-
return `https://${download.info.domain}${download.info.urlPath}${download.rKeyParam}`;
|
|
70112
|
+
return Media.NTV2RichMediaResp.decode(oidbRespBody);
|
|
70074
70113
|
}
|
|
70075
70114
|
async getPrivateVideoUrl(fileUuid) {
|
|
70076
70115
|
const body = Media.NTV2RichMediaReq.encode({
|
|
@@ -70106,8 +70145,7 @@ function MediaMixin(Base) {
|
|
|
70106
70145
|
});
|
|
70107
70146
|
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x11e9_200", data);
|
|
70108
70147
|
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70109
|
-
|
|
70110
|
-
return `https://${download.info.domain}${download.info.urlPath}${download.rKeyParam}`;
|
|
70148
|
+
return Media.NTV2RichMediaResp.decode(oidbRespBody);
|
|
70111
70149
|
}
|
|
70112
70150
|
async getHighwaySession() {
|
|
70113
70151
|
const data = Media.HighwaySessionReq.encode({ reqBody: {
|
|
@@ -70291,6 +70329,152 @@ function MediaMixin(Base) {
|
|
|
70291
70329
|
sha3CheckSum
|
|
70292
70330
|
};
|
|
70293
70331
|
}
|
|
70332
|
+
async getGroupImageUploadInfo(groupCode, filePath) {
|
|
70333
|
+
const peer = {
|
|
70334
|
+
chatType: ChatType.Group,
|
|
70335
|
+
peerUid: groupCode,
|
|
70336
|
+
guildId: ""
|
|
70337
|
+
};
|
|
70338
|
+
const body = await NTV2RichMedia.buildUploadReq(peer, {
|
|
70339
|
+
type: "image",
|
|
70340
|
+
filePath
|
|
70341
|
+
}, { pic: {
|
|
70342
|
+
summary: "[图片]",
|
|
70343
|
+
bytesPbReserveC2c: Buffer.from([
|
|
70344
|
+
8,
|
|
70345
|
+
0,
|
|
70346
|
+
24,
|
|
70347
|
+
0,
|
|
70348
|
+
32,
|
|
70349
|
+
0,
|
|
70350
|
+
74,
|
|
70351
|
+
0,
|
|
70352
|
+
80,
|
|
70353
|
+
0,
|
|
70354
|
+
98,
|
|
70355
|
+
0,
|
|
70356
|
+
146,
|
|
70357
|
+
1,
|
|
70358
|
+
0,
|
|
70359
|
+
154,
|
|
70360
|
+
1,
|
|
70361
|
+
0,
|
|
70362
|
+
170,
|
|
70363
|
+
1,
|
|
70364
|
+
12,
|
|
70365
|
+
8,
|
|
70366
|
+
0,
|
|
70367
|
+
18,
|
|
70368
|
+
0,
|
|
70369
|
+
24,
|
|
70370
|
+
0,
|
|
70371
|
+
32,
|
|
70372
|
+
0,
|
|
70373
|
+
40,
|
|
70374
|
+
0,
|
|
70375
|
+
58,
|
|
70376
|
+
0
|
|
70377
|
+
])
|
|
70378
|
+
} });
|
|
70379
|
+
const data = Oidb.Base.encode({
|
|
70380
|
+
command: 4548,
|
|
70381
|
+
subCommand: 100,
|
|
70382
|
+
body
|
|
70383
|
+
});
|
|
70384
|
+
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x11c4_100", data);
|
|
70385
|
+
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70386
|
+
const { upload } = Media.NTV2RichMediaResp.decode(oidbRespBody);
|
|
70387
|
+
return {
|
|
70388
|
+
info: upload.msgInfo,
|
|
70389
|
+
compat: upload.compatQMsg,
|
|
70390
|
+
ext: NTV2RichMedia.generateExt(upload)
|
|
70391
|
+
};
|
|
70392
|
+
}
|
|
70393
|
+
async getC2CImageUploadInfo(peerUid, filePath) {
|
|
70394
|
+
const peer = {
|
|
70395
|
+
chatType: ChatType.C2C,
|
|
70396
|
+
peerUid,
|
|
70397
|
+
guildId: ""
|
|
70398
|
+
};
|
|
70399
|
+
const body = await NTV2RichMedia.buildUploadReq(peer, {
|
|
70400
|
+
type: "image",
|
|
70401
|
+
filePath
|
|
70402
|
+
}, { pic: {
|
|
70403
|
+
summary: "[图片]",
|
|
70404
|
+
bytesPbReserveC2c: Buffer.from([
|
|
70405
|
+
8,
|
|
70406
|
+
0,
|
|
70407
|
+
24,
|
|
70408
|
+
0,
|
|
70409
|
+
32,
|
|
70410
|
+
0,
|
|
70411
|
+
74,
|
|
70412
|
+
0,
|
|
70413
|
+
80,
|
|
70414
|
+
0,
|
|
70415
|
+
98,
|
|
70416
|
+
0,
|
|
70417
|
+
146,
|
|
70418
|
+
1,
|
|
70419
|
+
0,
|
|
70420
|
+
154,
|
|
70421
|
+
1,
|
|
70422
|
+
0,
|
|
70423
|
+
170,
|
|
70424
|
+
1,
|
|
70425
|
+
12,
|
|
70426
|
+
8,
|
|
70427
|
+
0,
|
|
70428
|
+
18,
|
|
70429
|
+
0,
|
|
70430
|
+
24,
|
|
70431
|
+
0,
|
|
70432
|
+
32,
|
|
70433
|
+
0,
|
|
70434
|
+
40,
|
|
70435
|
+
0,
|
|
70436
|
+
58,
|
|
70437
|
+
0
|
|
70438
|
+
])
|
|
70439
|
+
} });
|
|
70440
|
+
const data = Oidb.Base.encode({
|
|
70441
|
+
command: 4549,
|
|
70442
|
+
subCommand: 100,
|
|
70443
|
+
body
|
|
70444
|
+
});
|
|
70445
|
+
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x11c5_100", data);
|
|
70446
|
+
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70447
|
+
const { upload } = Media.NTV2RichMediaResp.decode(oidbRespBody);
|
|
70448
|
+
return {
|
|
70449
|
+
info: upload.msgInfo,
|
|
70450
|
+
compat: upload.compatQMsg,
|
|
70451
|
+
ext: NTV2RichMedia.generateExt(upload)
|
|
70452
|
+
};
|
|
70453
|
+
}
|
|
70454
|
+
async imageOcr(imageUrl) {
|
|
70455
|
+
const body = Oidb.ImageOcrReq.encode({
|
|
70456
|
+
version: 1,
|
|
70457
|
+
client: 0,
|
|
70458
|
+
entrance: 1,
|
|
70459
|
+
ocrReqBody: {
|
|
70460
|
+
imageUrl,
|
|
70461
|
+
originMd5: "",
|
|
70462
|
+
afterCompressMd5: "",
|
|
70463
|
+
afterCompressFileSize: "",
|
|
70464
|
+
afterCompressWeight: "",
|
|
70465
|
+
afterCompressHeight: "",
|
|
70466
|
+
isCut: false
|
|
70467
|
+
}
|
|
70468
|
+
});
|
|
70469
|
+
const data = Oidb.Base.encode({
|
|
70470
|
+
command: 3591,
|
|
70471
|
+
subCommand: 0,
|
|
70472
|
+
body
|
|
70473
|
+
});
|
|
70474
|
+
const res = await this.httpSendPB("OidbSvcTrpcTcp.0xe07_0", data);
|
|
70475
|
+
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70476
|
+
return Oidb.ImageOcrResp.decode(oidbRespBody);
|
|
70477
|
+
}
|
|
70294
70478
|
};
|
|
70295
70479
|
}
|
|
70296
70480
|
//#endregion
|
|
@@ -70455,6 +70639,22 @@ function UserMixin(Base) {
|
|
|
70455
70639
|
};
|
|
70456
70640
|
}
|
|
70457
70641
|
//#endregion
|
|
70642
|
+
//#region src/main/pmhq/mixins/system.ts
|
|
70643
|
+
function SystemMixin(Base) {
|
|
70644
|
+
return class extends Base {
|
|
70645
|
+
async fetchPins() {
|
|
70646
|
+
const data = Oidb.Base.encode({
|
|
70647
|
+
command: 4787,
|
|
70648
|
+
subCommand: 0,
|
|
70649
|
+
body: Buffer.alloc(0)
|
|
70650
|
+
});
|
|
70651
|
+
const res = await this.httpSendPB("OidbSvcTrpcTcp.0x12b3_0", data);
|
|
70652
|
+
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, "hex")).body;
|
|
70653
|
+
return Oidb.FetchPinsResp.decode(oidbRespBody);
|
|
70654
|
+
}
|
|
70655
|
+
};
|
|
70656
|
+
}
|
|
70657
|
+
//#endregion
|
|
70458
70658
|
//#region src/main/pmhq/index.ts
|
|
70459
70659
|
function applyMixins(Base, mixins) {
|
|
70460
70660
|
return mixins.reduce((acc, mixin) => mixin(acc), Base);
|
|
@@ -70464,7 +70664,8 @@ var PMHQ = applyMixins(PMHQBase, [
|
|
|
70464
70664
|
FriendMixin,
|
|
70465
70665
|
MediaMixin,
|
|
70466
70666
|
MessageMixin,
|
|
70467
|
-
UserMixin
|
|
70667
|
+
UserMixin,
|
|
70668
|
+
SystemMixin
|
|
70468
70669
|
]);
|
|
70469
70670
|
//#endregion
|
|
70470
70671
|
//#region node_modules/@cordisjs/plugin-timer/lib/index.js
|
|
@@ -70613,7 +70814,6 @@ async function onLoad() {
|
|
|
70613
70814
|
ctx.plugin(Config);
|
|
70614
70815
|
ctx.plugin(PMHQ);
|
|
70615
70816
|
ctx.plugin(NTQQFileApi);
|
|
70616
|
-
ctx.plugin(NTQQFileCacheApi);
|
|
70617
70817
|
ctx.plugin(NTQQFriendApi);
|
|
70618
70818
|
ctx.plugin(NTQQGroupApi);
|
|
70619
70819
|
ctx.plugin(NTLoginApi);
|