Compare commits

..

2 Commits

Author SHA1 Message Date
手瓜一十雪
daf42c8203 release: 2.4.2 2024-09-09 15:04:19 +08:00
手瓜一十雪
0a18bae3b5 fix: #351 2024-09-09 15:04:00 +08:00
13 changed files with 21 additions and 20 deletions

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ", "name": "NapCatQQ",
"slug": "NapCat.Framework", "slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现", "description": "高性能的 OneBot 11 协议实现",
"version": "2.4.1", "version": "2.4.2",
"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": "2.4.1", "version": "2.4.2",
"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

@@ -216,7 +216,7 @@ export async function checkUriType(Uri: string) {
return { Uri: filePath, Type: FileUriType.Local }; return { Uri: filePath, Type: FileUriType.Local };
} }
if (uri.startsWith('data:')) { if (uri.startsWith('data:')) {
let data = uri.split(',')[1]; const data = uri.split(',')[1];
if (data) return { Uri: data, Type: FileUriType.Base64 }; if (data) return { Uri: data, Type: FileUriType.Base64 };
} }
}, Uri); }, Uri);

View File

@@ -1 +1 @@
export const napCatVersion = '2.4.1'; export const napCatVersion = '2.4.2';

View File

@@ -51,7 +51,7 @@ export class GetGroupEssence extends BaseAction<Payload, any> {
operator_nick: msg.add_digest_nick, operator_nick: msg.add_digest_nick,
message_id: message_id, message_id: message_id,
operator_time: msg.add_digest_time, operator_time: msg.add_digest_time,
content: (await this.obContext.apis.MsgApi.parseMessage(rawMessage, 'array'))?.message content: (await this.obContext.apis.MsgApi.parseMessage(rawMessage))?.message
}; };
} }
const msgTempData = JSON.stringify({ const msgTempData = JSON.stringify({

View File

@@ -35,7 +35,7 @@ class GetMsg extends BaseAction<Payload, OB11Message> {
const msg = await this.core.apis.MsgApi.getMsgsByMsgId( const msg = await this.core.apis.MsgApi.getMsgsByMsgId(
peer, peer,
[msgIdWithPeer?.MsgId || payload.message_id.toString()]); [msgIdWithPeer?.MsgId || payload.message_id.toString()]);
const retMsg = await this.obContext.apis.MsgApi.parseMessage(msg.msgList[0], 'array'); const retMsg = await this.obContext.apis.MsgApi.parseMessage(msg.msgList[0]);
if (!retMsg) throw Error('消息为空'); if (!retMsg) throw Error('消息为空');
try { try {
retMsg.message_id = MessageUnique.createUniqueMsgId(peer, msg.msgList[0].msgId)!; retMsg.message_id = MessageUnique.createUniqueMsgId(peer, msg.msgList[0].msgId)!;

View File

@@ -21,7 +21,7 @@ export default class GetRecentContact extends BaseAction<Payload, any> {
const FastMsg = await this.core.apis.MsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]); const FastMsg = await this.core.apis.MsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
if (FastMsg.msgList.length > 0) { if (FastMsg.msgList.length > 0) {
//扩展ret.info.changedList //扩展ret.info.changedList
const lastestMsg = await this.obContext.apis.MsgApi.parseMessage(FastMsg.msgList[0], 'array'); const lastestMsg = await this.obContext.apis.MsgApi.parseMessage(FastMsg.msgList[0]);
return { return {
lastestMsg: lastestMsg, lastestMsg: lastestMsg,
peerUin: t.peerUin, peerUin: t.peerUin,

View File

@@ -78,8 +78,8 @@ export class OneBotGroupApi {
id: FileNapCatOneBotUUID.encode({ id: FileNapCatOneBotUUID.encode({
chatType: ChatType.KCHATTYPEGROUP, chatType: ChatType.KCHATTYPEGROUP,
peerUid: msg.peerUid, peerUid: msg.peerUid,
}, msg.msgId, element.elementId, "."+element.fileElement.fileName), }, msg.msgId, element.elementId, "." + element.fileElement.fileName),
url: pathToFileURL(element.fileElement.filePath), url: pathToFileURL(element.fileElement.filePath).href,
name: element.fileElement.fileName, name: element.fileElement.fileName,
size: parseInt(element.fileElement.fileSize), size: parseInt(element.fileElement.fileSize),
busid: element.fileElement.fileBizId || 0, busid: element.fileElement.fileBizId || 0,

View File

@@ -137,7 +137,7 @@ export class OneBotMsgApi {
data: { data: {
file: element.fileName, file: element.fileName,
path: element.filePath, path: element.filePath,
url: pathToFileURL(element.filePath), url: pathToFileURL(element.filePath).href,
file_id: FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "."+element.fileName), file_id: FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "."+element.fileName),
file_size: element.fileSize, file_size: element.fileSize,
file_unique: element.fileName, file_unique: element.fileName,
@@ -177,9 +177,9 @@ export class OneBotMsgApi {
peerUid: msg.peerUid, peerUid: msg.peerUid,
guildId: '', guildId: '',
}; };
const { emojiId } = _; const { emojiId } = _;
const dir = emojiId.substring(0, 2); const dir = emojiId.substring(0, 2);
const url = `https://gxh.vip.qq.com/club/item/parcel/item/${dir}/${emojiId}/raw300.gif` const url = `https://gxh.vip.qq.com/club/item/parcel/item/${dir}/${emojiId}/raw300.gif`;
return { return {
type: OB11MessageDataType.image, type: OB11MessageDataType.image,
data: { data: {
@@ -262,13 +262,13 @@ export class OneBotMsgApi {
if (!videoDownUrl) { if (!videoDownUrl) {
videoDownUrl = element.filePath; videoDownUrl = element.filePath;
} }
const fileCode = FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "."+element.fileName) const fileCode = FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "."+element.fileName);
return { return {
type: OB11MessageDataType.video, type: OB11MessageDataType.video,
data: { data: {
file: fileCode, file: fileCode,
path: videoDownUrl, path: videoDownUrl,
url: videoDownUrl ?? pathToFileURL(element.filePath), url: videoDownUrl ?? pathToFileURL(element.filePath).href,
file_id: fileCode, file_id: fileCode,
file_size: element.fileSize, file_size: element.fileSize,
file_unique: element.fileName, file_unique: element.fileName,
@@ -288,7 +288,7 @@ export class OneBotMsgApi {
data: { data: {
file: fileCode, file: fileCode,
path: element.filePath, path: element.filePath,
url: pathToFileURL(element.filePath), url: pathToFileURL(element.filePath).href,
file_id: fileCode, file_id: fileCode,
file_size: element.fileSize, file_size: element.fileSize,
file_unique: element.fileName file_unique: element.fileName

View File

@@ -84,6 +84,7 @@ export interface OB11MessageText {
export interface OB11MessageFileBase { export interface OB11MessageFileBase {
data: { data: {
file_unique?:string,
path?: string; path?: string;
thumb?: string; thumb?: string;
name?: string; name?: string;

View File

@@ -150,7 +150,7 @@ export async function NCoreInitShell() {
}; };
loginService.addKernelLoginListener(proxiedListenerOf(loginListener, logger) as any); loginService.addKernelLoginListener(proxiedListenerOf(loginListener, logger) as any);
let isConnect = loginService.connect(); const isConnect = loginService.connect();
if (!isConnect) { if (!isConnect) {
logger.logError('核心登录服务连接失败!'); logger.logError('核心登录服务连接失败!');
return; return;
@@ -204,7 +204,7 @@ export async function NCoreInitShell() {
logger.log(`可用于快速登录的 QQ\n${historyLoginList logger.log(`可用于快速登录的 QQ\n${historyLoginList
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`) .map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
.join('\n') .join('\n')
}`); }`);
} }
loginService.getQRCodePicture(); loginService.getQRCodePicture();
} }

View File

@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
SettingItem( SettingItem(
'<span id="napcat-update-title">Napcat</span>', '<span id="napcat-update-title">Napcat</span>',
undefined, undefined,
SettingButton('V2.4.1', 'napcat-update-button', 'secondary'), SettingButton('V2.4.2', 'napcat-update-button', 'secondary'),
), ),
]), ]),
SettingList([ SettingList([

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("V2.4.1", "napcat-update-button", "secondary") SettingButton("V2.4.2", "napcat-update-button", "secondary")
) )
]), ]),
SettingList([ SettingList([