diff --git a/src/webui/src/api/OB11Config.ts b/src/webui/src/api/OB11Config.ts index bfbd3e17..7c07be93 100644 --- a/src/webui/src/api/OB11Config.ts +++ b/src/webui/src/api/OB11Config.ts @@ -37,13 +37,13 @@ export const OB11GetConfigHandler: RequestHandler = async (req, res) => { } export const OB11SetConfigHandler: RequestHandler = async (req, res) => { let isLogin = await DataRuntime.getQQLoginStatus(); - if (!isLogin) { - res.send({ - code: -1, - message: 'Not Login' - }); - return; - } + // if (!isLogin) { + // res.send({ + // code: -1, + // message: 'Not Login' + // }); + // return; + // } if (isEmpty(req.body.config)) { res.send({ code: -1, @@ -53,7 +53,7 @@ export const OB11SetConfigHandler: RequestHandler = async (req, res) => { } let configFilePath = resolve(__dirname, `./config/onebot_${await DataRuntime.getQQLoginUin()}.json`); try { - require(configFilePath); + readFileSync(configFilePath); } catch (e) { configFilePath = resolve(__dirname, `./config/onebot.json`); diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index 3ddc4c3e..e902f9ce 100644 --- a/src/webui/ui/NapCat.ts +++ b/src/webui/ui/NapCat.ts @@ -8,7 +8,11 @@ async function onSettingWindowCreated(view: Element) { const isEmpty = (value: any) => value === undefined || value === undefined || value === ''; let ob11Config: OB11Config = await OB11ConfigWrapper.GetOB11Config(); const setOB11Config = (key: string, value: any) => { - console.log(key, value); + const configKey = key.split('.'); + if (configKey.length === 2) { + ob11Config[configKey[1]] = value; + } + OB11ConfigWrapper.SetOB11Config(ob11Config); } const parser = new DOMParser();