mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
release: 2.2.39
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "2.2.38",
|
"version": "2.2.39",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.2.38",
|
"version": "2.2.39",
|
||||||
"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",
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '2.2.38';
|
export const napCatVersion = '2.2.39';
|
||||||
|
@@ -131,23 +131,24 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
private async handleMessage(message: any) {
|
private async handleMessage(message: any) {
|
||||||
let receiveData: { action: ActionName, params?: any, echo?: any } = { action: ActionName.Unknown, params: {} };
|
let receiveData: { action: ActionName, params?: any, echo?: any } = { action: ActionName.Unknown, params: {} };
|
||||||
let echo = undefined;
|
let echo = undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
receiveData = JSON.parse(message.toString());
|
||||||
receiveData = JSON.parse(message.toString());
|
echo = receiveData.echo;
|
||||||
echo = receiveData.echo;
|
this.logger.logDebug('[OneBot] [WebSocket Client] 收到正向Websocket消息', receiveData);
|
||||||
this.logger.logDebug('[OneBot] [WebSocket Client] 收到正向Websocket消息', receiveData);
|
|
||||||
} catch (e) {
|
|
||||||
this.checkStateAndReply<any>(OB11Response.error('json解析失败,请检查数据格式', 1400, echo));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
receiveData.params = (receiveData?.params) ? receiveData.params : {};//兼容类型验证
|
|
||||||
const retdata = await this.actions.get(receiveData.action)
|
|
||||||
?.websocketHandle(receiveData.params, echo ?? '');
|
|
||||||
const packet = Object.assign({}, retdata);
|
|
||||||
this.checkStateAndReply<any>(packet);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.logError('[OneBot] [WebSocket Client] 发生错误', e);
|
this.checkStateAndReply<any>(OB11Response.error('json解析失败,请检查数据格式', 1400, echo));
|
||||||
this.checkStateAndReply<any>(OB11Response.error('不支持的api ' + receiveData.action, 1404, echo));
|
return;
|
||||||
}
|
}
|
||||||
|
receiveData.params = (receiveData?.params) ? receiveData.params : {};//兼容类型验证
|
||||||
|
const action = this.actions.get(receiveData.action);
|
||||||
|
if (!action) {
|
||||||
|
this.logger.logError('[OneBot] [WebSocket Client] 发生错误', '不支持的api ' + receiveData.action);
|
||||||
|
this.checkStateAndReply<any>(OB11Response.error('不支持的api ' + receiveData.action, 1404, echo));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const retdata = await action?.websocketHandle(receiveData.params, echo ?? '');
|
||||||
|
const packet = Object.assign({}, retdata);
|
||||||
|
this.checkStateAndReply<any>(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -146,22 +146,23 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
let receiveData: { action: ActionName, params?: any, echo?: any } = { action: ActionName.Unknown, params: {} };
|
let receiveData: { action: ActionName, params?: any, echo?: any } = { action: ActionName.Unknown, params: {} };
|
||||||
let echo = undefined;
|
let echo = undefined;
|
||||||
try {
|
try {
|
||||||
try {
|
receiveData = JSON.parse(message.toString());
|
||||||
receiveData = JSON.parse(message.toString());
|
echo = receiveData.echo;
|
||||||
echo = receiveData.echo;
|
//this.logger.logDebug('收到正向Websocket消息', receiveData);
|
||||||
//this.logger.logDebug('收到正向Websocket消息', receiveData);
|
|
||||||
} catch (e) {
|
|
||||||
this.checkStateAndReply<any>(OB11Response.error('json解析失败,请检查数据格式', 1400, echo), wsClient);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
receiveData.params = (receiveData?.params) ? receiveData.params : {};//兼容类型验证
|
|
||||||
const retdata = await this.actions.get(receiveData.action)?.websocketHandle(receiveData.params, echo ?? '');
|
|
||||||
const packet = Object.assign({}, retdata);
|
|
||||||
this.checkStateAndReply<any>(packet, wsClient);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.checkStateAndReply<any>(OB11Response.error('不支持的api ' + receiveData.action, 1404, echo), wsClient);
|
this.checkStateAndReply<any>(OB11Response.error('json解析失败,请检查数据格式', 1400, echo), wsClient);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
receiveData.params = (receiveData?.params) ? receiveData.params : {};//兼容类型验证
|
||||||
|
const action = this.actions.get(receiveData.action);
|
||||||
|
if (!action) {
|
||||||
|
this.logger.logError('[OneBot] [WebSocket Client] 发生错误', '不支持的api ' + receiveData.action);
|
||||||
|
this.checkStateAndReply<any>(OB11Response.error('不支持的api ' + receiveData.action, 1404, echo), wsClient);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const retdata = await action.websocketHandle(receiveData.params, echo ?? '');
|
||||||
|
const packet = Object.assign({}, retdata);
|
||||||
|
this.checkStateAndReply<any>(packet, wsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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.2.38', 'napcat-update-button', 'secondary'),
|
SettingButton('V2.2.39', 'napcat-update-button', 'secondary'),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
@@ -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.2.38", "napcat-update-button", "secondary")
|
SettingButton("V2.2.39", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user