mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 06:31:13 +00:00
feat: Support custom filename and cover image for Flash Transfer (#1544)
* feat: support thumbnail for flash-transfer * fix: fix get thumbnail path unknown type error * Refactor flash module types and enums Standardized TypeScript interface property formatting in flash.ts, flash data, and wrapper files. Introduced the UploadSceneType enum for upload scene types, replacing hardcoded numeric values. Improved type annotations and consistency across the flash API and related data structures. * Update arg type in NodeQQNTWrapperUtil interface Changed the type of the 'arg' parameter in the NodeQQNTWrapperUtil interface from optional number to 'number | null | undefined' for improved type clarity. * Refactor flash scene type and update method params Introduced BusiScene enum for sceneType in FileListInfoRequests to improve type safety. Renamed parameters in getFileThumbSavePathForSend for better clarity. * Refactor downloadSceneType to use enum type Replaced numeric downloadSceneType fields with the DownloadSceneType enum in relevant interfaces. Updated NodeIKernelFlashTransferService method signatures to use DownloadSceneType for download operations, improving type safety and code clarity. * refactor: remove thumbnail dependency for QQ resource icons * fix: remove useless console.log --------- Co-authored-by: 手瓜一十雪 <nanaeonn@outlook.com>
This commit is contained in:
parent
3c24d6b700
commit
246269b519
@ -4,6 +4,7 @@ import {
|
||||
FileListResponse,
|
||||
FlashFileSetInfo,
|
||||
SendStatus,
|
||||
UploadSceneType,
|
||||
} from '@/napcat-core/data/flash';
|
||||
import { Peer } from '@/napcat-core/types';
|
||||
|
||||
@ -19,25 +20,44 @@ export class NTQQFlashApi {
|
||||
/**
|
||||
* 发起闪传上传任务
|
||||
* @param fileListToUpload 上传文件绝对路径的列表,可以是文件夹!!
|
||||
* @param thumbnailPath
|
||||
* @param filesetName
|
||||
*/
|
||||
async createFlashTransferUploadTask (fileListToUpload: string[]): Promise < GeneralCallResult & {
|
||||
async createFlashTransferUploadTask (fileListToUpload: string[], thumbnailPath: string, filesetName: string): Promise<GeneralCallResult & {
|
||||
createFlashTransferResult: createFlashTransferResult;
|
||||
seq: number;
|
||||
} > {
|
||||
}> {
|
||||
const flashService = this.context.session.getFlashTransferService();
|
||||
|
||||
const timestamp : number = Date.now();
|
||||
const timestamp: number = Date.now();
|
||||
const selfInfo = this.core.selfInfo;
|
||||
|
||||
const fileUploadArg = {
|
||||
screen: 1, // 1
|
||||
name: filesetName,
|
||||
uploaders: [{
|
||||
uin: selfInfo.uin,
|
||||
uid: selfInfo.uid,
|
||||
sendEntrance: '',
|
||||
nickname: selfInfo.nick,
|
||||
}],
|
||||
coverPath: thumbnailPath,
|
||||
paths: fileListToUpload,
|
||||
excludePaths: [],
|
||||
expireLeftTime: 0,
|
||||
isNeedDelDeviceInfo: false,
|
||||
isNeedDelLocation: false,
|
||||
coverOriginalInfos: [
|
||||
{
|
||||
path: fileListToUpload[0] || '',
|
||||
thumbnailPath,
|
||||
},
|
||||
],
|
||||
uploadSceneType: UploadSceneType.KUPLOADSCENEAIOFILESELECTOR, // 不知道怎么枚举 先硬编码吧 (PC QQ 10)
|
||||
detectPrivacyInfoResult: {
|
||||
exists: false,
|
||||
allDetectResults: new Map(),
|
||||
},
|
||||
};
|
||||
|
||||
const uploadResult = await flashService.createFlashTransferUploadTask(timestamp, fileUploadArg);
|
||||
@ -54,9 +74,9 @@ export class NTQQFlashApi {
|
||||
* 下载闪传文件集
|
||||
* @param fileSetId
|
||||
*/
|
||||
async downloadFileSetBySetId (fileSetId: string): Promise < GeneralCallResult & {
|
||||
extraInfo: unknown
|
||||
} > {
|
||||
async downloadFileSetBySetId (fileSetId: string): Promise<GeneralCallResult & {
|
||||
extraInfo: unknown;
|
||||
}> {
|
||||
const flashService = this.context.session.getFlashTransferService();
|
||||
|
||||
const result = await flashService.startFileSetDownload(fileSetId, 1, { isIncludeCompressInnerFiles: false }); // 为了方便,暂时硬编码
|
||||
@ -72,7 +92,7 @@ export class NTQQFlashApi {
|
||||
* 获取闪传的外链分享
|
||||
* @param fileSetId
|
||||
*/
|
||||
async getShareLinkBySetId (fileSetId: string): Promise < GeneralCallResult & {
|
||||
async getShareLinkBySetId (fileSetId: string): Promise<GeneralCallResult & {
|
||||
shareLink: string;
|
||||
expireTimestamp: string;
|
||||
}> {
|
||||
@ -91,9 +111,9 @@ export class NTQQFlashApi {
|
||||
* 从分享外链获取文件集id
|
||||
* @param shareCode
|
||||
*/
|
||||
async fromShareLinkFindSetId (shareCode: string): Promise < GeneralCallResult & {
|
||||
async fromShareLinkFindSetId (shareCode: string): Promise<GeneralCallResult & {
|
||||
fileSetId: string;
|
||||
} > {
|
||||
}> {
|
||||
const flashService = this.context.session.getFlashTransferService();
|
||||
|
||||
const result = await flashService.getFileSetIdByCode(shareCode);
|
||||
@ -110,7 +130,7 @@ export class NTQQFlashApi {
|
||||
* == 注意返回结构和其它的不同,没有GeneralCallResult!!! ==
|
||||
* @param fileSetId
|
||||
*/
|
||||
async getFileListBySetId (fileSetId: string): Promise < FileListResponse > {
|
||||
async getFileListBySetId (fileSetId: string): Promise<FileListResponse> {
|
||||
const flashService = this.context.session.getFlashTransferService();
|
||||
|
||||
const requestArg = {
|
||||
@ -153,11 +173,11 @@ export class NTQQFlashApi {
|
||||
* 获取闪传文件集合信息
|
||||
* @param fileSetId
|
||||
*/
|
||||
async getFileSetIndoBySetId (fileSetId: string): Promise < GeneralCallResult & {
|
||||
async getFileSetIndoBySetId (fileSetId: string): Promise<GeneralCallResult & {
|
||||
seq: number;
|
||||
isCache: boolean;
|
||||
fileSet: FlashFileSetInfo;
|
||||
} > {
|
||||
}> {
|
||||
const flashService = this.context.session.getFlashTransferService();
|
||||
|
||||
const requestArg = {
|
||||
@ -178,13 +198,13 @@ export class NTQQFlashApi {
|
||||
* @param fileSetId
|
||||
* @param peer
|
||||
*/
|
||||
async sendFlashMessage (fileSetId: string, peer:Peer): Promise < {
|
||||
async sendFlashMessage (fileSetId: string, peer: Peer): Promise<{
|
||||
errCode: number,
|
||||
errMsg: string,
|
||||
rsp: {
|
||||
sendStatus: SendStatus[]
|
||||
}
|
||||
} > {
|
||||
sendStatus: SendStatus[];
|
||||
};
|
||||
}> {
|
||||
const flashService = this.context.session.getFlashTransferService();
|
||||
|
||||
const target = {
|
||||
@ -212,9 +232,9 @@ export class NTQQFlashApi {
|
||||
* @param fileSetId
|
||||
* @param options
|
||||
*/
|
||||
async getFileTransUrl (fileSetId: string, options: { fileName?: string; fileIndex?: number }): Promise < GeneralCallResult & {
|
||||
async getFileTransUrl (fileSetId: string, options: { fileName?: string; fileIndex?: number; }): Promise<GeneralCallResult & {
|
||||
transferUrl: string;
|
||||
} > {
|
||||
}> {
|
||||
const flashService = this.context.session.getFlashTransferService();
|
||||
const result = await this.getFileListBySetId(fileSetId);
|
||||
|
||||
@ -261,4 +281,27 @@ export class NTQQFlashApi {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async createFileThumbnail (filePath: string): Promise<any> {
|
||||
const msgService = this.context.session.getMsgService();
|
||||
const savePath = msgService.getFileThumbSavePathForSend(750, true);
|
||||
|
||||
const result = await this.core.util.createThumbnailImage(
|
||||
'flashtransfer',
|
||||
filePath,
|
||||
savePath,
|
||||
{
|
||||
width: 520,
|
||||
height: 520,
|
||||
},
|
||||
'jpeg',
|
||||
null
|
||||
);
|
||||
if (result.result === 0) {
|
||||
this.context.logger.log('获取缩略图成功!!');
|
||||
result.targetPath = savePath;
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export interface FlashBaseRequest {
|
||||
fileSetId: string
|
||||
fileSetId: string;
|
||||
}
|
||||
|
||||
export interface UploaderInfo {
|
||||
@ -19,14 +19,14 @@ export interface thumbnailInfo {
|
||||
}
|
||||
|
||||
export interface SendTarget {
|
||||
destType: number // 1私聊
|
||||
destType: number; // 1私聊
|
||||
destUin?: string,
|
||||
destUid: string,
|
||||
}
|
||||
|
||||
export interface SendTargetRequests {
|
||||
fileSetId: string
|
||||
targets: SendTarget[]
|
||||
fileSetId: string;
|
||||
targets: SendTarget[];
|
||||
}
|
||||
|
||||
export interface DownloadStatusInfo {
|
||||
@ -53,13 +53,13 @@ export interface DownloadStatusInfo {
|
||||
isAllFileAlreadyDownloaded: boolean,
|
||||
saveFileSetDir: string,
|
||||
allWaitingStatusTask: boolean,
|
||||
downloadSceneType: number,
|
||||
downloadSceneType: DownloadSceneType,
|
||||
retryCount: number,
|
||||
statisticInfo: {
|
||||
downloadTaskId: string,
|
||||
downloadFilesetName: string,
|
||||
downloadFileTypeDistribution: string,
|
||||
downloadFileSizeDistribution: string
|
||||
downloadFileSizeDistribution: string;
|
||||
},
|
||||
albumStorageFailImageNum: number,
|
||||
albumStorageFailVideoNum: number,
|
||||
@ -67,8 +67,8 @@ export interface DownloadStatusInfo {
|
||||
albumStorageSucImageNum: number,
|
||||
albumStorageSucVideoNum: number,
|
||||
albumStorageSucFileIdList: [],
|
||||
albumStorageFileNum: number
|
||||
}
|
||||
albumStorageFileNum: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface physicalInfo {
|
||||
@ -95,94 +95,94 @@ export interface uploadInfo {
|
||||
svrRrrCode: number,
|
||||
errMsg: string,
|
||||
isNeedDelDeviceInfo: boolean,
|
||||
thumbnailUploadState: number
|
||||
thumbnailUploadState: number;
|
||||
isSecondHit: boolean,
|
||||
hasModifiedErr: boolean,
|
||||
}
|
||||
|
||||
export interface folderUploadInfo {
|
||||
totalUploadedFileSize: string
|
||||
successCount: number
|
||||
failedCount: number
|
||||
totalUploadedFileSize: string;
|
||||
successCount: number;
|
||||
failedCount: number;
|
||||
}
|
||||
|
||||
export interface folderDownloadInfo {
|
||||
totalDownloadedFileSize: string
|
||||
totalFileSize: string
|
||||
totalDownloadFileCount: number
|
||||
successCount: number
|
||||
failedCount: number
|
||||
pausedCount: number
|
||||
cancelCount: number
|
||||
downloadingCount: number
|
||||
partialDownloadCount: number
|
||||
curLevelDownloadedFileCount: number
|
||||
curLevelUnDownloadedFileCount: number
|
||||
totalDownloadedFileSize: string;
|
||||
totalFileSize: string;
|
||||
totalDownloadFileCount: number;
|
||||
successCount: number;
|
||||
failedCount: number;
|
||||
pausedCount: number;
|
||||
cancelCount: number;
|
||||
downloadingCount: number;
|
||||
partialDownloadCount: number;
|
||||
curLevelDownloadedFileCount: number;
|
||||
curLevelUnDownloadedFileCount: number;
|
||||
}
|
||||
|
||||
export interface compressFileFolderInfo {
|
||||
downloadStatus: number
|
||||
saveFileDirPath: string
|
||||
totalFileCount: string
|
||||
totalFileSize: string
|
||||
downloadStatus: number;
|
||||
saveFileDirPath: string;
|
||||
totalFileCount: string;
|
||||
totalFileSize: string;
|
||||
}
|
||||
|
||||
export interface albumStorgeInfo {
|
||||
status: number
|
||||
localIdentifier: string
|
||||
errorCode: number
|
||||
timeCost: number
|
||||
status: number;
|
||||
localIdentifier: string;
|
||||
errorCode: number;
|
||||
timeCost: number;
|
||||
}
|
||||
|
||||
export interface FlashOneFileInfo {
|
||||
fileSetId: string
|
||||
cliFileId: string // client?? 或许可以换取url
|
||||
compressedFileFolderId: string
|
||||
archiveIndex: 0
|
||||
indexPath: string
|
||||
isDir: boolean // 文件或者文件夹!!
|
||||
parentId: string
|
||||
depth: number // 1
|
||||
cliFileIndex: number
|
||||
fileType: number // 枚举!! 已完成枚举!!
|
||||
name: string
|
||||
namePinyin: string
|
||||
isCover: boolean
|
||||
isCoverOriginal: boolean
|
||||
fileSize: string
|
||||
fileCount: number
|
||||
thumbnail: thumbnailInfo
|
||||
physical: physicalInfo
|
||||
srvFileId: string // service?? 服务器上面的id吗?
|
||||
srvParentFileId: string
|
||||
svrLastUpdateTimestamp: string
|
||||
downloadInfo: downloadInfo
|
||||
saveFilePath: string
|
||||
search_relative_path: string
|
||||
disk_relative_path: string
|
||||
uploadInfo: uploadInfo
|
||||
status: number
|
||||
uploadStatus: number // 3已上传成功
|
||||
downloadStatus: number // 0未下载
|
||||
folderUploadInfo: folderUploadInfo
|
||||
folderDownloadInfo: folderDownloadInfo
|
||||
sha1: string
|
||||
bookmark: string
|
||||
compressFileFolderInfo: compressFileFolderInfo
|
||||
uploadPauseReason: string
|
||||
downloadPauseReason: string
|
||||
filePhysicalSize: string
|
||||
thumbnail_sha1: string | null
|
||||
thumbnail_size: string | null
|
||||
needAlbumStorage: boolean
|
||||
albumStorageInfo: albumStorgeInfo
|
||||
fileSetId: string;
|
||||
cliFileId: string; // client?? 或许可以换取url
|
||||
compressedFileFolderId: string;
|
||||
archiveIndex: 0;
|
||||
indexPath: string;
|
||||
isDir: boolean; // 文件或者文件夹!!
|
||||
parentId: string;
|
||||
depth: number; // 1
|
||||
cliFileIndex: number;
|
||||
fileType: number; // 枚举!! 已完成枚举!!
|
||||
name: string;
|
||||
namePinyin: string;
|
||||
isCover: boolean;
|
||||
isCoverOriginal: boolean;
|
||||
fileSize: string;
|
||||
fileCount: number;
|
||||
thumbnail: thumbnailInfo;
|
||||
physical: physicalInfo;
|
||||
srvFileId: string; // service?? 服务器上面的id吗?
|
||||
srvParentFileId: string;
|
||||
svrLastUpdateTimestamp: string;
|
||||
downloadInfo: downloadInfo;
|
||||
saveFilePath: string;
|
||||
search_relative_path: string;
|
||||
disk_relative_path: string;
|
||||
uploadInfo: uploadInfo;
|
||||
status: number;
|
||||
uploadStatus: number; // 3已上传成功
|
||||
downloadStatus: number; // 0未下载
|
||||
folderUploadInfo: folderUploadInfo;
|
||||
folderDownloadInfo: folderDownloadInfo;
|
||||
sha1: string;
|
||||
bookmark: string;
|
||||
compressFileFolderInfo: compressFileFolderInfo;
|
||||
uploadPauseReason: string;
|
||||
downloadPauseReason: string;
|
||||
filePhysicalSize: string;
|
||||
thumbnail_sha1: string | null;
|
||||
thumbnail_size: string | null;
|
||||
needAlbumStorage: boolean;
|
||||
albumStorageInfo: albumStorgeInfo;
|
||||
}
|
||||
|
||||
export interface fileListsInfo {
|
||||
parentId: string,
|
||||
depth: number, // 1
|
||||
fileList: FlashOneFileInfo[],
|
||||
paginationInfo: {}
|
||||
paginationInfo: {};
|
||||
isEnd: boolean,
|
||||
isCache: boolean,
|
||||
}
|
||||
@ -200,30 +200,50 @@ export interface createFlashTransferResult {
|
||||
expireTime: string,
|
||||
expireLeftTime: string,
|
||||
}
|
||||
|
||||
export enum UploadSceneType {
|
||||
KUPLOADSCENEUNKNOWN,
|
||||
KUPLOADSCENEFLOATWINDOWRIGHTCLICKMENU,
|
||||
KUPLOADSCENEFLOATWINDOWDRAG,
|
||||
KUPLOADSCENEFLOATWINDOWFILESELECTOR,
|
||||
KUPLOADSCENEFLOATWINDOWSHORTCUTKEYCTRLCV,
|
||||
KUPLOADSCENEH5LAUNCHCLIENTRIGHTCLICKMENU,
|
||||
KUPLOADSCENEH5LAUNCHCLIENTDRAG,
|
||||
KUPLOADSCENEH5LAUNCHCLIENTFILESELECTOR,
|
||||
KUPLOADSCENEH5LAUNCHCLIENTSHORTCUTKEYCTRLCV,
|
||||
KUPLOADSCENEAIODRAG,
|
||||
KUPLOADSCENEAIOFILESELECTOR,
|
||||
KUPLOADSCENEAIOSHORTCUTKEYCTRLCV
|
||||
}
|
||||
export interface StartFlashTaskRequests {
|
||||
screen?: number; // 1 PC-QQ
|
||||
screen: number; // 1 PC-QQ
|
||||
name?: string;
|
||||
uploaders: UploaderInfo[];
|
||||
permission?: {};
|
||||
coverPath?: string;
|
||||
paths: string[]; // 文件的绝对路径,可以是文件夹
|
||||
// excludePaths: [];
|
||||
// expireLeftTime: 0,
|
||||
// isNeedDelDeviceInfo: boolean,
|
||||
// isNeedDelLocation: boolean,
|
||||
// coverOriginalInfos: [],
|
||||
// uploadSceneType: 10, // 不知道怎么枚举 先硬编码吧
|
||||
// detectPrivacyInfoResult: {
|
||||
// exists: boolean,
|
||||
// allDetectResults: {}
|
||||
// }
|
||||
excludePaths?: string[];
|
||||
expireLeftTime?: number, // 0
|
||||
isNeedDelDeviceInfo: boolean,
|
||||
isNeedDelLocation: boolean,
|
||||
coverOriginalInfos?: {
|
||||
path: string,
|
||||
thumbnailPath: string,
|
||||
}[],
|
||||
uploadSceneType: UploadSceneType, // 不知道怎么枚举 先硬编码吧 (PC QQ 10)
|
||||
detectPrivacyInfoResult: {
|
||||
exists: boolean,
|
||||
allDetectResults: {};
|
||||
};
|
||||
}
|
||||
export enum BusiScene {
|
||||
KBUSISCENEINVALID,
|
||||
KBUSISCENEFLASHSCENE
|
||||
}
|
||||
|
||||
export interface FileListInfoRequests {
|
||||
seq: number, // 0
|
||||
fileSetId: string,
|
||||
isUseCache: boolean,
|
||||
sceneType: number, // 1
|
||||
sceneType: BusiScene, // 1
|
||||
reqInfos: {
|
||||
count: number, // 18 ?? 硬编码吧 不懂
|
||||
paginationInfo: {},
|
||||
@ -238,10 +258,24 @@ export interface FileListInfoRequests {
|
||||
sortField: number,
|
||||
sortOrder: number,
|
||||
}[],
|
||||
isNeedPhysicalInfoReady: boolean
|
||||
}[]
|
||||
isNeedPhysicalInfoReady: boolean;
|
||||
}[];
|
||||
}
|
||||
export enum DownloadSceneType {
|
||||
KDOWNLOADSCENEUNKNOWN,
|
||||
KDOWNLOADSCENEARKC2C,
|
||||
KDOWNLOADSCENEARKC2CDETAILPAGE,
|
||||
KDOWNLOADSCENEARKGROUP,
|
||||
KDOWNLOADSCENEARKGROUPDETAILPAGE,
|
||||
KDOWNLOADSCENELINKC2C,
|
||||
KDOWNLOADSCENELINKGROUP,
|
||||
KDOWNLOADSCENELINKCHANNEL,
|
||||
KDOWNLOADSCENELINKTEMPCHAT,
|
||||
KDOWNLOADSCENELINKOTHERINQQ,
|
||||
KDOWNLOADSCENESCANQRCODE,
|
||||
KDWONLOADSCENEFLASHTRANSFERCENTERCLIENT,
|
||||
KDWONLOADSCENEFLASHTRANSFERCENTERSCHEMA
|
||||
}
|
||||
|
||||
export interface FlashFileSetInfo {
|
||||
fileSetId: string,
|
||||
name: string,
|
||||
@ -258,23 +292,23 @@ export interface FlashFileSetInfo {
|
||||
urls: [
|
||||
{
|
||||
spec: number, // 2
|
||||
url: string
|
||||
url: string;
|
||||
}
|
||||
],
|
||||
localCachePath: string
|
||||
localCachePath: string;
|
||||
},
|
||||
uploaders: [
|
||||
{
|
||||
uin: string,
|
||||
nickname: string,
|
||||
uid: string,
|
||||
sendEntrance: string
|
||||
sendEntrance: string;
|
||||
}
|
||||
],
|
||||
expireLeftTime: number,
|
||||
aiClusteringStatus: {
|
||||
firstClusteringList: [],
|
||||
shouldPull: boolean
|
||||
shouldPull: boolean;
|
||||
},
|
||||
createTime: number,
|
||||
expireTime: number,
|
||||
@ -284,7 +318,7 @@ export interface FlashFileSetInfo {
|
||||
uploadInfo: {
|
||||
totalUploadedFileSize: number,
|
||||
successCount: number,
|
||||
failedCount: number
|
||||
failedCount: number;
|
||||
},
|
||||
downloadInfo: {
|
||||
totalDownloadedFileSize: 0,
|
||||
@ -296,7 +330,7 @@ export interface FlashFileSetInfo {
|
||||
cancelCount: 0,
|
||||
status: 0,
|
||||
curLevelDownloadedFileCount: number,
|
||||
curLevelUnDownloadedFileCount: 0
|
||||
curLevelUnDownloadedFileCount: 0;
|
||||
},
|
||||
transferType: number,
|
||||
isLocalCreate: true,
|
||||
@ -306,12 +340,12 @@ export interface FlashFileSetInfo {
|
||||
downloadStatus: 0,
|
||||
downloadPauseReason: 0,
|
||||
saveFileSetDir: string,
|
||||
uploadSceneType: 10,
|
||||
downloadSceneType: 0, // 0 PC-QQ 103 web
|
||||
uploadSceneType: UploadSceneType,
|
||||
downloadSceneType: DownloadSceneType, // 0 PC-QQ 103 web
|
||||
retryCount: number,
|
||||
isMergeShareUpload: 0,
|
||||
isRemoveDeviceInfo: boolean,
|
||||
isRemoveLocation: boolean
|
||||
isRemoveLocation: boolean;
|
||||
}
|
||||
|
||||
export interface SendStatus {
|
||||
@ -320,5 +354,5 @@ export interface SendStatus {
|
||||
target: {
|
||||
destType: number,
|
||||
destUid: string,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -74,6 +74,7 @@ export function loadQQWrapper (execPath: string | undefined, QQVersion: string):
|
||||
}
|
||||
const nativemodule: { exports: WrapperNodeApi; } = { exports: {} as WrapperNodeApi };
|
||||
process.dlopen(nativemodule, wrapperNodePath);
|
||||
process.env['NAPCAT_WRAPPER_PATH'] = wrapperNodePath;
|
||||
return nativemodule.exports;
|
||||
}
|
||||
export function getMajorPath (execPath: string, QQVersion: string): string {
|
||||
|
||||
@ -10,6 +10,7 @@ import {
|
||||
DownloadStatusInfo,
|
||||
SendTargetRequests,
|
||||
FlashOneFileInfo,
|
||||
DownloadSceneType,
|
||||
} from '../data/flash';
|
||||
|
||||
export interface NodeIKernelFlashTransferService {
|
||||
@ -18,48 +19,48 @@ export interface NodeIKernelFlashTransferService {
|
||||
* @param timestamp
|
||||
* @param fileInfo
|
||||
*/
|
||||
createFlashTransferUploadTask(timestamp: number, fileInfo: StartFlashTaskRequests): Promise < GeneralCallResult & {
|
||||
createFlashTransferUploadTask (timestamp: number, fileInfo: StartFlashTaskRequests): Promise<GeneralCallResult & {
|
||||
createFlashTransferResult: createFlashTransferResult;
|
||||
seq: number;
|
||||
} >; // 2 arg 重点 // 自动上传
|
||||
}>; // 2 arg 重点 // 自动上传
|
||||
|
||||
createMergeShareTask(...args: unknown[]): unknown; // 2 arg
|
||||
createMergeShareTask (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
updateFlashTransfer(...args: unknown[]): unknown; // 2 arg
|
||||
updateFlashTransfer (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
getFileSetList(...args: unknown[]): unknown; // 1 arg
|
||||
getFileSetList (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
getFileSetListCount(...args: unknown[]): unknown; // 1 arg
|
||||
getFileSetListCount (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
/**
|
||||
* 获取file set 的信息
|
||||
* @param fileSetIdDict
|
||||
*/
|
||||
getFileSet(fileSetIdDict: FlashBaseRequest): Promise < GeneralCallResult & {
|
||||
getFileSet (fileSetIdDict: FlashBaseRequest): Promise<GeneralCallResult & {
|
||||
seq: number;
|
||||
isCache: boolean;
|
||||
fileSet: FlashFileSetInfo;
|
||||
} >; // 1 arg
|
||||
}>; // 1 arg
|
||||
|
||||
/**
|
||||
* 获取file set 里面的文件信息(文件夹结构)
|
||||
* @param requestArgs
|
||||
*/
|
||||
getFileList(requestArgs: FileListInfoRequests): Promise < {
|
||||
getFileList (requestArgs: FileListInfoRequests): Promise<{
|
||||
rsp: FileListResponse;
|
||||
} > ; // 1 arg 这个方法QQ有bug??? 并没有,是我参数有问题
|
||||
}>; // 1 arg 这个方法QQ有bug??? 并没有,是我参数有问题
|
||||
|
||||
getDownloadedFileCount(...args: unknown[]): unknown; // 1 arg
|
||||
getDownloadedFileCount (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
getLocalFileList(...args: unknown[]): unknown; // 3 arg
|
||||
getLocalFileList (...args: unknown[]): unknown; // 3 arg
|
||||
|
||||
batchRemoveUserFileSetHistory(...args: unknown[]): unknown; // 1 arg
|
||||
batchRemoveUserFileSetHistory (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
/**
|
||||
* 获取分享链接
|
||||
* @param fileSetId
|
||||
*/
|
||||
getShareLinkReq(fileSetId:string): Promise< GeneralCallResult & {
|
||||
getShareLinkReq (fileSetId: string): Promise<GeneralCallResult & {
|
||||
shareLink: string;
|
||||
expireTimestamp: string;
|
||||
}>;
|
||||
@ -68,235 +69,235 @@ export interface NodeIKernelFlashTransferService {
|
||||
* 由分享链接到fileSetId
|
||||
* @param shareCode
|
||||
*/
|
||||
getFileSetIdByCode(shareCode: string): Promise < GeneralCallResult & {
|
||||
getFileSetIdByCode (shareCode: string): Promise<GeneralCallResult & {
|
||||
fileSetId: string;
|
||||
} > ; // 1 arg code == share code
|
||||
}>; // 1 arg code == share code
|
||||
|
||||
batchRemoveFile(...args: unknown[]): unknown; // 1 arg
|
||||
batchRemoveFile (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
checkUploadPathValid(...args: unknown[]): unknown; // 1 arg
|
||||
checkUploadPathValid (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
cleanFailedFiles(...args: unknown[]): unknown; // 2 arg
|
||||
cleanFailedFiles (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
/**
|
||||
* 暂停所有的任务
|
||||
*/
|
||||
resumeAllUnfinishedTasks(): unknown; // 0 arg !!
|
||||
resumeAllUnfinishedTasks (): unknown; // 0 arg !!
|
||||
|
||||
addFileSetUploadListener(...args: unknown[]): unknown; // 1 arg
|
||||
addFileSetUploadListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeFileSetUploadListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeFileSetUploadListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
/**
|
||||
* 开始上传任务 适用于已暂停的
|
||||
* @param fileSetId
|
||||
*/
|
||||
startFileSetUpload(fileSetId: string): void; // 1 arg 并不是新建任务,应该是暂停后的启动
|
||||
startFileSetUpload (fileSetId: string): void; // 1 arg 并不是新建任务,应该是暂停后的启动
|
||||
|
||||
/**
|
||||
* 结束,无法再次启动
|
||||
* @param fileSetId
|
||||
*/
|
||||
stopFileSetUpload(fileSetId: string): void; // 1 arg stop 后start无效
|
||||
stopFileSetUpload (fileSetId: string): void; // 1 arg stop 后start无效
|
||||
|
||||
/**
|
||||
* 暂停上传
|
||||
* @param fileSetId
|
||||
*/
|
||||
pauseFileSetUpload(fileSetId: string): void; // 1 arg 暂停上传
|
||||
pauseFileSetUpload (fileSetId: string): void; // 1 arg 暂停上传
|
||||
|
||||
/**
|
||||
* 继续上传
|
||||
* @param args
|
||||
*/
|
||||
resumeFileSetUpload(...args: unknown[]): unknown; // 1 arg 继续
|
||||
resumeFileSetUpload (...args: unknown[]): unknown; // 1 arg 继续
|
||||
|
||||
pauseFileUpload(...args: unknown[]): unknown; // 1 arg
|
||||
pauseFileUpload (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
resumeFileUpload(...args: unknown[]): unknown; // 1 arg
|
||||
resumeFileUpload (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
stopFileUpload(...args: unknown[]): unknown; // 1 arg
|
||||
stopFileUpload (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
asyncGetThumbnailPath(...args: unknown[]): unknown; // 2 arg
|
||||
asyncGetThumbnailPath (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
setDownLoadDefaultFileDir(...args: unknown[]): unknown; // 1 arg
|
||||
setDownLoadDefaultFileDir (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
setFileSetDownloadDir(...args: unknown[]): unknown; // 2 arg
|
||||
setFileSetDownloadDir (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
getFileSetDownloadDir(...args: unknown[]): unknown; // 1 arg
|
||||
getFileSetDownloadDir (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
setFlashTransferDir(...args: unknown[]): unknown; // 2 arg
|
||||
setFlashTransferDir (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
addFileSetDownloadListener(...args: unknown[]): unknown; // 1 arg
|
||||
addFileSetDownloadListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeFileSetDownloadListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeFileSetDownloadListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
/**
|
||||
* 开始下载file set的函数 同开始上传
|
||||
* @param fileSetId
|
||||
* @param chatType 聊天类型 //因为没有peer,其实可以硬编码为1 (好友私聊)
|
||||
* @param downloadSceneType 下载类型 //因为没有peer,其实可以硬编码为1 (好友私聊)
|
||||
* @param arg // 默认为false
|
||||
*/
|
||||
startFileSetDownload(fileSetId:string, chatType: number, arg: { isIncludeCompressInnerFiles: boolean }): Promise < GeneralCallResult & {
|
||||
extraInfo: 0
|
||||
} >; // 3 arg
|
||||
startFileSetDownload (fileSetId: string, downloadSceneType: DownloadSceneType, downloadOptionParams: { isIncludeCompressInnerFiles: boolean; }): Promise<GeneralCallResult & {
|
||||
extraInfo: 0;
|
||||
}>; // 3 arg
|
||||
|
||||
stopFileSetDownload(fileSetId: string, arg1: { isIncludeCompressInnerFiles: boolean }): Promise < GeneralCallResult & {
|
||||
extraInfo: 0
|
||||
} > ; // 2 arg 结束不可重启!!
|
||||
stopFileSetDownload (fileSetId: string, downloadOptionParams: { isIncludeCompressInnerFiles: boolean; }): Promise<GeneralCallResult & {
|
||||
extraInfo: 0;
|
||||
}>; // 2 arg 结束不可重启!!
|
||||
|
||||
pauseFileSetDownload(fileSetId: string, arg1: { isIncludeCompressInnerFiles: boolean }): Promise < GeneralCallResult & {
|
||||
extraInfo: 0
|
||||
} > ; // 2 arg
|
||||
pauseFileSetDownload (fileSetId: string, downloadOptionParams: { isIncludeCompressInnerFiles: boolean; }): Promise<GeneralCallResult & {
|
||||
extraInfo: 0;
|
||||
}>; // 2 arg
|
||||
|
||||
resumeFileSetDownload(fileSetId: string, arg1: { isIncludeCompressInnerFiles: boolean }): Promise < GeneralCallResult & {
|
||||
extraInfo: 0
|
||||
} > ; // 2 arg
|
||||
resumeFileSetDownload (fileSetId: string, downloadOptionParams: { isIncludeCompressInnerFiles: boolean; }): Promise<GeneralCallResult & {
|
||||
extraInfo: 0;
|
||||
}>; // 2 arg
|
||||
|
||||
startFileListDownLoad(...args: unknown[]): unknown; // 4 arg // 大概率是选择set里面的部分文件进行下载,没必要,不想写
|
||||
startFileListDownLoad (...args: unknown[]): unknown; // 4 arg // 大概率是选择set里面的部分文件进行下载,没必要,不想写
|
||||
|
||||
pauseFileListDownLoad(...args: unknown[]): unknown; // 2 arg
|
||||
pauseFileListDownLoad (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
resumeFileListDownLoad(...args: unknown[]): unknown; // 2 arg
|
||||
resumeFileListDownLoad (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
stopFileListDownLoad(...args: unknown[]): unknown; // 2 arg
|
||||
stopFileListDownLoad (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
startThumbnailListDownload(fileSetId: string): Promise < GeneralCallResult >; // 1 arg // 缩略图下载
|
||||
startThumbnailListDownload (fileSetId: string): Promise<GeneralCallResult>; // 1 arg // 缩略图下载
|
||||
|
||||
stopThumbnailListDownload(fileSetId: string): Promise < GeneralCallResult >; // 1 arg
|
||||
stopThumbnailListDownload (fileSetId: string): Promise<GeneralCallResult>; // 1 arg
|
||||
|
||||
asyncRequestDownLoadStatus(fileSetId: string): Promise < DownloadStatusInfo >; // 1 arg
|
||||
asyncRequestDownLoadStatus (fileSetId: string): Promise<DownloadStatusInfo>; // 1 arg
|
||||
|
||||
startFileTransferUrl(fileInfo: FlashOneFileInfo): Promise < {
|
||||
startFileTransferUrl (fileInfo: FlashOneFileInfo): Promise<{
|
||||
ret: number,
|
||||
url: string,
|
||||
expireTimestampSeconds: string
|
||||
} >; // 1 arg
|
||||
expireTimestampSeconds: string;
|
||||
}>; // 1 arg
|
||||
|
||||
startFileListDownLoadBySessionId(...args: unknown[]): unknown; // 2 arg
|
||||
startFileListDownLoadBySessionId (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
addFileSetSimpleStatusListener(...args: unknown[]): unknown; // 2 arg
|
||||
addFileSetSimpleStatusListener (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
addFileSetSimpleStatusMonitoring(...args: unknown[]): unknown; // 2 arg
|
||||
addFileSetSimpleStatusMonitoring (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
removeFileSetSimpleStatusMonitoring(...args: unknown[]): unknown; // 2 arg
|
||||
removeFileSetSimpleStatusMonitoring (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
removeFileSetSimpleStatusListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeFileSetSimpleStatusListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
addDesktopFileSetSimpleStatusListener(...args: unknown[]): unknown; // 1 arg
|
||||
addDesktopFileSetSimpleStatusListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
addDesktopFileSetSimpleStatusMonitoring(...args: unknown[]): unknown; // 1 arg
|
||||
addDesktopFileSetSimpleStatusMonitoring (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeDesktopFileSetSimpleStatusMonitoring(...args: unknown[]): unknown; // 1 arg
|
||||
removeDesktopFileSetSimpleStatusMonitoring (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeDesktopFileSetSimpleStatusListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeDesktopFileSetSimpleStatusListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
addFileSetSimpleUploadInfoListener(...args: unknown[]): unknown; // 1 arg
|
||||
addFileSetSimpleUploadInfoListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
addFileSetSimpleUploadInfoMonitoring(...args: unknown[]): unknown; // 1 arg
|
||||
addFileSetSimpleUploadInfoMonitoring (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeFileSetSimpleUploadInfoMonitoring(...args: unknown[]): unknown; // 1 arg
|
||||
removeFileSetSimpleUploadInfoMonitoring (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeFileSetSimpleUploadInfoListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeFileSetSimpleUploadInfoListener (...args: unknown[]): unknown; // 1 arg
|
||||
/**
|
||||
* 发送闪传消息
|
||||
* @param sendArgs
|
||||
*/
|
||||
sendFlashTransferMsg(sendArgs: SendTargetRequests): Promise < {
|
||||
sendFlashTransferMsg (sendArgs: SendTargetRequests): Promise<{
|
||||
errCode: number,
|
||||
errMsg: string,
|
||||
rsp: {
|
||||
sendStatus: SendStatus[]
|
||||
}
|
||||
} >; // 1 arg 估计是file set id
|
||||
sendStatus: SendStatus[];
|
||||
};
|
||||
}>; // 1 arg 估计是file set id
|
||||
|
||||
addFlashTransferTaskInfoListener(...args: unknown[]): unknown; // 1 arg
|
||||
addFlashTransferTaskInfoListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeFlashTransferTaskInfoListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeFlashTransferTaskInfoListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
retrieveLocalLastFailedSetTasksInfo(): unknown; // 0 arg
|
||||
retrieveLocalLastFailedSetTasksInfo (): unknown; // 0 arg
|
||||
|
||||
getFailedFileList(fileSetId: string): Promise < {
|
||||
getFailedFileList (fileSetId: string): Promise<{
|
||||
rsp: {
|
||||
seq: number;
|
||||
result: number;
|
||||
errMs: string;
|
||||
fileSetId: string;
|
||||
fileList: []
|
||||
}
|
||||
} >; // 1 arg
|
||||
fileList: [];
|
||||
};
|
||||
}>; // 1 arg
|
||||
|
||||
getLocalFileListByStatuses(...args: unknown[]): unknown; // 1 arg
|
||||
getLocalFileListByStatuses (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
addTransferStateListener(...args: unknown[]): unknown; // 1 arg
|
||||
addTransferStateListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeTransferStateListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeTransferStateListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
getFileSetFirstClusteringList(...args: unknown[]): unknown; // 3 arg
|
||||
getFileSetFirstClusteringList (...args: unknown[]): unknown; // 3 arg
|
||||
|
||||
getFileSetClusteringList(...args: unknown[]): unknown; // 1 arg
|
||||
getFileSetClusteringList (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
addFileSetClusteringListListener(...args: unknown[]): unknown; // 1 arg
|
||||
addFileSetClusteringListListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeFileSetClusteringListListener(...args: unknown[]): unknown; // 1 arg
|
||||
removeFileSetClusteringListListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
getFileSetClusteringDetail(...args: unknown[]): unknown; // 1 arg
|
||||
getFileSetClusteringDetail (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
doAIOFlashTransferBubbleActionWithStatus(...args: unknown[]): unknown; // 4 arg
|
||||
doAIOFlashTransferBubbleActionWithStatus (...args: unknown[]): unknown; // 4 arg
|
||||
|
||||
getFilesTransferProgress(...args: unknown[]): unknown; // 1 arg
|
||||
getFilesTransferProgress (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
pollFilesTransferProgress(...args: unknown[]): unknown; // 1 arg
|
||||
pollFilesTransferProgress (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
cancelPollFilesTransferProgress(...args: unknown[]): unknown; // 1 arg
|
||||
cancelPollFilesTransferProgress (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
checkDownloadStatusBeforeLocalFileOper(...args: unknown[]): unknown; // 3 arg
|
||||
checkDownloadStatusBeforeLocalFileOper (...args: unknown[]): unknown; // 3 arg
|
||||
|
||||
getCompressedFileFolder(...args: unknown[]): unknown; // 1 arg
|
||||
getCompressedFileFolder (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
addFolderListener(...args: unknown[]): unknown; // 1 arg
|
||||
addFolderListener (...args: unknown[]): unknown; // 1 arg
|
||||
|
||||
removeFolderListener(...args: unknown[]): unknown;
|
||||
removeFolderListener (...args: unknown[]): unknown;
|
||||
|
||||
addCompressedFileListener(...args: unknown[]): unknown;
|
||||
addCompressedFileListener (...args: unknown[]): unknown;
|
||||
|
||||
removeCompressedFileListener(...args: unknown[]): unknown;
|
||||
removeCompressedFileListener (...args: unknown[]): unknown;
|
||||
|
||||
getFileCategoryList(...args: unknown[]): unknown;
|
||||
getFileCategoryList (...args: unknown[]): unknown;
|
||||
|
||||
addDeviceStatusListener(...args: unknown[]): unknown;
|
||||
addDeviceStatusListener (...args: unknown[]): unknown;
|
||||
|
||||
removeDeviceStatusListener(...args: unknown[]): unknown;
|
||||
removeDeviceStatusListener (...args: unknown[]): unknown;
|
||||
|
||||
checkDeviceStatus(...args: unknown[]): unknown;
|
||||
checkDeviceStatus (...args: unknown[]): unknown;
|
||||
|
||||
pauseAllTasks(...args: unknown[]): unknown; // 2 arg
|
||||
pauseAllTasks (...args: unknown[]): unknown; // 2 arg
|
||||
|
||||
resumePausedTasksAfterDeviceStatus(...args: unknown[]): unknown;
|
||||
resumePausedTasksAfterDeviceStatus (...args: unknown[]): unknown;
|
||||
|
||||
onSystemGoingToSleep(...args: unknown[]): unknown;
|
||||
onSystemGoingToSleep (...args: unknown[]): unknown;
|
||||
|
||||
onSystemWokeUp(...args: unknown[]): unknown;
|
||||
onSystemWokeUp (...args: unknown[]): unknown;
|
||||
|
||||
getFileMetas(...args: unknown[]): unknown;
|
||||
getFileMetas (...args: unknown[]): unknown;
|
||||
|
||||
addDownloadCntStatisticsListener(...args: unknown[]): unknown;
|
||||
addDownloadCntStatisticsListener (...args: unknown[]): unknown;
|
||||
|
||||
removeDownloadCntStatisticsListener(...args: unknown[]): unknown;
|
||||
removeDownloadCntStatisticsListener (...args: unknown[]): unknown;
|
||||
|
||||
detectPrivacyInfoInPaths(...args: unknown[]): unknown;
|
||||
detectPrivacyInfoInPaths (...args: unknown[]): unknown;
|
||||
|
||||
getFileThumbnailUrl(...args: unknown[]): unknown;
|
||||
getFileThumbnailUrl (...args: unknown[]): unknown;
|
||||
|
||||
handleDownloadFinishAfterSaveToAlbum(...args: unknown[]): unknown;
|
||||
handleDownloadFinishAfterSaveToAlbum (...args: unknown[]): unknown;
|
||||
|
||||
checkBatchFilesDownloadStatus(...args: unknown[]): unknown;
|
||||
checkBatchFilesDownloadStatus (...args: unknown[]): unknown;
|
||||
|
||||
onCheckAlbumStorageStatusResult(...args: unknown[]): unknown;
|
||||
onCheckAlbumStorageStatusResult (...args: unknown[]): unknown;
|
||||
|
||||
addFileAlbumStorageListener(...args: unknown[]): unknown;
|
||||
addFileAlbumStorageListener (...args: unknown[]): unknown;
|
||||
|
||||
removeFileAlbumStorageListener(...args: unknown[]): unknown;
|
||||
removeFileAlbumStorageListener (...args: unknown[]): unknown;
|
||||
|
||||
refreshFolderStatus(...args: unknown[]): unknown;
|
||||
refreshFolderStatus (...args: unknown[]): unknown;
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ export interface NodeIKernelMsgService {
|
||||
|
||||
assembleMobileQQRichMediaFilePath (...args: unknown[]): unknown;
|
||||
|
||||
getFileThumbSavePathForSend (...args: unknown[]): unknown;
|
||||
getFileThumbSavePathForSend (thumbSize: number, createNeed: boolean): string;
|
||||
|
||||
getFileThumbSavePath (...args: unknown[]): unknown;
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { NodeIDependsAdapter, NodeIDispatcherAdapter, NodeIGlobalAdapter } from './adapters';
|
||||
import {
|
||||
GeneralCallResult,
|
||||
NodeIKernelAvatarService,
|
||||
NodeIKernelBuddyService,
|
||||
NodeIKernelGroupService,
|
||||
@ -27,78 +28,78 @@ import { NodeIKernelMSFService } from './services/NodeIKernelMSFService';
|
||||
import { NodeIkernelTestPerformanceService } from './services/NodeIkernelTestPerformanceService';
|
||||
import { NodeIKernelECDHService } from './services/NodeIKernelECDHService';
|
||||
import { NodeIO3MiscService } from './services/NodeIO3MiscService';
|
||||
import { NodeIKernelFlashTransferService } from "./services/NodeIKernelFlashTransferService";
|
||||
import { NodeIKernelFlashTransferService } from './services/NodeIKernelFlashTransferService';
|
||||
|
||||
export interface NodeQQNTWrapperUtil {
|
||||
get(): NodeQQNTWrapperUtil;
|
||||
get (): NodeQQNTWrapperUtil;
|
||||
|
||||
getNTUserDataInfoConfig(): string;
|
||||
getNTUserDataInfoConfig (): string;
|
||||
|
||||
emptyWorkingSet(n: number): void;
|
||||
emptyWorkingSet (n: number): void;
|
||||
|
||||
getSsoCmdOfOidbReq(arg1: number, arg2: number): unknown;
|
||||
getSsoCmdOfOidbReq (arg1: number, arg2: number): unknown;
|
||||
|
||||
getSsoBufferOfOidbReq(...args: unknown[]): unknown; // 有点看不懂参数定义 待补充 好像是三个参数
|
||||
getSsoBufferOfOidbReq (...args: unknown[]): unknown; // 有点看不懂参数定义 待补充 好像是三个参数
|
||||
|
||||
getOidbRspInfo(arg: string): unknown; // 可能是错的
|
||||
getOidbRspInfo (arg: string): unknown; // 可能是错的
|
||||
|
||||
getFileSize(path: string): Promise<number>; // 直接的猜测
|
||||
getFileSize (path: string): Promise<number>; // 直接的猜测
|
||||
|
||||
genFileMd5Buf(arg: string): unknown; // 可能是错的
|
||||
genFileMd5Buf (arg: string): unknown; // 可能是错的
|
||||
|
||||
genFileMd5Hex(path: string): unknown; // 直接的猜测
|
||||
genFileMd5Hex (path: string): unknown; // 直接的猜测
|
||||
|
||||
genFileShaBuf(path: string): unknown; // 直接的猜测
|
||||
genFileShaBuf (path: string): unknown; // 直接的猜测
|
||||
|
||||
genFileCumulateSha1(path: string): unknown; // 直接的猜测
|
||||
genFileCumulateSha1 (path: string): unknown; // 直接的猜测
|
||||
|
||||
genFileShaHex(path: string): unknown; // 直接的猜测
|
||||
genFileShaHex (path: string): unknown; // 直接的猜测
|
||||
|
||||
fileIsExist(path: string): unknown;
|
||||
fileIsExist (path: string): unknown;
|
||||
|
||||
startTrace(path: string): unknown; // 可能是错的
|
||||
startTrace (path: string): unknown; // 可能是错的
|
||||
|
||||
copyFile(src: string, dst: string): unknown;
|
||||
copyFile (src: string, dst: string): unknown;
|
||||
|
||||
genFileShaAndMd5Hex(path: string, unknown: number): unknown; // 可能是错的
|
||||
genFileShaAndMd5Hex (path: string, unknown: number): unknown; // 可能是错的
|
||||
|
||||
setTraceInfo(unknown: unknown): unknown;
|
||||
setTraceInfo (unknown: unknown): unknown;
|
||||
|
||||
encodeOffLine(unknown: unknown): unknown;
|
||||
encodeOffLine (unknown: unknown): unknown;
|
||||
|
||||
decodeOffLine(arg: string): unknown; // 可能是错的 传递hex
|
||||
decodeOffLine (arg: string): unknown; // 可能是错的 传递hex
|
||||
|
||||
DecoderRecentInfo(arg: string): unknown; // 可能是错的 传递hex
|
||||
DecoderRecentInfo (arg: string): unknown; // 可能是错的 传递hex
|
||||
|
||||
getPinyin(arg0: string, arg1: boolean): unknown;
|
||||
getPinyin (arg0: string, arg1: boolean): unknown;
|
||||
|
||||
matchInPinyin(arg0: unknown[], arg1: string): unknown; // 参数特复杂 arg0是个复杂数据类型
|
||||
matchInPinyin (arg0: unknown[], arg1: string): unknown; // 参数特复杂 arg0是个复杂数据类型
|
||||
|
||||
makeDirByPath(arg0: string): unknown;
|
||||
makeDirByPath (arg0: string): unknown;
|
||||
|
||||
emptyWorkingSet(arg0: number): unknown; // 参数是UINT32
|
||||
emptyWorkingSet (arg0: number): unknown; // 参数是UINT32
|
||||
|
||||
runProcess(arg0: string, arg1: boolean): unknown;
|
||||
runProcess (arg0: string, arg1: boolean): unknown;
|
||||
|
||||
runProcessArgs(arg0: string, arg1: { [key: string]: string }, arg2: boolean): unknown;
|
||||
runProcessArgs (arg0: string, arg1: { [key: string]: string; }, arg2: boolean): unknown;
|
||||
|
||||
calcThumbSize(arg0: number, arg1: number, arg2: unknown): unknown;
|
||||
calcThumbSize (arg0: number, arg1: number, arg2: unknown): unknown;
|
||||
|
||||
fullWordToHalfWord(word: string): unknown;
|
||||
fullWordToHalfWord (word: string): unknown;
|
||||
|
||||
getNTUserDataInfoConfig(): unknown;
|
||||
getNTUserDataInfoConfig (): unknown;
|
||||
|
||||
pathIsReadableAndWriteable(path: string): unknown; // 直接的猜测
|
||||
pathIsReadableAndWriteable (path: string): unknown; // 直接的猜测
|
||||
|
||||
resetUserDataSavePathToDocument(): unknown;
|
||||
resetUserDataSavePathToDocument (): unknown;
|
||||
|
||||
getSoBuildInfo(): unknown; // 例如 0[0]_d491dc01e0a_0
|
||||
getSoBuildInfo (): unknown; // 例如 0[0]_d491dc01e0a_0
|
||||
|
||||
registerCountInstruments(arg0: string, arg1: string[], arg2: number, arg3: number): unknown;
|
||||
registerCountInstruments (arg0: string, arg1: string[], arg2: number, arg3: number): unknown;
|
||||
|
||||
registerValueInstruments(arg0: string, arg1: string[], arg2: number, arg3: number): unknown;
|
||||
registerValueInstruments (arg0: string, arg1: string[], arg2: number, arg3: number): unknown;
|
||||
|
||||
registerValueInstrumentsWithBoundary(
|
||||
registerValueInstrumentsWithBoundary (
|
||||
arg0: string,
|
||||
arg1: unknown,
|
||||
arg2: unknown,
|
||||
@ -106,7 +107,7 @@ export interface NodeQQNTWrapperUtil {
|
||||
arg4: number,
|
||||
): unknown;
|
||||
|
||||
reportCountIndicators(
|
||||
reportCountIndicators (
|
||||
arg0: string,
|
||||
arg1: Map<unknown, unknown>,
|
||||
arg2: string,
|
||||
@ -114,7 +115,7 @@ export interface NodeQQNTWrapperUtil {
|
||||
arg4: boolean,
|
||||
): unknown;
|
||||
|
||||
reportValueIndicators(
|
||||
reportValueIndicators (
|
||||
arg0: string,
|
||||
arg1: Map<unknown, unknown>,
|
||||
arg2: string,
|
||||
@ -122,142 +123,154 @@ export interface NodeQQNTWrapperUtil {
|
||||
arg4: number,
|
||||
): unknown;
|
||||
|
||||
checkNewUserDataSaveDirAvailable(arg0: string): unknown;
|
||||
checkNewUserDataSaveDirAvailable (arg0: string): unknown;
|
||||
|
||||
copyUserData(arg0: string, arg1: string): Promise<unknown>;
|
||||
copyUserData (arg0: string, arg1: string): Promise<unknown>;
|
||||
|
||||
setUserDataSaveDirectory(arg0: string): Promise<unknown>;
|
||||
setUserDataSaveDirectory (arg0: string): Promise<unknown>;
|
||||
|
||||
hasOtherRunningQQProcess(): boolean;
|
||||
hasOtherRunningQQProcess (): boolean;
|
||||
|
||||
quitAllRunningQQProcess(arg: boolean): unknown;
|
||||
quitAllRunningQQProcess (arg: boolean): unknown;
|
||||
|
||||
checkNvidiaConfig(): unknown;
|
||||
checkNvidiaConfig (): unknown;
|
||||
|
||||
repairNvidiaConfig(): unknown;
|
||||
repairNvidiaConfig (): unknown;
|
||||
|
||||
getNvidiaDriverVersion(): unknown;
|
||||
getNvidiaDriverVersion (): unknown;
|
||||
|
||||
isNull(): unknown;
|
||||
isNull (): unknown;
|
||||
|
||||
createThumbnailImage (
|
||||
serviceName: string,
|
||||
filePath: string,
|
||||
targetPath: string,
|
||||
imgSize: {
|
||||
width: number,
|
||||
height: number;
|
||||
},
|
||||
fileFormat: string,
|
||||
arg: number | null | undefined, // null undefined都行
|
||||
): Promise<GeneralCallResult & { targetPath?: string; }>;
|
||||
}
|
||||
export interface NodeIQQNTStartupSessionWrapper {
|
||||
create(): NodeIQQNTStartupSessionWrapper;
|
||||
stop(): void;
|
||||
start(): void;
|
||||
createWithModuleList(uk: unknown): unknown;
|
||||
getSessionIdList(): unknown;
|
||||
create (): NodeIQQNTStartupSessionWrapper;
|
||||
stop (): void;
|
||||
start (): void;
|
||||
createWithModuleList (uk: unknown): unknown;
|
||||
getSessionIdList (): unknown;
|
||||
}
|
||||
export interface NodeIQQNTWrapperSession {
|
||||
getNTWrapperSession(str: string): NodeIQQNTWrapperSession;
|
||||
getNTWrapperSession (str: string): NodeIQQNTWrapperSession;
|
||||
|
||||
get(): NodeIQQNTWrapperSession;
|
||||
get (): NodeIQQNTWrapperSession;
|
||||
|
||||
new(): NodeIQQNTWrapperSession;
|
||||
|
||||
create(): NodeIQQNTWrapperSession;
|
||||
create (): NodeIQQNTWrapperSession;
|
||||
|
||||
init(
|
||||
init (
|
||||
wrapperSessionInitConfig: WrapperSessionInitConfig,
|
||||
nodeIDependsAdapter: NodeIDependsAdapter,
|
||||
nodeIDispatcherAdapter: NodeIDispatcherAdapter,
|
||||
nodeIKernelSessionListener: NodeIKernelSessionListener,
|
||||
): void;
|
||||
|
||||
startNT(session: number): void;
|
||||
startNT (session: number): void;
|
||||
|
||||
startNT(): void;
|
||||
startNT (): void;
|
||||
|
||||
getBdhUploadService(): unknown;
|
||||
getBdhUploadService (): unknown;
|
||||
|
||||
getECDHService(): NodeIKernelECDHService;
|
||||
getECDHService (): NodeIKernelECDHService;
|
||||
|
||||
getMsgService(): NodeIKernelMsgService;
|
||||
getMsgService (): NodeIKernelMsgService;
|
||||
|
||||
getProfileService(): NodeIKernelProfileService;
|
||||
getProfileService (): NodeIKernelProfileService;
|
||||
|
||||
getProfileLikeService(): NodeIKernelProfileLikeService;
|
||||
getProfileLikeService (): NodeIKernelProfileLikeService;
|
||||
|
||||
getGroupService(): NodeIKernelGroupService;
|
||||
getGroupService (): NodeIKernelGroupService;
|
||||
|
||||
getStorageCleanService(): NodeIKernelStorageCleanService;
|
||||
getStorageCleanService (): NodeIKernelStorageCleanService;
|
||||
|
||||
getBuddyService(): NodeIKernelBuddyService;
|
||||
getBuddyService (): NodeIKernelBuddyService;
|
||||
|
||||
getRobotService(): NodeIKernelRobotService;
|
||||
getRobotService (): NodeIKernelRobotService;
|
||||
|
||||
getTicketService(): NodeIKernelTicketService;
|
||||
getTicketService (): NodeIKernelTicketService;
|
||||
|
||||
getTipOffService(): NodeIKernelTipOffService;
|
||||
getTipOffService (): NodeIKernelTipOffService;
|
||||
|
||||
getNodeMiscService(): NodeIKernelNodeMiscService;
|
||||
getNodeMiscService (): NodeIKernelNodeMiscService;
|
||||
|
||||
getRichMediaService(): NodeIKernelRichMediaService;
|
||||
getRichMediaService (): NodeIKernelRichMediaService;
|
||||
|
||||
getMsgBackupService(): NodeIKernelMsgBackupService;
|
||||
getMsgBackupService (): NodeIKernelMsgBackupService;
|
||||
|
||||
getAlbumService(): NodeIKernelAlbumService;
|
||||
getAlbumService (): NodeIKernelAlbumService;
|
||||
|
||||
getTianShuService(): NodeIKernelTianShuService;
|
||||
getTianShuService (): NodeIKernelTianShuService;
|
||||
|
||||
getUnitedConfigService(): NodeIKernelUnitedConfigService;
|
||||
getUnitedConfigService (): NodeIKernelUnitedConfigService;
|
||||
|
||||
getSearchService(): NodeIKernelSearchService;
|
||||
getSearchService (): NodeIKernelSearchService;
|
||||
|
||||
getFlashTransferService(): NodeIKernelFlashTransferService;
|
||||
getFlashTransferService (): NodeIKernelFlashTransferService;
|
||||
|
||||
getDirectSessionService(): unknown;
|
||||
getDirectSessionService (): unknown;
|
||||
|
||||
getRDeliveryService(): unknown;
|
||||
getRDeliveryService (): unknown;
|
||||
|
||||
getAvatarService(): NodeIKernelAvatarService;
|
||||
getAvatarService (): NodeIKernelAvatarService;
|
||||
|
||||
getFeedChannelService(): unknown;
|
||||
getFeedChannelService (): unknown;
|
||||
|
||||
getYellowFaceService(): unknown;
|
||||
getYellowFaceService (): unknown;
|
||||
|
||||
getCollectionService(): NodeIKernelCollectionService;
|
||||
getCollectionService (): NodeIKernelCollectionService;
|
||||
|
||||
getSettingService(): unknown;
|
||||
getSettingService (): unknown;
|
||||
|
||||
getQiDianService(): unknown;
|
||||
getQiDianService (): unknown;
|
||||
|
||||
getFileAssistantService(): unknown;
|
||||
getFileAssistantService (): unknown;
|
||||
|
||||
getGuildService(): unknown;
|
||||
getGuildService (): unknown;
|
||||
|
||||
getSkinService(): unknown;
|
||||
getSkinService (): unknown;
|
||||
|
||||
getTestPerformanceService(): NodeIkernelTestPerformanceService;
|
||||
getTestPerformanceService (): NodeIkernelTestPerformanceService;
|
||||
|
||||
getQQPlayService(): unknown;
|
||||
getQQPlayService (): unknown;
|
||||
|
||||
getDbToolsService(): unknown;
|
||||
getDbToolsService (): unknown;
|
||||
|
||||
getUixConvertService(): NodeIKernelUixConvertService;
|
||||
getUixConvertService (): NodeIKernelUixConvertService;
|
||||
|
||||
getOnlineStatusService(): unknown;
|
||||
getOnlineStatusService (): unknown;
|
||||
|
||||
getRemotingService(): unknown;
|
||||
getRemotingService (): unknown;
|
||||
|
||||
getGroupTabService(): unknown;
|
||||
getGroupTabService (): unknown;
|
||||
|
||||
getGroupSchoolService(): unknown;
|
||||
getGroupSchoolService (): unknown;
|
||||
|
||||
getLiteBusinessService(): unknown;
|
||||
getLiteBusinessService (): unknown;
|
||||
|
||||
getGuildMsgService(): unknown;
|
||||
getGuildMsgService (): unknown;
|
||||
|
||||
getLockService(): unknown;
|
||||
getLockService (): unknown;
|
||||
|
||||
getMSFService(): NodeIKernelMSFService;
|
||||
getMSFService (): NodeIKernelMSFService;
|
||||
|
||||
getGuildHotUpdateService(): unknown;
|
||||
getGuildHotUpdateService (): unknown;
|
||||
|
||||
getAVSDKService(): unknown;
|
||||
getAVSDKService (): unknown;
|
||||
|
||||
getRecentContactService(): NodeIKernelRecentContactService;
|
||||
getRecentContactService (): NodeIKernelRecentContactService;
|
||||
|
||||
getConfigMgrService(): unknown;
|
||||
getConfigMgrService (): unknown;
|
||||
}
|
||||
|
||||
export interface EnginInitDesktopConfig {
|
||||
@ -271,20 +284,20 @@ export interface EnginInitDesktopConfig {
|
||||
global_path_config: {
|
||||
desktopGlobalPath: string;
|
||||
};
|
||||
thumb_config: { maxSide: 324; minSide: 48; longLimit: 6; density: 2 };
|
||||
thumb_config: { maxSide: 324; minSide: 48; longLimit: 6; density: 2; };
|
||||
}
|
||||
|
||||
export interface NodeIQQNTWrapperEngine {
|
||||
get(): NodeIQQNTWrapperEngine;
|
||||
get (): NodeIQQNTWrapperEngine;
|
||||
|
||||
initWithDeskTopConfig(config: EnginInitDesktopConfig, nodeIGlobalAdapter: NodeIGlobalAdapter): void;
|
||||
initWithDeskTopConfig (config: EnginInitDesktopConfig, nodeIGlobalAdapter: NodeIGlobalAdapter): void;
|
||||
}
|
||||
|
||||
export interface WrapperNodeApi {
|
||||
NodeIO3MiscService: NodeIO3MiscService;
|
||||
NodeQQNTWrapperUtil: NodeQQNTWrapperUtil;
|
||||
NodeIQQNTWrapperSession: NodeIQQNTWrapperSession;
|
||||
NodeIQQNTStartupSessionWrapper: NodeIQQNTStartupSessionWrapper
|
||||
NodeIQQNTStartupSessionWrapper: NodeIQQNTStartupSessionWrapper;
|
||||
NodeIQQNTWrapperEngine: NodeIQQNTWrapperEngine;
|
||||
NodeIKernelLoginService: NodeIKernelLoginService;
|
||||
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { Static, Type, Optional } from '@sinclair/typebox';
|
||||
import path from 'node:path';
|
||||
|
||||
const richMediaList = [
|
||||
'.mp4', '.mov', '.avi', '.wmv', '.mpeg', '.mpg', '.flv', '.mkv',
|
||||
'.png', '.gif', '.jpg', '.jpeg', '.webp', '.bmp',
|
||||
];
|
||||
|
||||
// 不全部使用json因为:一个文件解析Form-data会变字符串!!! 但是api文档就写List
|
||||
const SchemaData = Type.Object({
|
||||
@ -8,6 +14,8 @@ const SchemaData = Type.Object({
|
||||
Type.Array(Type.String()),
|
||||
Type.String(),
|
||||
]),
|
||||
name: Optional(Type.String()),
|
||||
thumb_path: Optional(Type.String()),
|
||||
});
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
|
||||
@ -16,9 +24,39 @@ export class CreateFlashTask extends OneBotAction<Payload, unknown> {
|
||||
override payloadSchema = SchemaData;
|
||||
|
||||
async _handle (payload: Payload) {
|
||||
// todo fileset的名字和缩略图还没实现!!
|
||||
const fileList = Array.isArray(payload.files) ? payload.files : [payload.files];
|
||||
let thumbPath: string = '';
|
||||
|
||||
return await this.core.apis.FlashApi.createFlashTransferUploadTask(fileList);
|
||||
if (fileList.length === 1) {
|
||||
// 我是真没hook到那种合并的缩略图是哪个方法产生的,暂时不实现(怀疑是js直接canvas渲染的!!) // 确认了猜想
|
||||
const filePath = fileList[0];
|
||||
if (filePath === undefined) {
|
||||
return {};
|
||||
}
|
||||
const ext = path.extname(filePath).toLowerCase();
|
||||
|
||||
if (richMediaList.includes(ext)) {
|
||||
try {
|
||||
const res = await this.core.apis.FlashApi.createFileThumbnail(filePath);
|
||||
if (res && typeof res === 'object' && 'result' in res && res.result === 0) {
|
||||
thumbPath = res.targetPath as string;
|
||||
}
|
||||
} catch (_e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toPlatformPath (inputPath: string) {
|
||||
const unifiedPath = inputPath.replace(/[\\/]/g, path.sep);
|
||||
return path.normalize(unifiedPath);
|
||||
}
|
||||
|
||||
let normalPath: string;
|
||||
if (payload.thumb_path !== undefined) {
|
||||
normalPath = path.normalize(payload.thumb_path);
|
||||
} else {
|
||||
normalPath = toPlatformPath(thumbPath);
|
||||
}
|
||||
return await this.core.apis.FlashApi.createFlashTransferUploadTask(fileList, normalPath, payload.name || '');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user