Skip to content

Commit

Permalink
modified: src/main.js
Browse files Browse the repository at this point in the history
	modified:   src/renderer/domUpMessages.js
	modified:   src/renderer/setMessage.js
	modified:   src/renderer/vue.js
  • Loading branch information
Night-stars-1 committed Aug 26, 2024
1 parent 78adaf5 commit f43cd3c
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 160 deletions.
255 changes: 130 additions & 125 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,106 +46,47 @@ function onBrowserWindowCreated(window) {
const original_send = window.webContents.send;

const patched_send = function (channel, ...args) {
const payload = args?.[1]?.[0]?.payload
switch (args?.[1]?.[0]?.cmdName) {
case "nodeIKernelUnitedConfigListener/onUnitedConfigUpdate":
// 屏蔽更新
if (!data.setting.not_updata) break;
const content = args[1][0].payload.configData.content
if (content.includes('"title": "更新提醒"')) {
args[1][0].payload.configData.content = ""
args[1][0].payload.configData.isSwitchOn = false
} else if (content.includes('"label": "频道"')) {
// 侧边栏管理
const sideData = JSON.parse(content)
if (Array.isArray(data.setting.sidebar_list)) {
data.setting.sidebar_list = {}
}
const new_content = []
sideData.forEach((item) => {
if (!(item.label in data.setting.sidebar_list)) {
data.setting.sidebar_list[item.label] = false
}
if (!data.setting.sidebar_list[item.label]){
new_content.push(item)
}
})
args[1][0].payload.configData.content = JSON.stringify(new_content)
setSettings(settingsPath, data)
}
break;
case "onOpenParamChange":
// 禁止通话
if (!data.setting.call_barring) break;
if (args?.[1][0]?.payload?.avSdkData) {
args = null
}
break;
case "nodeIKernelMsgListener/onRecvMsg":
const msgItem = payload.msgList[0]
//output(msgItem.peerUid, targetPeerUid)
if (msgItem.peerUid !== targetPeerUid) break;
const msgElement = msgItem.elements[0]
if (data.setting.face_block[msgElement.faceElement?.faceIndex]?.value) {
msgItem.msgType = 5
msgItem.subMsgType = 12
msgElement.elementType = 8
msgElement.faceElement = null
msgElement.grayTipElement = {
subElementType: 12,
revokeElement: null,
proclamationElement: null,
emojiReplyElement: null,
groupElement: null,
buddyElement: null,
feedMsgElement: null,
essenceElement: null,
groupNotifyElement: null,
buddyNotifyElement: null,
xmlElement: {
busiType: '0',
busiId: '10145',
c2cType: 0,
serviceType: 0,
ctrlFlag: 0,
content: data.setting.face_prompt? `<nor txt="龙王"/> <qq uin="${msgItem.senderUid}" col="3" jp="" /> <nor txt="在群里喷水"/>`:null,
templId: '0',
seqId: '0',
templParam: new Map([]),
pbReserv: '0',
members: new Map([])
},
fileReceiptElement: null,
localGrayTipElement: null,
blockGrayTipElement: null,
aioOpGrayTipElement: null,
jsonGrayTipElement: null,
walletGrayTipElement: null,
};
}
// setMsgRecord(msgItem)
break;
case "nodeIKernelMsgListener/onRecvActiveMsg":
const recvActiveMsgItem = payload.msgList[0]
setMsgRecord(recvActiveMsgItem)
window.webContents.send("LiteLoader.qqpromote.onAddSendMsg", recvActiveMsgItem.msgId);
break;
}
// 替换历史消息中的小程序卡片
if (args?.[1]?.msgList?.length > 0) {
const msgList = args?.[1]?.msgList;
// 替换小程序卡片
msgList.forEach((msgItem) => {
let msg_seq = msgItem.msgSeq;
msgItem.elements.forEach((msgElement) => {
// output(msgItem.msgType, msgItem.subMsgType, msgElement.grayTipElement)
if (msgElement.arkElement && msgElement.arkElement.bytesData && data.setting.replaceArk) {
const json = JSON.parse(msgElement.arkElement.bytesData);
if (json?.meta?.detail_1?.appid) {
msgElement.arkElement.bytesData = replaceArk(json, msg_seq);
try {
const payload = args?.[1]?.[0]?.payload
switch (args?.[1]?.[0]?.cmdName) {
case "nodeIKernelUnitedConfigListener/onUnitedConfigUpdate":
// 屏蔽更新
if (!data.setting.not_updata) break;
const content = args[1][0].payload.configData.content
if (content.includes('"title": "更新提醒"')) {
args[1][0].payload.configData.content = ""
args[1][0].payload.configData.isSwitchOn = false
} else if (content.includes('"label": "频道"')) {
// 侧边栏管理
const sideData = JSON.parse(content)
if (Array.isArray(data.setting.sidebar_list)) {
data.setting.sidebar_list = {}
}
const new_content = []
sideData.forEach((item) => {
if (!(item.label in data.setting.sidebar_list)) {
data.setting.sidebar_list[item.label] = false
}
if (!data.setting.sidebar_list[item.label]){
new_content.push(item)
}
})
args[1][0].payload.configData.content = JSON.stringify(new_content)
setSettings(settingsPath, data)
}
// 屏蔽表情
break;
case "onOpenParamChange":
// 禁止通话
if (!data.setting.call_barring) break;
if (args?.[1][0]?.payload?.avSdkData) {
args = null
}
break;
case "nodeIKernelMsgListener/onRecvMsg":
const msgItem = payload.msgList[0]
//output(msgItem.peerUid, targetPeerUid)
if (msgItem.peerUid !== targetPeerUid) break;
const msgElement = msgItem.elements[0]
if (data.setting.face_block[msgElement.faceElement?.faceIndex]?.value) {
msgItem.msgType = 5
msgItem.subMsgType = 12
Expand Down Expand Up @@ -183,35 +124,99 @@ function onBrowserWindowCreated(window) {
walletGrayTipElement: null,
};
}
setMsgRecord(msgItem)
break;
case "nodeIKernelMsgListener/onRecvActiveMsg":
const recvActiveMsgItem = payload.msgList[0]
setMsgRecord(recvActiveMsgItem)
window.webContents.send("LiteLoader.qqpromote.onAddSendMsg", recvActiveMsgItem.msgId);
break;
}
// 替换历史消息中的小程序卡片
if (args?.[1]?.msgList?.length > 0) {
const msgList = args?.[1]?.msgList;
// 替换小程序卡片
msgList.forEach((msgItem) => {
let msg_seq = msgItem.msgSeq;
msgItem.elements.forEach((msgElement) => {
// output(msgItem.msgType, msgItem.subMsgType, msgElement.grayTipElement)
if (msgElement.arkElement && msgElement.arkElement.bytesData && data.setting.replaceArk) {
const json = JSON.parse(msgElement.arkElement.bytesData);
if (json?.meta?.detail_1?.appid) {
msgElement.arkElement.bytesData = replaceArk(json, msg_seq);
}
}
// 屏蔽表情
if (data.setting.face_block[msgElement.faceElement?.faceIndex]?.value) {
msgItem.msgType = 5
msgItem.subMsgType = 12
msgElement.elementType = 8
msgElement.faceElement = null
msgElement.grayTipElement = {
subElementType: 12,
revokeElement: null,
proclamationElement: null,
emojiReplyElement: null,
groupElement: null,
buddyElement: null,
feedMsgElement: null,
essenceElement: null,
groupNotifyElement: null,
buddyNotifyElement: null,
xmlElement: {
busiType: '0',
busiId: '10145',
c2cType: 0,
serviceType: 0,
ctrlFlag: 0,
content: data.setting.face_prompt? `<nor txt="龙王"/> <qq uin="${msgItem.senderUid}" col="3" jp="" /> <nor txt="在群里喷水"/>`:null,
templId: '0',
seqId: '0',
templParam: new Map([]),
pbReserv: '0',
members: new Map([])
},
fileReceiptElement: null,
localGrayTipElement: null,
blockGrayTipElement: null,
aioOpGrayTipElement: null,
jsonGrayTipElement: null,
walletGrayTipElement: null,
};
}
});
setMsgRecord(msgItem)
});
setMsgRecord(msgItem)
});
//msgList.reverse();
} else if (args?.[0]?.callbackId === emojiCallbackId) {
// 收藏表情
localEmojiInfoList = emojis.map((item, index) => ({
uin: '',
emoId: index,
emoPath: item,
isExist: true,
resId: randomUUID(),
url: item,
md5: '',
emoOriginalPath: '',
thumbPath: '',
RomaingType: '',
isAPNG: false,
isMarkFace: false,
eId: '',
epId: '0',
ocrWord: '',
modifyWord: '',
exposeNum: 0,
clickNum: 0,
desc: '本地表情'
}));
args[1].emojiInfoList = localEmojiInfoList.concat(args[1].emojiInfoList)
//msgList.reverse();
} else if (args?.[0]?.callbackId === emojiCallbackId) {
// 收藏表情
localEmojiInfoList = emojis.map((item, index) => ({
uin: '',
emoId: index,
emoPath: item,
isExist: true,
resId: randomUUID(),
url: item,
md5: '',
emoOriginalPath: '',
thumbPath: '',
RomaingType: '',
isAPNG: false,
isMarkFace: false,
eId: '',
epId: '0',
ocrWord: '',
modifyWord: '',
exposeNum: 0,
clickNum: 0,
desc: '本地表情'
}));
args[1].emojiInfoList = localEmojiInfoList.concat(args[1].emojiInfoList)
}
} catch (error) {
console.error(error)
}

return original_send.call(window.webContents, channel, ...args);
};

Expand Down
4 changes: 2 additions & 2 deletions src/renderer/domUpMessages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { check_only_img, get_link_data, hexToHSL, output } from "./utils.js";
import { message_time, message_web } from "./myElement.js";
import { get_link_data, hexToHSL, output } from "./utils.js";
import { message_web } from "./myElement.js";
import { config } from "./config.js";
import { MsgMutation } from "./setMessage.js";

Expand Down
Loading

0 comments on commit f43cd3c

Please sign in to comment.