feat: FrameWork调整

This commit is contained in:
手瓜一十雪 2024-09-26 16:22:21 +08:00
parent 34d4358bfc
commit 652fe8d21e
3 changed files with 11 additions and 3 deletions

View File

@ -21,7 +21,8 @@ export class NapCatPathWrapper {
this.logsPath = path.join(writePath, 'logs');
this.configPath = path.join(writePath, 'config');
this.cachePath = path.join(writePath, 'cache');
this.staticPath = path.join(this.binaryPath, 'static');
//这个必然和本体一起
this.staticPath = path.join(dirname(fileURLToPath(import.meta.url)), 'static');
if (!fs.existsSync(this.logsPath)) {
fs.mkdirSync(this.logsPath, { recursive: true });
}

View File

@ -23,7 +23,14 @@ export async function NCoreInitFramework(
) {
//在进入本层前是否登录未进行判断
console.log('NapCat Framework App Loading...');
const pathWrapper = new NapCatPathWrapper();
let dataPath: string | undefined;
try {
dataPath = (global as any).LiteLoader.plugins['NapCatQQ'].path.data;
} catch (error) {
dataPath = undefined;
}
const pathWrapper = new NapCatPathWrapper(dataPath);
const logger = new LogWrapper(pathWrapper.logsPath);
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());

View File

@ -4,7 +4,7 @@ const { ipcRenderer } = require('electron');
const napcat = {
getWebUiUrl: async () => {
return ipcRenderer.invoke('napcat_get_webtoken');
},
}
};
// 在window对象下导出只读对象
contextBridge.exposeInMainWorld('napcat', napcat);