Merge remote-tracking branch 'origin/v3.4.0' into v3.4.0

# Conflicts:
#	src/common/config.ts
This commit is contained in:
linyuchen 2024-02-20 15:46:41 +08:00
commit a4301f0b55
2 changed files with 9 additions and 6 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

@ -10,12 +10,13 @@ export class ConfigUtil {
constructor(configPath: string) { constructor(configPath: string) {
this.configPath = configPath; this.configPath = configPath;
} }
getConfig(){
getConfig(): Config {
if (this.config) { if (this.config) {
return this.config; return this.config;
} }
this.config = this.reloadConfig(); this.reloadConfig();
return this.config; return this.config;
} }
reloadConfig(): Config { reloadConfig(): Config {
@ -37,9 +38,11 @@ export class ConfigUtil {
debug: false, debug: false,
log: false, log: false,
reportSelfMessage: false reportSelfMessage: false
} };
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;