主要更新内容
- 新增插件系统:支持通过 ZIP 包安装、启用与卸载插件,插件清单为
komari-plugin.json,可声明版本兼容约束(komari字段)、权限、配置项和管理页面 - 插件提供
server宿主模块:server.route(注册 HTTP 路由)、server.static(托管静态目录)、server.hook(请求/响应钩子)、server.injectHTML(HTML 注入)、server.call(调用系统 RPC)、server.registerRPC、server.getConfig、server.cron(定时任务) - 新增插件权限模型:系统 RPC、路由注册、Hook、HTML 注入等能力默认不授予,需管理员批准;安装包会校验路径穿越条目与清单大小上限
- 默认使用官方插件市场作为插件源,新增
plugin_market_sources配置项 - 新增插件数据持久化目录(
data/plugin-data),插件更新时数据保留 - 重构 JavaScript 运行时并模块化内置组件;新增
node:stream、node:crypto、child_process、events、fetch、fs等 Node.js 兼容模块,未支持的接口明确抛错而非静默忽略 - 新增 crypto 模块:支持哈希/HMAC、AES、ChaCha20-Poly1305、RSA/ECDSA/Ed25519 签名验签、PBKDF2/scrypt 等
- metricstore 从
database/metricstore迁移至internal/metricstore并拆分为独立组件,移除旧版兼容代码 - 新增
SendNotification,事件消息的event、message、emoji字段支持任意类型
Bug修复
- 修复
process.exit(0)被误判为非正常终止的问题,并改进错误上报 - 修复插件响应钩子缓冲无上限导致的资源占用问题,并支持安全重装插件
- 修复插件 Hook 匹配过滤,增加按插件的响应体大小上限
- 修复已注册 RPC 方法无法通过
rpc.help发现的问题 - 修复存在响应钩子时流式响应(如 MJPEG 推流)被缓冲吞掉、客户端收不到数据的问题
其他
- 移除废弃的数据库函数:
GetAllMessageSenderConfigs、SaveLoadNotification、GetEnabledTrafficReportByType、GetAllOidcConfigs - 数据库迁移新增
PluginConfiguration表 - 启动时自动创建
data/plugin与data/plugin-data目录 - 依赖调整:移除
golang.org/x/image,新增github.com/dop251/base64dec
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
- feat(plugin): add server.static for serving plugin static folders (eab03a1) @Akizon77
- fix: hook 过滤 + 按插件 body 上限 (d9713aa) @Akizon77
- feat(plugin): add server.cron scheduled task support (5488189) @Akizon77
- fix(rpc): make registered methods discoverable via rpc.help (28abafb) @Akizon77
- feat: add SendNotification and support any event payload fields (996dd90) @Akizon77
Full Changelog: 1.3.2...Snapshot-2608022121