fix: get config return null ref

This commit is contained in:
Disy 2024-02-20 00:10:46 +08:00
parent 6e97044437
commit 20399dc369
2 changed files with 6 additions and 4 deletions

View File

@ -22,7 +22,7 @@ LiteLoaderQQNT的OneBot11协议插件
- [x] http调用api - [x] http调用api
- [x] http事件上报 - [x] http事件上报
- [x] 正向websocket - [x] 正向websocket
- [ ] 反向websocket - [x] 反向websocket
主要功能: 主要功能:
- [x] 发送好友消息 - [x] 发送好友消息
@ -108,7 +108,7 @@ LiteLoaderQQNT的OneBot11协议插件
## TODO ## TODO
- [x] 重构摆脱LLAPI目前调用LLAPI只能在renderer进程调用需重构成在main进程调用 - [x] 重构摆脱LLAPI目前调用LLAPI只能在renderer进程调用需重构成在main进程调用
- [x] 支持正向websocket - [x] 支持正、反向websocket(感谢@disymayufei的PR
- [ ] 转发消息记录 - [ ] 转发消息记录
- [ ] 好友点赞api - [ ] 好友点赞api

View File

@ -16,6 +16,7 @@ export class ConfigUtil {
} }
this.reloadConfig(); this.reloadConfig();
return this.config;
} }
setConfig(config: Config) { setConfig(config: Config) {
@ -37,7 +38,8 @@ export class ConfigUtil {
}; };
if (!fs.existsSync(this.configPath)) { if (!fs.existsSync(this.configPath)) {
return defaultConfig this.config = defaultConfig;
return;
} else { } else {
const data = fs.readFileSync(this.configPath, "utf-8"); const data = fs.readFileSync(this.configPath, "utf-8");
let jsonData: Config = defaultConfig; let jsonData: Config = defaultConfig;
@ -62,7 +64,7 @@ export class ConfigUtil {
jsonData.token = ""; jsonData.token = "";
} }
return jsonData; this.config = jsonData;
} }
} }
} }