主要更新内容
- 新增插件系统:支持通过 ZIP 包(
komari-plugin.json清单)安装插件,默认接入官方插件市场。 - 插件通过
server模块获得宿主能力(route、hook、injectHTML、call、registerRPC、getConfig);路由、钩子、HTML 注入、系统 RPC 等权限需在清单中声明并经管理员批准。 - 新增插件持久化数据目录
data/plugin-data(更新/重装后保留),插件启用状态与错误信息保存于data/plugin/state.json。 - 新增 HTML 注入能力与对应权限,插件可在所有 text/html 页面注入 head/body 片段。
- 重构并模块化 JavaScript 运行时:新增
node:stream、crypto模块,完善events、fs、fetch、child_process等内置模块;不支持的方法改为明确抛错而不是静默 no-op。 - 补充 jsruntime API 与兼容性文档(
pkg/jsruntime/README.md)。 - 启动时自动创建
./data/plugin与./data/plugin-data目录,并新增插件配置数据表。
Bug修复
- 修复 jsruntime 将
process.exit(0)视为异常终止的问题,并改进错误上报。 - 修复存在插件 response hook 时流式响应(如实时预览)被缓冲吞掉、客户端收不到数据的问题;限制 hook 缓冲大小并支持安全重装插件。
其他
- metricstore 移至
internal/metricstore并拆分组件,移除旧版本兼容代码及未使用的数据库查询函数。 - 新增插件市场源配置项
plugin_market_sources。 - 插件安装校验增强:拒绝路径穿越条目、校验 Komari 版本约束,入口脚本默认
script.js。
Commits
- style: 移除没有使用的旧版本兼容代码,移动 database/metricstore 到 internal/metricstore 并拆分组件 (4077201) @Akizon77
- refactor: javascript runtime (df6ffba) @Akizon77
- refactor(jsruntime): modularize built-ins (3c58382) @Akizon77
- docs(jsruntime): add API and compatibility documentation (54851bd) @Akizon77
- docs(jsruntime): clarify unsupported methods throw instead of no-op (91ae9ed) @Akizon77
- fix(jsruntime): treat process.exit(0) as normal termination and improve error reporting (91cbeb3) @Akizon77
- feat: add plugin system and refactor jsruntime deadline handling (8985adc) @Akizon77
- feat(plugin): enforce server module permission gates (68bf4ed) @Akizon77
- feat(jsruntime): add node:stream module and embed nexttick JS (965afb3) @Akizon77
- feat: crypto module support (91d5f92) @Akizon77
- feat(plugin): set official plugin market as default source (f967ba0) @Akizon77
- fix(plugin): limit response hook buffering and safely reinstall (c27c21d) @Akizon77
- feat(plugin): add persistent storage dir for plugins (01c4816) @Akizon77
- feat: add plugin data storage and remove preview field (4040a5d) @Akizon77
- feat: add HTML injection permission and support for plugins (1f139ba) @Akizon77
Full Changelog: 1.3.2...Snapshot-2608021209