This commit is contained in:
idranme
2024-08-29 20:48:08 +08:00
parent 6954551cb7
commit 6af31c48c4
4 changed files with 65 additions and 21 deletions

View File

@@ -205,7 +205,7 @@ function onBrowserWindowCreated(window: BrowserWindow) {
if (window.id === 2) {
mainWindow = window
}
log('window create', window.webContents.getURL().toString())
//log('window create', window.webContents.getURL().toString())
try {
hookNTQQApiCall(window, window.id !== 2)
hookNTQQApiReceive(window, window.id !== 2)

View File

@@ -43,14 +43,49 @@ export class NTQQFileApi extends Service {
this.rkeyManager = new RkeyManager(ctx, 'http://napcat-sign.wumiao.wang:2082/rkey')
}
/** 27187 TODO */
async getVideoUrl(peer: Peer, msgId: string, elementId: string) {
const session = getSession()
return (await session?.getRichMediaService().getVideoPlayUrlV2(peer,
msgId,
elementId,
0,
{ downSourceType: 1, triggerType: 1 }))?.urlResult.domainUrl[0].url
if (session) {
return (await session.getRichMediaService().getVideoPlayUrlV2(
peer,
msgId,
elementId,
0,
{ downSourceType: 1, triggerType: 1 }
)).urlResult.domainUrl[0]?.url
} else {
const data = await invoke<GeneralCallResult & {
urlResult: {
v4IpUrl: []
v6IpUrl: []
domainUrl: {
url: string
isHttps: boolean
httpsDomain: string
}[]
videoCodecFormat: number
}
}>({
methodName: 'nodeIKernelRichMediaService/getVideoPlayUrlV2',
args: [
{
peer,
msgId,
elemId: elementId,
videoCodecFormat: 0,
exParams: {
downSourceType: 1,
triggerType: 1
},
},
null,
],
})
if (data.result !== 0) {
this.ctx.logger.warn('getVideoUrl', data)
}
return data.urlResult.domainUrl[0]?.url
}
}
async getFileType(filePath: string) {

View File

@@ -157,12 +157,6 @@ export class NTQQGroupApi extends Service {
}
}
/** 27187 TODO */
async delGroupFile(groupCode: string, files: string[]) {
const session = getSession()
return session?.getRichMediaService().deleteGroupFile(groupCode, [102], files)
}
async handleGroupRequest(flag: string, operateType: GroupRequestOperateTypes, reason?: string) {
const flagitem = flag.split('|')
const groupCode = flagitem[0]
@@ -408,4 +402,18 @@ export class NTQQGroupApi extends Service {
],
})
}
async deleteGroupFile(groupId: string, fileIdList: string[]) {
return await invoke({
methodName: 'nodeIKernelRichMediaService/deleteGroupFile',
args: [
{
groupId,
busIdList: [102],
fileIdList
},
null,
],
})
}
}

View File

@@ -2,15 +2,16 @@ import BaseAction from '../BaseAction'
import { ActionName } from '../types'
interface Payload {
group_id: string | number
file_id: string
busid?: 102
group_id: string | number
file_id: string
busid?: 102
}
export class GoCQHTTPDelGroupFile extends BaseAction<Payload, void> {
actionName = ActionName.GoCQHTTP_DelGroupFile
export class GoCQHTTPDelGroupFile extends BaseAction<Payload, null> {
actionName = ActionName.GoCQHTTP_DelGroupFile
async _handle(payload: Payload) {
await this.ctx.ntGroupApi.delGroupFile(payload.group_id.toString(), [payload.file_id])
}
async _handle(payload: Payload) {
await this.ctx.ntGroupApi.deleteGroupFile(payload.group_id.toString(), [payload.file_id])
return null
}
}