主要更新内容
- 新增公开访客审计事件 RPC 端点:
public:recordVisitorEvent,主题前端可记录访客操作,IP 和 User-Agent 由服务端自动获取;默认关闭,需管理员通过visitor_audit_enabled设置启用;含每 IP 令牌桶限流(30 次/分,突发 10 次)和字段长度校验。 - 移除 Nezha 兼容组件:删除
web/nezha整个模块及 gRPC 依赖,对应设置nezha_compat_enabled/nezha_compat_listen已删除,启动时自动清理遗留配置项。 - 指标保留天数改为显式指定:移除全局
DefaultRetentionDays和metric_retention_days配置,每个指标创建/更新时必须明确设置retention_days;已存在的配置项将在迁移时自动清除。 - 降采样默认禁用:
metric_downsampling_enabled默认值从true改为false。 - 新增压缩水位线表:存储每个指标最近成功压缩的边界,优化
Series查询的原始/聚合分割点,避免重复扫描。 - 指标存储水位线持久化:压缩事务内写入水位线,保证单调性,防止并发压缩回退。
- 删除客户端或 Ping 任务时自动清理指标记录:先删除 metric store 中关联数据,再操作主数据库。
- 审计日志表增加索引:
(time)和(msg_type, time)复合索引,支持按消息类型过滤;admin:getLogs可选msg_type参数。 - 公开设置新增字段:
visitor_audit_enabled通过public:getPublicSettings返回,主题可据此决定是否上报。 - 新增 loong64 架构支持:构建、安装脚本、GitHub Actions 均添加 LoongArch 64 位支持。
- 移除 SafeMap 和 secureconfig 工具模块:清理未使用的并发安全映射和配置文件加解密代码。
Bug修复
- 访客审计日志加固:修正包级编译冲突,添加
visitor_audit_enabled总开关、内存令牌桶限流(30/分,突发 10,10 分钟条目 TTL,上限 10000 IP)、按 Unicode 码点截断字段、User-Agent 长度限制(512)、完整 JSON 消息长度限制(4096);禁用或超限时直接返回状态,不写库。 - 保留零保留期指标定义:创建、迁移、压缩时正确处理
retention_days=0的指标,禁止覆盖为默认值;压缩时对该类型直接删除整条序列。 - Ping 记录查询支持 rollup 压缩:
GetPingRecords改用Series聚合查询,避免压缩后原始点被清除导致数据丢失;自动选择合理聚合间隔,保留task_id标签。 - 删除客户端/任务时清理孤立指标数据:
DeleteClient和DeletePingTask在删除主记录前先调用metricstore.DeleteEntity/DeletePingRecords,确保数据一致性。 - 降低测试环境内建指标默认保留期:从 90 天改为 1 天,减少测试数据积累。
其他
- 重构
MetricStoreConfig:移除RetentionDays字段,改用GetRetentionSummary动态查询。 - 简化默认 Rollup 策略:使用固定保留时长,不再依赖配置计算;最后一层直接使用指标定义保留期。
- 批量清理未使用的数据库函数:
UpdateLatestOnline、UpdateLatestUserAgent、UpdateLatestIp、EditClientName、EditClientToken、GetClientBasicInfo、DeleteRecordBefore、DeletePingRecordsBefore、GetAllTasksResultByUUID、DeleteTaskByTaskId。 - 移除
pkg/config.Get泛型函数和SetManyAs函数。 - 移除
utils/secureconfig加解密模块。 - 移除
web/security.OriginCheck中的HasAllowlist函数。 - 更新发布流程:移除对
komari-web-release-published和定时触发器的依赖。
What's Changed
- feat(rpc): add public visitor audit event endpoint by @sanrokamlan-prog in #597
- fix: harden visitor audit logging by @sanrokamlan-prog in #602
Commits
- disable downsampling by default (724dd3b) @Akizon77
- feat: add visitor audit rpc endpoint (7679430) @sanrokamlan-prog
- Update generate-release-notes.yml (5c73eba) @Akizon77
- Merge pull request #597 from sanrokamlan-prog/visitor-audit-rpc (1eb3549) @Akizon77
- fix: harden visitor audit logging (0c80f0f) @sanrokamlan-prog
- Merge pull request #602 from sanrokamlan-prog/fix/visitor-audit-hardening (5fa59ab) @Akizon77
- refactor: replace static retention config with dynamic retention summary (7f36881) @Akizon77
- fix: preserve zero-retention metric definitions across operations (66b7691) @Akizon77
- refactor(metrics): remove DefaultRetentionDays config option and enforce explicit retention (7baf2ed) @Akizon77
- fix: reduce default built-in metric retention to 1 day for testing (c1178eb) @Akizon77
- fix(metricstore): use Series to read ping records for rollup support (e2a8284) @Akizon77
- feat: clean metric store before deleting client or ping task (43547b9) @Akizon77
- feat(metric): add compaction watermark upsert and update storage queries (5b90804) @Akizon77
- feat: #414 add support for loong64 architecture (fc3febc) @Akizon77
- refactor: remove unused database functions for sessions, clients, and metric store (0f6f2f4) @Akizon77
- refactor: remove Nezha compatibility (f42cfe7) @Akizon77
New Contributors
- @sanrokamlan-prog made their first contribution in #597
Full Changelog: 1.2.6...Snapshot-2607162132