Compare commits

...

7 Commits

Author SHA1 Message Date
手瓜一十雪
857b191b03 feat: sse完全体 2025-01-20 17:35:31 +08:00
Mlikiowa
09014d1ab5 release: v4.3.8 2025-01-20 09:18:32 +00:00
手瓜一十雪
7557b71869 fix: httpSseServers DefaultConfig 2025-01-20 17:02:52 +08:00
Mlikiowa
d07187bd5d release: v4.3.7 2025-01-20 08:48:13 +00:00
手瓜一十雪
2c6a6ba440 fix: type 2025-01-20 16:47:06 +08:00
手瓜一十雪
4592bf7817 fix: nickname可能为null 2025-01-20 16:06:34 +08:00
Mlikiowa
afd6d450a0 release: v4.3.6 2025-01-20 06:51:29 +00:00
12 changed files with 83 additions and 10 deletions

View File

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

View File

@@ -19,9 +19,11 @@
<t-tabs ref="tabsRef" :style="{ width: tabsWidth + 'px' }" default-value="all" @change="selectType">
<t-tab-panel value="all" label="全部"></t-tab-panel>
<t-tab-panel value="httpServers" label="HTTP 服务器"></t-tab-panel>
<t-tab-panel value="httpSeeServers" label="HTTP SSE 服务器"></t-tab-panel>
<t-tab-panel value="httpClients" label="HTTP 客户端"></t-tab-panel>
<t-tab-panel value="websocketServers" label="WebSocket 服务器"></t-tab-panel>
<t-tab-panel value="websocketClients" label="WebSocket 客户端"></t-tab-panel>
</t-tabs>
</div>
<t-loading attach="#alice" :loading="!loadPage" :showOverlay="false">
@@ -199,6 +201,7 @@
>
<t-select v-model="newTab.type" @change="onloadDefault">
<t-option value="httpServers">HTTP 服务器</t-option>
<t-option value="httpSseServers">HTTP SSE 服务器</t-option>
<t-option value="httpClients">HTTP 客户端</t-option>
<t-option value="websocketServers">WebSocket 服务器</t-option>
<t-option value="websocketClients">WebSocket 客户端</t-option>
@@ -266,6 +269,7 @@ const componentMap: Record<
| typeof WebsocketClientComponent
> = {
httpServers: HttpServerComponent,
httpSseServers: HttpServerComponent,
httpClients: HttpClientComponent,
websocketServers: WebsocketServerComponent,
websocketClients: WebsocketClientComponent,
@@ -279,6 +283,7 @@ const configIndex = ref<number>(0);
const networkConfig: NetworkConfig & { [key: string]: any } = {
websocketClients: [],
websocketServers: [],
httpSseServers: [],
httpClients: [],
httpServers: [],
};
@@ -289,6 +294,7 @@ const WebConfg = ref(
['all', []],
['httpServers', []],
['httpClients', []],
['httpSseServers', []],
['websocketServers', []],
['websocketClients', []],
])
@@ -296,6 +302,7 @@ const WebConfg = ref(
const typeCh: Record<ComponentKey, string> = {
httpServers: 'HTTP 服务器',
httpClients: 'HTTP 客户端',
httpSseServers: 'HTTP SSE 服务器',
websocketServers: 'WebSocket 服务器',
websocketClients: 'WebSocket 客户端',
};

View File

@@ -0,0 +1,58 @@
<template>
<div>
<t-form labelAlign="left">
<t-form-item label="启用">
<t-switch v-model="config.enable" />
</t-form-item>
<t-form-item label="端口">
<t-input v-model.number="config.port" type="number" />
</t-form-item>
<t-form-item label="主机">
<t-input v-model="config.host" type="text" />
</t-form-item>
<t-form-item label="报告自身消息">
<t-switch v-model="config.reportSelfMessage" />
</t-form-item>
<t-form-item label="启用 CORS">
<t-switch v-model="config.enableCors" />
</t-form-item>
<t-form-item label="启用 WS">
<t-switch v-model="config.enableWebsocket" />
</t-form-item>
<t-form-item label="消息格式">
<t-select v-model="config.messagePostFormat" :options="messageFormatOptions" />
</t-form-item>
<t-form-item label="Token">
<t-input v-model="config.token" type="text" />
</t-form-item>
<t-form-item label="调试模式">
<t-switch v-model="config.debug" />
</t-form-item>
</t-form>
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue';
import { HttpSseServerConfig } from '../../../../src/onebot/config/config';
const props = defineProps<{
config: HttpSseServerConfig;
}>();
const messageFormatOptions = ref([
{ label: 'Array', value: 'array' },
{ label: 'String', value: 'string' },
]);
watch(
() => props.config.messagePostFormat,
(newValue) => {
if (newValue !== 'array' && newValue !== 'string') {
props.config.messagePostFormat = 'array';
}
}
);
</script>
<style scoped></style>

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "4.3.5",
"version": "4.3.8",
"scripts": {
"build:universal": "npm run build:webui && vite build --mode universal || exit 1",
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",

View File

@@ -1 +1 @@
export const napCatVersion = '4.3.5';
export const napCatVersion = '4.3.8';

View File

@@ -18,7 +18,7 @@ export interface BuddyCategoryType {
export interface CoreInfo {
uid: string;
uin: string;
nick: string;
nick?: string;
remark: string;
}

View File

@@ -0,0 +1 @@
import '@/universal/napcat';

View File

@@ -139,13 +139,14 @@ export const defaultOneBotConfigs = createDefaultConfig<OneBotConfig>({
});
export const mergeNetworkDefaultConfig = {
httpSseServers: httpSseServerDefaultConfigs,
httpServers: httpServerDefaultConfigs,
httpClients: httpClientDefaultConfigs,
websocketServers: websocketServerDefaultConfigs,
websocketClients: websocketClientDefaultConfigs,
} as const;
export type NetworkConfigAdapter = HttpServerConfig | HttpClientConfig | WebsocketServerConfig | WebsocketClientConfig | PluginConfig;
export type NetworkConfigAdapter = HttpServerConfig | HttpSseServerConfig | HttpClientConfig | WebsocketServerConfig | WebsocketClientConfig | PluginConfig;
type NetworkConfigKeys = keyof typeof mergeNetworkDefaultConfig;
export function mergeOneBotConfigs(

View File

@@ -23,7 +23,7 @@ export class OB11Construct {
...rawFriend.baseInfo,
...rawFriend.coreInfo,
user_id: parseInt(rawFriend.coreInfo.uin),
nickname: rawFriend.coreInfo.nick,
nickname: rawFriend.coreInfo.nick ?? "",
remark: rawFriend.coreInfo.remark ?? rawFriend.coreInfo.nick,
sex: this.sex(rawFriend.baseInfo.sex),
level: 0,

View File

@@ -129,8 +129,8 @@ export class NapCatOneBot11Adapter {
);
}
}
for(const key of ob11Config.network.httpSseServers){
if(key.enable) {
for (const key of ob11Config.network.httpSseServers) {
if (key.enable) {
this.networkManager.registerAdapter(
new OB11ActiveHttpSSEAdapter(key.name, key, this.core, this, this.actions)
);
@@ -210,6 +210,7 @@ export class NapCatOneBot11Adapter {
await this.handleConfigChange(prev.network.httpServers, now.network.httpServers, OB11PassiveHttpAdapter);
await this.handleConfigChange(prev.network.httpClients, now.network.httpClients, OB11ActiveHttpAdapter);
await this.handleConfigChange(prev.network.httpSseServers, now.network.httpSseServers, OB11ActiveHttpSSEAdapter);
await this.handleConfigChange(prev.network.websocketServers, now.network.websocketServers, OB11PassiveWebSocketAdapter);
await this.handleConfigChange(prev.network.websocketClients, now.network.websocketClients, OB11ActiveWebSocketAdapter);
}

6
src/universal/LiteLoader.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
declare global {
namespace globalThis {
var LiteLoader: Symbol;
}
}
export {}

View File

@@ -1,7 +1,6 @@
import { NCoreInitShell } from "@/shell/base";
export * from "@/framework/napcat";
export * from "@/shell/base";
if ((global as any).LiteLoader == undefined) {
if (global.LiteLoader == undefined) {
NCoreInitShell();
}