主要更新内容
- 重构服务端 JavaScript 运行时(
pkg/jsruntime),统一提供 CommonJS、事件循环、console、定时器、Fetch、XMLHttpRequest、queueMicrotask 等 Web API,并新增 events、path、os、process、fs、child_process、net、http 等 Node.js 兼容模块(默认不启用)。 - 通知消息发送器中的 JavaScript 脚本改用新运行时执行:默认增加 30 秒执行/回调超时、32 MiB HTTP 响应体与 1 MiB 子进程输出上限,同步死循环可被中断;文件访问默认限制在 BaseDir 内并阻止符号链接逃逸。
- 将 metricstore 从
database/metricstore迁移至internal/metricstore,并按职责拆分为 store、配置、compaction、删除、ping 记录、上报映射等组件,原约 1200 行的单体文件被移除。 - 清理旧版本遗留的未使用兼容代码:移除
GetAllMessageSenderConfigs、GetAllOidcConfigs、SaveLoadNotification、GetEnabledTrafficReportByType等数据库辅助函数,以及metric.Store.DeleteMetricData、DeleteBeforeTx、nowExpr等死代码。 - 新增
pkg/jsruntime/README.md,详细说明运行时接口、兼容性状态与权限控制选项。
其他
- 新增
github.com/dop251/base64dec间接依赖,golang.org/x/sys由间接依赖转为直接依赖。 - 消息发送器当前以默认选项初始化运行时,未启用 Node.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
Full Changelog: 1.3.2...Snapshot-2607311508