Comment out DatabaseApi test code
Commented out temporary DatabaseApi test blocks in packages/napcat-framework/napcat.ts and packages/napcat-shell/base.ts. These changes disable the runtime test/read of nt_msg.db (previously guarded by dbPassphrase checks) while keeping the code as commented reference to avoid noisy logs or unintended DB access during initialization.
This commit is contained in:
1 parent
0ddf21a2f5
commit
9cbaafe806
2 files changed
+30
-30
No files matched your search
@@ -121,21 +121,21 @@ export async function NCoreInitFramework (
|
||||
WebUiDataRuntime.setQQDataPath(loaderObject.core.dataPath);
|
||||
InitWebUi(logger, pathWrapper, logSubscription, statusHelperSubscription).then().catch(e => logger.logError(e));
|
||||
|
||||
// 测试 DatabaseApi
|
||||
if (dbPassphrase) {
|
||||
const dbApi = loaderObject.core.apis.DatabaseApi;
|
||||
const sqliteOk = await dbApi.isSqliteAvailable();
|
||||
if (sqliteOk) {
|
||||
try {
|
||||
const result = dbApi.readDatabase('nt_msg.db');
|
||||
if (result) {
|
||||
logger.log('[NapCat] [Database] nt_msg.db:\n' + dbApi.formatResults([result]));
|
||||
}
|
||||
} catch (e) {
|
||||
logger.logError('[NapCat] [Database] 读取失败:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 测试 DatabaseApi
|
||||
// if (dbPassphrase) {
|
||||
// const dbApi = loaderObject.core.apis.DatabaseApi;
|
||||
// const sqliteOk = await dbApi.isSqliteAvailable();
|
||||
// if (sqliteOk) {
|
||||
// try {
|
||||
// const result = dbApi.readDatabase('nt_msg.db');
|
||||
// if (result) {
|
||||
// logger.log('[NapCat] [Database] nt_msg.db:\n' + dbApi.formatResults([result]));
|
||||
// }
|
||||
// } catch (e) {
|
||||
// logger.logError('[NapCat] [Database] 读取失败:', e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 使用 NapCatAdapterManager 统一管理协议适配器
|
||||
const adapterManager = new NapCatAdapterManager(loaderObject.core, loaderObject.context, pathWrapper);
|
||||
|
||||
@@ -763,21 +763,21 @@ export class NapCatShell {
|
||||
async InitNapCat () {
|
||||
await this.core.initCore();
|
||||
|
||||
// 测试 DatabaseApi
|
||||
if (this.core.dbPassphrase) {
|
||||
const dbApi = this.core.apis.DatabaseApi;
|
||||
const sqliteOk = await dbApi.isSqliteAvailable();
|
||||
if (sqliteOk) {
|
||||
try {
|
||||
const result = dbApi.readDatabase('nt_msg.db');
|
||||
if (result) {
|
||||
this.context.logger.log('[NapCat] [Database] nt_msg.db:\n' + dbApi.formatResults([result]));
|
||||
}
|
||||
} catch (e) {
|
||||
this.context.logger.logError('[NapCat] [Database] 读取失败:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 测试 DatabaseApi
|
||||
// if (this.core.dbPassphrase) {
|
||||
// const dbApi = this.core.apis.DatabaseApi;
|
||||
// const sqliteOk = await dbApi.isSqliteAvailable();
|
||||
// if (sqliteOk) {
|
||||
// try {
|
||||
// const result = dbApi.readDatabase('nt_msg.db');
|
||||
// if (result) {
|
||||
// this.context.logger.log('[NapCat] [Database] nt_msg.db:\n' + dbApi.formatResults([result]));
|
||||
// }
|
||||
// } catch (e) {
|
||||
// this.context.logger.logError('[NapCat] [Database] 读取失败:', e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 监听下线通知并同步到 WebUI
|
||||
this.core.event.on('KickedOffLine', (tips: string) => {
|
||||
|
||||
Reference in new issue
Block a user