Merge branch 'main' into refactor-config-webui

This commit is contained in:
手瓜一十雪 2024-11-15 10:42:02 +08:00
commit 5ee0afb604
6 changed files with 16 additions and 6 deletions

View File

@ -4,7 +4,7 @@
"name": "NapCatQQ", "name": "NapCatQQ",
"slug": "NapCat.Framework", "slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现", "description": "高性能的 OneBot 11 协议实现",
"version": "4.0.1", "version": "4.0.3",
"icon": "./logo.png", "icon": "./logo.png",
"authors": [ "authors": [
{ {

View File

@ -2,7 +2,7 @@
"name": "napcat", "name": "napcat",
"private": true, "private": true,
"type": "module", "type": "module",
"version": "4.0.1", "version": "4.0.3",
"scripts": { "scripts": {
"build:framework": "vite build --mode framework", "build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell", "build:shell": "vite build --mode shell",

View File

@ -1 +1 @@
export const napCatVersion = '4.0.1'; export const napCatVersion = '4.0.3';

View File

@ -472,7 +472,7 @@ export class NTQQFileApi {
return IMAGE_HTTP_HOST_NT + urlRkey; return IMAGE_HTTP_HOST_NT + urlRkey;
} else if (isNTV2 && rkeyData.online_rkey) { } else if (isNTV2 && rkeyData.online_rkey) {
const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey; const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
return IMAGE_HTTP_HOST_NT + parsedUrl.pathname + `&rkey=${rkey}`; return IMAGE_HTTP_HOST_NT + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`;
} else if (isNTV2 && imageFileId) { } else if (isNTV2 && imageFileId) {
const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey; const rkey = imageAppid === '1406' ? rkeyData.private_rkey : rkeyData.group_rkey;
return IMAGE_HTTP_HOST + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`; return IMAGE_HTTP_HOST + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`;

View File

@ -8,6 +8,7 @@ const SchemaData = {
properties: { properties: {
message_id: { type: ['string', 'number'] }, message_id: { type: ['string', 'number'] },
emoji_id: { type: ['string', 'number'] }, emoji_id: { type: ['string', 'number'] },
set: { type: ['boolean', 'string'] }
}, },
required: ['message_id', 'emoji_id'], required: ['message_id', 'emoji_id'],
} as const satisfies JSONSchema; } as const satisfies JSONSchema;
@ -26,10 +27,19 @@ export class SetMsgEmojiLike extends BaseAction<Payload, any> {
if (!payload.emoji_id) { if (!payload.emoji_id) {
throw new Error('emojiId not found'); throw new Error('emojiId not found');
} }
if (!payload.set) {
payload.set = true;
}
const msgData = (await this.core.apis.MsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList; const msgData = (await this.core.apis.MsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList;
if (!msgData || msgData.length == 0 || !msgData[0].msgSeq) { if (!msgData || msgData.length == 0 || !msgData[0].msgSeq) {
throw new Error('find msg by msgid error'); throw new Error('find msg by msgid error');
} }
return await this.core.apis.MsgApi.setEmojiLike(msg.Peer, msgData[0].msgSeq, payload.emoji_id.toString(), true); return await this.core.apis.MsgApi.setEmojiLike(
msg.Peer,
msgData[0].msgSeq,
payload.emoji_id.toString(),
typeof payload.set == 'string' ? payload.set === 'true' : !!payload
);
} }
} }

View File

@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
SettingItem( SettingItem(
'<span id="napcat-update-title">Napcat</span>', '<span id="napcat-update-title">Napcat</span>',
void 0, void 0,
SettingButton("V4.0.1", "napcat-update-button", "secondary") SettingButton("V4.0.3", "napcat-update-button", "secondary")
) )
]), ]),
SettingList([ SettingList([