webui
webui copied to clipboard
Bug: plugin-config 停用分组后 操作分组内的插件 会报错
复现方式
- 新建分组
- 分组内添加插件
- 停用分组
- 启用或停用分组内的插件
错误日志
loader TypeError: Cannot read properties of undefined (reading 'ctx')
at Proxy.unload (/home/project/TSWorkSpace/koishi/development/koishi-dev/node_modules/@koishijs/plugin-config/src/shared/writer.ts:153:30)
at _Client.ctx.console.addListener.authority (/home/project/TSWorkSpace/koishi/development/koishi-dev/node_modules/@koishijs/plugin-config/src/shared/writer.ts:59:27)
at WebSocket.receive (/home/project/TSWorkSpace/koishi/development/koishi-dev/node_modules/@koishijs/plugin-console/node_modules/@koishijs/console/src/client.ts:35:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
分组停用后 应该禁止操作分组内的插件 只允许修改配置
复现了, 但是我这个复现方式这种情况在正常使用的时候不会用到(
当 manager/unload 那个 ConfigWriter.unload 的 config 参数是空 Object ({}) 的时候就炸了
用这个 koishi-plugin-expose-ctx 就可以拿到 @koishijs/client 的 send as sendClient 了(
https://cdn.discordapp.com/attachments/1181941664735043584/1207951121000173650/2024-02-16_15-25-18.mkv?ex=65e18325&is=65cf0e25&hm=92faf69a7a495add6199a791cd6d7581599e39ee8a116f6f3b3d179674da6a98&
https://github.com/koishijs/webui/assets/68551684/31a2f4b1-9e07-486c-a5b4-a14f7e5fd891