Refactor interfaces and decouple backend dependencies

Introduced new interface definitions in napcat-common for logging, status, and subscription. Refactored napcat-webui-backend to use these interfaces, decoupling it from napcat-core and napcat-onebot. Moved OneBot config schema to backend and updated imports. Updated framework and shell to pass subscriptions to InitWebUi. Improved type safety and modularity across backend and shared packages.
This commit is contained in:
手瓜一十雪 committed 2025-11-16 10:58:30 +08:00
1 parent 71ee45d27a
commit 2012f78343
15 files changed
+248 -69

No files matched your search

+1 -2
View File
@@ -1,8 +1,7 @@
import type { RequestHandler } from 'express';
import { sendError, sendSuccess } from '../utils/response';
import { logSubscription } from 'napcat-core/helper/log';
import { terminalManager } from '../terminal/terminal_manager';
import { WebUiConfig } from '@/napcat-webui-backend/index';
import { logSubscription, WebUiConfig } from '@/napcat-webui-backend/index';
// 判断是否是 macos
const isMacOS = process.platform === 'darwin';
@@ -1,7 +1,7 @@
import { RequestHandler } from 'express';
import { existsSync, readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { loadConfig, OneBotConfig } from 'napcat-onebot/config/config';
import { loadConfig, OneBotConfig } from '@/napcat-webui-backend/src/onebot/config';
import { webUiPathWrapper } from '@/napcat-webui-backend/index';
import { WebUiDataRuntime } from '@/napcat-webui-backend/src/helper/Data';
import { sendError, sendSuccess } from '@/napcat-webui-backend/src/utils/response';
@@ -1,6 +1,6 @@
import { statusHelperSubscription } from '@/napcat-webui-backend';
import { RequestHandler } from 'express';
import { SystemStatus, statusHelperSubscription } from 'napcat-core/helper/status';
import { SystemStatus } from 'napcat-common/src/status-interface';
export const StatusRealTimeHandler: RequestHandler = async (req, res) => {
res.setHeader('Content-Type', 'text/event-stream');
res.setHeader('Connection', 'keep-alive');