Compare commits

...

8 Commits

Author SHA1 Message Date
手瓜一十雪
89f7892681 fix: rkey 2024-11-14 23:30:52 +08:00
Mlikiowa
aad5ed55d2 release: v4.0.2
Some checks are pending
Build Action / Build-LiteLoader (push) Waiting to run
Build Action / Build-Shell (push) Waiting to run
2024-11-14 12:45:02 +00:00
手瓜一十雪
86da417c17 feat: add SetMsgEmojiLike 2024-11-14 20:44:14 +08:00
Mlikiowa
96b1f71437 release: v4.0.1 2024-11-14 07:43:36 +00:00
手瓜一十雪
5e0b3b2f35 fix: fluent-ffmpeg 2024-11-14 15:43:11 +08:00
pk5ls20
6829fad5bd chore: workflow build check 2024-11-14 14:30:56 +08:00
pk5ls20
7af0d9e87b refactor: simplify code 2024-11-14 14:29:38 +08:00
Mlikiowa
c089ebea99 release: v4.0.0 2024-11-14 06:00:34 +00:00
11 changed files with 49 additions and 43 deletions

View File

@@ -1,5 +1,8 @@
name: "Build Action"
on:
push:
branches:
- main
workflow_dispatch:
permissions: write-all

View File

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

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "3.7.0",
"version": "4.0.2",
"scripts": {
"build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell",
@@ -44,13 +44,13 @@
"vite": "^5.2.6",
"vite-plugin-cp": "^4.0.8",
"vite-tsconfig-paths": "^5.1.0",
"winston": "^3.17.0",
"fluent-ffmpeg": "^2.1.2"
"winston": "^3.17.0"
},
"dependencies": {
"express": "^5.0.0",
"silk-wasm": "^3.6.1",
"ws": "^8.18.0",
"qrcode-terminal": "^0.12.0"
"qrcode-terminal": "^0.12.0",
"fluent-ffmpeg": "^2.1.2"
}
}

View File

@@ -1 +1 @@
export const napCatVersion = '3.7.0';
export const napCatVersion = '4.0.2';

View File

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

View File

@@ -65,35 +65,22 @@ export class PacketOperationContext {
}
async UploadResources(msg: PacketMsg[], groupUin: number = 0) {
const reqList = [];
for (const m of msg) {
for (const e of m.msg) {
const chatType = groupUin ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C;
const peerUid = groupUin ? String(groupUin) : this.context.napcore.basicInfo.uid;
const reqList = msg.flatMap(m =>
m.msg.map(e => {
if (e instanceof PacketMsgPicElement) {
reqList.push(this.context.highway.uploadImage({
chatType: groupUin ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C,
peerUid: groupUin ? String(groupUin) : this.context.napcore.basicInfo.uid
}, e));
return this.context.highway.uploadImage({ chatType, peerUid }, e);
} else if (e instanceof PacketMsgVideoElement) {
return this.context.highway.uploadVideo({ chatType, peerUid }, e);
} else if (e instanceof PacketMsgPttElement) {
return this.context.highway.uploadPtt({ chatType, peerUid }, e);
} else if (e instanceof PacketMsgFileElement) {
return this.context.highway.uploadFile({ chatType, peerUid }, e);
}
if (e instanceof PacketMsgVideoElement) {
reqList.push(this.context.highway.uploadVideo({
chatType: groupUin ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C,
peerUid: groupUin ? String(groupUin) : this.context.napcore.basicInfo.uid
}, e));
}
if (e instanceof PacketMsgPttElement) {
reqList.push(this.context.highway.uploadPtt({
chatType: groupUin ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C,
peerUid: groupUin ? String(groupUin) : this.context.napcore.basicInfo.uid
}, e));
}
if (e instanceof PacketMsgFileElement) {
reqList.push(this.context.highway.uploadFile({
chatType: groupUin ? ChatType.KCHATTYPEGROUP : ChatType.KCHATTYPEC2C,
peerUid: groupUin ? String(groupUin) : this.context.napcore.basicInfo.uid
}, e));
}
}
}
return null;
}).filter(Boolean)
);
const res = await Promise.allSettled(reqList);
this.context.logger.info(`上传资源${res.length}个,失败${res.filter(r => r.status === 'rejected').length}`);
res.forEach((result, index) => {

View File

@@ -45,11 +45,17 @@ export class Sha1Stream {
let e = this._state[4];
for (let i = 0; i < 80; i++) {
const [f, k] = (i < 20) ? [(b & c) | ((~b) & d), 0x5A827999] :
(i < 40) ? [b ^ c ^ d, 0x6ED9EBA1] :
(i < 60) ? [(b & c) | (b & d) | (c & d), 0x8F1BBCDC] :
[b ^ c ^ d, 0xCA62C1D6];
const temp = (this.rotateLeft(a, 5) + f + k + e + w[i]) >>> 0;
let temp;
if (i < 20) {
temp = ((b & c) | (~b & d)) + 0x5A827999;
} else if (i < 40) {
temp = (b ^ c ^ d) + 0x6ED9EBA1;
} else if (i < 60) {
temp = ((b & c) | (b & d) | (c & d)) + 0x8F1BBCDC;
} else {
temp = (b ^ c ^ d) + 0xCA62C1D6;
}
temp += ((this.rotateLeft(a, 5) + e + w[i]) >>> 0);
e = d;
d = c;
c = this.rotateLeft(b, 30) >>> 0;

View File

@@ -8,6 +8,7 @@ const SchemaData = {
properties: {
message_id: { type: ['string', 'number'] },
emoji_id: { type: ['string', 'number'] },
set: { type: ['boolean', 'string'] }
},
required: ['message_id', 'emoji_id'],
} as const satisfies JSONSchema;
@@ -26,10 +27,19 @@ export class SetMsgEmojiLike extends BaseAction<Payload, any> {
if (!payload.emoji_id) {
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;
if (!msgData || msgData.length == 0 || !msgData[0].msgSeq) {
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

@@ -290,7 +290,7 @@ export async function NCoreInitShell() {
await initializeEngine(engine, basicInfoWrapper, dataPathGlobal, systemPlatform, systemVersion);
await initializeLoginService(loginService, basicInfoWrapper, dataPathGlobal, systemVersion, hostname);
let quickLoginUin = cmdOptions.qq;
const quickLoginUin = cmdOptions.qq;
const historyLoginList = (await loginService.getLoginList()).LocalLoginInfoList;
const dataTimestape = new Date().getTime().toString();

View File

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

View File

@@ -4,7 +4,7 @@ import { resolve } from 'path';
import nodeResolve from '@rollup/plugin-node-resolve';
import { builtinModules } from 'module';
//依赖排除
const external = ['silk-wasm', 'ws', 'express', 'qrcode-terminal'];
const external = ['silk-wasm', 'ws', 'express', 'qrcode-terminal', 'fluent-ffmpeg'];
const nodeModules = [...builtinModules, builtinModules.map(m => `node:${m}`)].flat();
function genCpModule(module: string) {
return { src: `./node_modules/${module}`, dest: `dist/node_modules/${module}`, flatten: false };