mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
fix rkeyManager
This commit is contained in:
parent
aaa874b099
commit
bd9ee62118
@ -13,31 +13,34 @@ import * as fileType from 'file-type';
|
|||||||
import imageSize from 'image-size';
|
import imageSize from 'image-size';
|
||||||
import { ISizeCalculationResult } from 'image-size/dist/types/interface';
|
import { ISizeCalculationResult } from 'image-size/dist/types/interface';
|
||||||
import { NodeIKernelSearchService } from '../services/NodeIKernelSearchService';
|
import { NodeIKernelSearchService } from '../services/NodeIKernelSearchService';
|
||||||
|
import { RkeyManager } from '../helper/rkey';
|
||||||
|
|
||||||
|
|
||||||
export class NTQQFileApi {
|
export class NTQQFileApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
|
rkeyManager: RkeyManager;
|
||||||
constructor(context: InstanceContext, core: NapCatCore) {
|
constructor(context: InstanceContext, core: NapCatCore) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
|
this.rkeyManager = new RkeyManager('http://napcat-sign.wumiao.wang:2082/rkey', this.context.logger);
|
||||||
}
|
}
|
||||||
async getFileType(filePath: string) {
|
async getFileType(filePath: string) {
|
||||||
return fileType.fileTypeFromFile(filePath);
|
return fileType.fileTypeFromFile(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async copyFile(filePath: string, destPath: string) {
|
async copyFile(filePath: string, destPath: string) {
|
||||||
await this.context.wrapper.util.copyFile(filePath, destPath);
|
await this.context.wrapper.util.copyFile(filePath, destPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFileSize(filePath: string): Promise<number> {
|
async getFileSize(filePath: string): Promise<number> {
|
||||||
return await this.context.wrapper.util.getFileSize(filePath);
|
return await this.context.wrapper.util.getFileSize(filePath);
|
||||||
}
|
}
|
||||||
async getVideoUrl(peer: Peer, msgId: string, elementId: string) {
|
async getVideoUrl(peer: Peer, msgId: string, elementId: string) {
|
||||||
return (await this.context.session.getRichMediaService().getVideoPlayUrlV2(peer, msgId, elementId, 0, { downSourceType: 1, triggerType: 1 })).urlResult.domainUrl;
|
return (await this.context.session.getRichMediaService().getVideoPlayUrlV2(peer, msgId, elementId, 0, { downSourceType: 1, triggerType: 1 })).urlResult.domainUrl;
|
||||||
}
|
}
|
||||||
// 上传文件到QQ的文件夹
|
// 上传文件到QQ的文件夹
|
||||||
async uploadFile(filePath: string, elementType: ElementType = ElementType.PIC, elementSubType: number = 0) {
|
async uploadFile(filePath: string, elementType: ElementType = ElementType.PIC, elementSubType: number = 0) {
|
||||||
// napCatCore.wrapper.util.
|
// napCatCore.wrapper.util.
|
||||||
const fileMd5 = await calculateFileMD5(filePath);
|
const fileMd5 = await calculateFileMD5(filePath);
|
||||||
let ext: string = (await this.getFileType(filePath))?.ext as string || '';
|
let ext: string = (await this.getFileType(filePath))?.ext as string || '';
|
||||||
@ -68,10 +71,10 @@ export class NTQQFileApi {
|
|||||||
ext
|
ext
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async downloadMediaByUuid() {
|
async downloadMediaByUuid() {
|
||||||
//napCatCore.session.getRichMediaService().downloadFileForFileUuid();
|
//napCatCore.session.getRichMediaService().downloadFileForFileUuid();
|
||||||
}
|
}
|
||||||
async downloadMedia(msgId: string, chatType: ChatType, peerUid: string, elementId: string, thumbPath: string, sourcePath: string, timeout = 1000 * 60 * 2, force: boolean = false) {
|
async downloadMedia(msgId: string, chatType: ChatType, peerUid: string, elementId: string, thumbPath: string, sourcePath: string, timeout = 1000 * 60 * 2, force: boolean = false) {
|
||||||
//logDebug('receive downloadMedia task', msgId, chatType, peerUid, elementId, thumbPath, sourcePath, timeout, force);
|
//logDebug('receive downloadMedia task', msgId, chatType, peerUid, elementId, thumbPath, sourcePath, timeout, force);
|
||||||
// 用于下载收到的消息中的图片等
|
// 用于下载收到的消息中的图片等
|
||||||
if (sourcePath && fs.existsSync(sourcePath)) {
|
if (sourcePath && fs.existsSync(sourcePath)) {
|
||||||
@ -135,7 +138,7 @@ export class NTQQFileApi {
|
|||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getImageSize(filePath: string): Promise<ISizeCalculationResult | undefined> {
|
async getImageSize(filePath: string): Promise<ISizeCalculationResult | undefined> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
imageSize(filePath, (err, dimensions) => {
|
imageSize(filePath, (err, dimensions) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -146,7 +149,7 @@ export class NTQQFileApi {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async addFileCache(peer: Peer, msgId: string, msgSeq: string, senderUid: string, elemId: string, elemType: string, fileSize: string, fileName: string) {
|
async addFileCache(peer: Peer, msgId: string, msgSeq: string, senderUid: string, elemId: string, elemType: string, fileSize: string, fileName: string) {
|
||||||
let GroupData;
|
let GroupData;
|
||||||
let BuddyData;
|
let BuddyData;
|
||||||
if (peer.chatType === ChatType.group) {
|
if (peer.chatType === ChatType.group) {
|
||||||
@ -204,7 +207,7 @@ export class NTQQFileApi {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async searchfile(keys: string[]) {
|
async searchfile(keys: string[]) {
|
||||||
type EventType = NodeIKernelSearchService['searchFileWithKeywords'];
|
type EventType = NodeIKernelSearchService['searchFileWithKeywords'];
|
||||||
interface OnListener {
|
interface OnListener {
|
||||||
searchId: string,
|
searchId: string,
|
||||||
@ -256,7 +259,7 @@ export class NTQQFileApi {
|
|||||||
let [ret] = (await Listener);
|
let [ret] = (await Listener);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
async getImageUrl(element: PicElement) {
|
async getImageUrl(element: PicElement) {
|
||||||
if (!element) {
|
if (!element) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -274,7 +277,7 @@ export class NTQQFileApi {
|
|||||||
if (UrlRkey) {
|
if (UrlRkey) {
|
||||||
return IMAGE_HTTP_HOST_NT + url;
|
return IMAGE_HTTP_HOST_NT + url;
|
||||||
}
|
}
|
||||||
const rkeyData = await rkeyManager.getRkey();
|
const rkeyData = await this.rkeyManager.getRkey();
|
||||||
UrlRkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
UrlRkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
|
||||||
return IMAGE_HTTP_HOST_NT + url + `${UrlRkey}`;
|
return IMAGE_HTTP_HOST_NT + url + `${UrlRkey}`;
|
||||||
} else {
|
} else {
|
||||||
@ -297,48 +300,48 @@ export class NTQQFileCacheApi {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
async setCacheSilentScan(isSilent: boolean = true) {
|
async setCacheSilentScan(isSilent: boolean = true) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
getCacheSessionPathList() {
|
getCacheSessionPathList() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache(cacheKeys: Array<string> = ['tmp', 'hotUpdate']) {
|
clearCache(cacheKeys: Array<string> = ['tmp', 'hotUpdate']) {
|
||||||
// 参数未验证
|
// 参数未验证
|
||||||
return this.context.session.getStorageCleanService().clearCacheDataByKeys(cacheKeys);
|
return this.context.session.getStorageCleanService().clearCacheDataByKeys(cacheKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCacheScannedPaths(pathMap: object = {}) {
|
addCacheScannedPaths(pathMap: object = {}) {
|
||||||
return this.context.session.getStorageCleanService().addCacheScanedPaths(pathMap);
|
return this.context.session.getStorageCleanService().addCacheScanedPaths(pathMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
scanCache() {
|
scanCache() {
|
||||||
//return (await this.context.session.getStorageCleanService().scanCache()).size;
|
//return (await this.context.session.getStorageCleanService().scanCache()).size;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHotUpdateCachePath() {
|
getHotUpdateCachePath() {
|
||||||
// 未实现
|
// 未实现
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
getDesktopTmpPath() {
|
getDesktopTmpPath() {
|
||||||
// 未实现
|
// 未实现
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
getChatCacheList(type: ChatType, pageSize: number = 1000, pageIndex: number = 0) {
|
getChatCacheList(type: ChatType, pageSize: number = 1000, pageIndex: number = 0) {
|
||||||
return this.context.session.getStorageCleanService().getChatCacheInfo(type, pageSize, 1, pageIndex);
|
return this.context.session.getStorageCleanService().getChatCacheInfo(type, pageSize, 1, pageIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileCacheInfo(fileType: CacheFileType, pageSize: number = 1000, lastRecord?: CacheFileListItem) {
|
getFileCacheInfo(fileType: CacheFileType, pageSize: number = 1000, lastRecord?: CacheFileListItem) {
|
||||||
const _lastRecord = lastRecord ? lastRecord : { fileType: fileType };
|
const _lastRecord = lastRecord ? lastRecord : { fileType: fileType };
|
||||||
//需要五个参数
|
//需要五个参数
|
||||||
//return napCatCore.session.getStorageCleanService().getFileCacheInfo();
|
//return napCatCore.session.getStorageCleanService().getFileCacheInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clearChatCache(chats: ChatCacheListItemBasic[] = [], fileKeys: string[] = []) {
|
async clearChatCache(chats: ChatCacheListItemBasic[] = [], fileKeys: string[] = []) {
|
||||||
return this.context.session.getStorageCleanService().clearChatCacheInfo(chats, fileKeys);
|
return this.context.session.getStorageCleanService().clearChatCacheInfo(chats, fileKeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { ModifyProfileParams, SelfInfo, User, UserDetailInfoByUin, UserDetailInfoByUinV2 } from '@/core/entities';
|
import type { ModifyProfileParams, User, UserDetailInfoByUin, UserDetailInfoByUinV2 } from '@/core/entities';
|
||||||
import { NodeIKernelProfileListener, ProfileListener } from '@/core/listeners';
|
import { NodeIKernelProfileListener } from '@/core/listeners';
|
||||||
import { RequestUtil } from '@/common/utils/request';
|
import { RequestUtil } from '@/common/utils/request';
|
||||||
import { NodeIKernelProfileService, ProfileBizType, UserDetailSource } from '@/core/services';
|
import { NodeIKernelProfileService, ProfileBizType, UserDetailSource } from '@/core/services';
|
||||||
import { InstanceContext, NapCatCore } from '..';
|
import { InstanceContext, NapCatCore } from '..';
|
||||||
@ -11,7 +11,7 @@ export class NTQQUserApi {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
this.core = core;
|
this.core = core;
|
||||||
}
|
}
|
||||||
async getProfileLike(uid: string) {
|
async getProfileLike(uid: string) {
|
||||||
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
||||||
friendUids: [
|
friendUids: [
|
||||||
uid
|
uid
|
||||||
@ -25,16 +25,16 @@ export class NTQQUserApi {
|
|||||||
limit: 20
|
limit: 20
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async setLongNick(longNick: string) {
|
async setLongNick(longNick: string) {
|
||||||
return this.context.session.getProfileService().setLongNick(longNick);
|
return this.context.session.getProfileService().setLongNick(longNick);
|
||||||
}
|
}
|
||||||
async setSelfOnlineStatus(status: number, extStatus: number, batteryStatus: number) {
|
async setSelfOnlineStatus(status: number, extStatus: number, batteryStatus: number) {
|
||||||
return this.context.session.getMsgService().setStatus({ status: status, extStatus: extStatus, batteryStatus: batteryStatus });
|
return this.context.session.getMsgService().setStatus({ status: status, extStatus: extStatus, batteryStatus: batteryStatus });
|
||||||
}
|
}
|
||||||
async getBuddyRecommendContactArkJson(uin: string, sencenID = '') {
|
async getBuddyRecommendContactArkJson(uin: string, sencenID = '') {
|
||||||
return this.context.session.getBuddyService().getBuddyRecommendContactArkJson(uin, sencenID);
|
return this.context.session.getBuddyService().getBuddyRecommendContactArkJson(uin, sencenID);
|
||||||
}
|
}
|
||||||
async like(uid: string, count = 1): Promise<{ result: number, errMsg: string, succCounts: number }> {
|
async like(uid: string, count = 1): Promise<{ result: number, errMsg: string, succCounts: number }> {
|
||||||
return this.context.session.getProfileLikeService().setBuddyProfileLike({
|
return this.context.session.getProfileLikeService().setBuddyProfileLike({
|
||||||
friendUid: uid,
|
friendUid: uid,
|
||||||
sourceId: 71,
|
sourceId: 71,
|
||||||
@ -43,16 +43,16 @@ export class NTQQUserApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async setQQAvatar(filePath: string) {
|
async setQQAvatar(filePath: string) {
|
||||||
type setQQAvatarRet = { result: number, errMsg: string };
|
type setQQAvatarRet = { result: number, errMsg: string };
|
||||||
const ret = await this.context.session.getProfileService().setHeader(filePath) as setQQAvatarRet;
|
const ret = await this.context.session.getProfileService().setHeader(filePath) as setQQAvatarRet;
|
||||||
return { result: ret?.result, errMsg: ret?.errMsg };
|
return { result: ret?.result, errMsg: ret?.errMsg };
|
||||||
}
|
}
|
||||||
async setGroupAvatar(gc: string, filePath: string) {
|
async setGroupAvatar(gc: string, filePath: string) {
|
||||||
return this.context.session.getGroupService().setHeader(gc, filePath);
|
return this.context.session.getGroupService().setHeader(gc, filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchUserDetailInfos(uids: string[]) {
|
async fetchUserDetailInfos(uids: string[]) {
|
||||||
//26702 以上使用新接口 .Dev Mlikiowa
|
//26702 以上使用新接口 .Dev Mlikiowa
|
||||||
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
||||||
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
||||||
@ -90,7 +90,7 @@ export class NTQQUserApi {
|
|||||||
|
|
||||||
return retData;
|
return retData;
|
||||||
}
|
}
|
||||||
async fetchUserDetailInfo(uid: string) {
|
async fetchUserDetailInfo(uid: string) {
|
||||||
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
type EventService = NodeIKernelProfileService['fetchUserDetailInfo'];
|
||||||
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
type EventListener = NodeIKernelProfileListener['onUserDetailInfoChanged'];
|
||||||
let [_retData, profile] = await this.core.eventWrapper.CallNormalEvent
|
let [_retData, profile] = await this.core.eventWrapper.CallNormalEvent
|
||||||
@ -126,13 +126,13 @@ export class NTQQUserApi {
|
|||||||
};
|
};
|
||||||
return RetUser;
|
return RetUser;
|
||||||
}
|
}
|
||||||
async getUserDetailInfo(uid: string) {
|
async getUserDetailInfo(uid: string) {
|
||||||
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
||||||
return this.fetchUserDetailInfo(uid);
|
return this.fetchUserDetailInfo(uid);
|
||||||
}
|
}
|
||||||
return this.getUserDetailInfoOld(uid);
|
return this.getUserDetailInfoOld(uid);
|
||||||
}
|
}
|
||||||
async getUserDetailInfoOld(uid: string) {
|
async getUserDetailInfoOld(uid: string) {
|
||||||
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo'];
|
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo'];
|
||||||
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged'];
|
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged'];
|
||||||
let [_retData, profile] = await this.core.eventWrapper.CallNormalEvent
|
let [_retData, profile] = await this.core.eventWrapper.CallNormalEvent
|
||||||
@ -153,20 +153,20 @@ export class NTQQUserApi {
|
|||||||
);
|
);
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
async modifySelfProfile(param: ModifyProfileParams) {
|
async modifySelfProfile(param: ModifyProfileParams) {
|
||||||
return this.context.session.getProfileService().modifyDesktopMiniProfile(param);
|
return this.context.session.getProfileService().modifyDesktopMiniProfile(param);
|
||||||
}
|
}
|
||||||
//需要异常处理
|
//需要异常处理
|
||||||
async getCookies(domain: string) {
|
async getCookies(domain: string) {
|
||||||
const ClientKeyData = await this.forceFetchClientKey();
|
const ClientKeyData = await this.forceFetchClientKey();
|
||||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2F' + domain + '%2F' + selfInfo.uin + '%2Finfocenter&keyindex=19%27'
|
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2F' + domain + '%2F' + selfInfo.uin + '%2Finfocenter&keyindex=19%27'
|
||||||
let cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
let cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||||
return cookies;
|
return cookies;
|
||||||
}
|
}
|
||||||
async getPSkey(domainList: string[]) {
|
async getPSkey(domainList: string[]) {
|
||||||
return await this.context.session.getTipOffService().getPskey(domainList, true);
|
return await this.context.session.getTipOffService().getPskey(domainList, true);
|
||||||
}
|
}
|
||||||
async getRobotUinRange(): Promise<Array<any>> {
|
async getRobotUinRange(): Promise<Array<any>> {
|
||||||
const robotUinRanges = await this.context.session.getRobotService().getRobotUinRange({
|
const robotUinRanges = await this.context.session.getRobotService().getRobotUinRange({
|
||||||
justFetchMsgConfig: '1',
|
justFetchMsgConfig: '1',
|
||||||
type: 1,
|
type: 1,
|
||||||
@ -177,16 +177,16 @@ export class NTQQUserApi {
|
|||||||
return robotUinRanges?.response?.robotUinRanges;
|
return robotUinRanges?.response?.robotUinRanges;
|
||||||
}
|
}
|
||||||
//需要异常处理
|
//需要异常处理
|
||||||
|
|
||||||
async getQzoneCookies() {
|
async getQzoneCookies() {
|
||||||
const ClientKeyData = await this.forceFetchClientKey();
|
const ClientKeyData = await this.forceFetchClientKey();
|
||||||
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2Fuser.qzone.qq.com%2F' + selfInfo.uin + '%2Finfocenter&keyindex=19%27'
|
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2Fuser.qzone.qq.com%2F' + selfInfo.uin + '%2Finfocenter&keyindex=19%27'
|
||||||
let cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
let cookies: { [key: string]: string; } = await RequestUtil.HttpsGetCookies(requestUrl);
|
||||||
return cookies;
|
return cookies;
|
||||||
}
|
}
|
||||||
//需要异常处理
|
//需要异常处理
|
||||||
|
|
||||||
async getSkey(): Promise<string | undefined> {
|
async getSkey(): Promise<string | undefined> {
|
||||||
const ClientKeyData = await this.forceFetchClientKey();
|
const ClientKeyData = await this.forceFetchClientKey();
|
||||||
if (ClientKeyData.result !== 0) {
|
if (ClientKeyData.result !== 0) {
|
||||||
throw new Error('getClientKey Error');
|
throw new Error('getClientKey Error');
|
||||||
@ -201,14 +201,14 @@ export class NTQQUserApi {
|
|||||||
}
|
}
|
||||||
return skey;
|
return skey;
|
||||||
}
|
}
|
||||||
async getUidByUin(Uin: string) {
|
async getUidByUin(Uin: string) {
|
||||||
//此代码仅临时使用,后期会被废弃
|
//此代码仅临时使用,后期会被废弃
|
||||||
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
||||||
return await this..getUidByUinV2(Uin);
|
return await this..getUidByUinV2(Uin);
|
||||||
}
|
}
|
||||||
return await this.getUidByUinV1(Uin);
|
return await this.getUidByUinV1(Uin);
|
||||||
}
|
}
|
||||||
async getUinByUid(Uid: string) {
|
async getUinByUid(Uid: string) {
|
||||||
//此代码仅临时使用,后期会被废弃
|
//此代码仅临时使用,后期会被废弃
|
||||||
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) {
|
||||||
return await this.getUinByUidV2(Uid);
|
return await this.getUinByUidV2(Uid);
|
||||||
@ -217,7 +217,7 @@ export class NTQQUserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//后期改成流水线处理
|
//后期改成流水线处理
|
||||||
async getUidByUinV2(Uin: string) {
|
async getUidByUinV2(Uin: string) {
|
||||||
let uid = (await this.context.session.getProfileService().getUidByUin('FriendsServiceImpl', [Uin])).get(Uin);
|
let uid = (await this.context.session.getProfileService().getUidByUin('FriendsServiceImpl', [Uin])).get(Uin);
|
||||||
if (uid) return uid;
|
if (uid) return uid;
|
||||||
uid = (await this.context.session.getGroupService().getUidByUins([Uin])).uids.get(Uin);
|
uid = (await this.context.session.getGroupService().getUidByUins([Uin])).uids.get(Uin);
|
||||||
@ -235,7 +235,7 @@ export class NTQQUserApi {
|
|||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
//后期改成流水线处理
|
//后期改成流水线处理
|
||||||
async getUinByUidV2(Uid: string) {
|
async getUinByUidV2(Uid: string) {
|
||||||
let uin = (await this.context.session.getProfileService().getUinByUid('FriendsServiceImpl', [Uid])).get(Uid);
|
let uin = (await this.context.session.getProfileService().getUinByUid('FriendsServiceImpl', [Uid])).get(Uid);
|
||||||
if (uin) return uin;
|
if (uin) return uin;
|
||||||
uin = (await this.context.session.getGroupService().getUinByUids([Uid])).uins.get(Uid);
|
uin = (await this.context.session.getGroupService().getUinByUids([Uid])).uins.get(Uid);
|
||||||
@ -250,7 +250,7 @@ export class NTQQUserApi {
|
|||||||
return uin;
|
return uin;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUidByUinV1(Uin: string) {
|
async getUidByUinV1(Uin: string) {
|
||||||
// 通用转换开始尝试
|
// 通用转换开始尝试
|
||||||
let uid = (await this.context.session.getUixConvertService().getUid([Uin])).uidInfo.get(Uin);
|
let uid = (await this.context.session.getUixConvertService().getUid([Uin])).uidInfo.get(Uin);
|
||||||
// Uid 好友转
|
// Uid 好友转
|
||||||
@ -279,7 +279,7 @@ export class NTQQUserApi {
|
|||||||
}
|
}
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
async getUinByUidV1(Uid: string) {
|
async getUinByUidV1(Uid: string) {
|
||||||
let ret = await this.core.eventWrapper.callNoListenerEvent
|
let ret = await this.core.eventWrapper.callNoListenerEvent
|
||||||
<(Uin: string[]) => Promise<{ uinInfo: Map<string, string> }>>(
|
<(Uin: string[]) => Promise<{ uinInfo: Map<string, string> }>>(
|
||||||
'NodeIKernelUixConvertService/getUin',
|
'NodeIKernelUixConvertService/getUin',
|
||||||
@ -307,19 +307,19 @@ export class NTQQUserApi {
|
|||||||
// }
|
// }
|
||||||
return uin;
|
return uin;
|
||||||
}
|
}
|
||||||
async getRecentContactListSnapShot(count: number) {
|
async getRecentContactListSnapShot(count: number) {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactListSnapShot(count);
|
return await this.context.session.getRecentContactService().getRecentContactListSnapShot(count);
|
||||||
}
|
}
|
||||||
async getRecentContactListSyncLimit(count: number) {
|
async getRecentContactListSyncLimit(count: number) {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactListSyncLimit(count);
|
return await this.context.session.getRecentContactService().getRecentContactListSyncLimit(count);
|
||||||
}
|
}
|
||||||
async getRecentContactListSync() {
|
async getRecentContactListSync() {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactListSync();
|
return await this.context.session.getRecentContactService().getRecentContactListSync();
|
||||||
}
|
}
|
||||||
async getRecentContactList() {
|
async getRecentContactList() {
|
||||||
return await this.context.session.getRecentContactService().getRecentContactList();
|
return await this.context.session.getRecentContactService().getRecentContactList();
|
||||||
}
|
}
|
||||||
async getUserDetailInfoByUinV2(Uin: string) {
|
async getUserDetailInfoByUinV2(Uin: string) {
|
||||||
return await this.core.eventWrapper.callNoListenerEvent
|
return await this.core.eventWrapper.callNoListenerEvent
|
||||||
<(Uin: string) => Promise<UserDetailInfoByUinV2>>(
|
<(Uin: string) => Promise<UserDetailInfoByUinV2>>(
|
||||||
'NodeIKernelProfileService/getUserDetailInfoByUin',
|
'NodeIKernelProfileService/getUserDetailInfoByUin',
|
||||||
@ -327,7 +327,7 @@ export class NTQQUserApi {
|
|||||||
Uin
|
Uin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
async getUserDetailInfoByUin(Uin: string) {
|
async getUserDetailInfoByUin(Uin: string) {
|
||||||
return this.core.eventWrapper.callNoListenerEvent
|
return this.core.eventWrapper.callNoListenerEvent
|
||||||
<(Uin: string) => Promise<UserDetailInfoByUin>>(
|
<(Uin: string) => Promise<UserDetailInfoByUin>>(
|
||||||
'NodeIKernelProfileService/getUserDetailInfoByUin',
|
'NodeIKernelProfileService/getUserDetailInfoByUin',
|
||||||
@ -335,7 +335,7 @@ export class NTQQUserApi {
|
|||||||
Uin
|
Uin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
async forceFetchClientKey() {
|
async forceFetchClientKey() {
|
||||||
return await this.context.session.getTicketService().forceFetchClientKey('');
|
return await this.context.session.getTicketService().forceFetchClientKey('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ interface ServerRkeyData {
|
|||||||
expired_time: number;
|
expired_time: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
class RkeyManager {
|
export class RkeyManager {
|
||||||
serverUrl: string = '';
|
serverUrl: string = '';
|
||||||
private rkeyData: ServerRkeyData = {
|
private rkeyData: ServerRkeyData = {
|
||||||
group_rkey: '',
|
group_rkey: '',
|
||||||
|
Loading…
Reference in New Issue
Block a user