aliyun sensor server

This commit is contained in:
tamakyi
2026-09-10 18:04:19 +08:00
parent e3e59e7c69
commit 8e2325eda5
38 changed files with 3147 additions and 344 deletions
+13
View File
@@ -18,6 +18,7 @@ import (
"github.com/tamakyi/TamaBox/internal/conf"
"github.com/tamakyi/TamaBox/internal/i18n"
"github.com/tamakyi/TamaBox/internal/security/moderation"
)
var (
@@ -210,6 +211,18 @@ func FuncMap() []template.FuncMap {
"langName": func(lang string) string {
return i18n.Name(lang)
},
// moderationStrictness 返回账号「最终生效」的审核严格度档位(lax / standard / strict)。
//
// 设置页下拉框必须用它回显,不能直接用 LoggedUser.ModerationStrictness:
// 存量账号该字段为空值(表示"跟随站点默认"),三个 <option> 的 eq 判定全部为假,
// 浏览器会默认选中第一个选项(宽松),而实际生效的是站点默认档位(通常为严格)——
// 界面会告诉箱主"你是宽松",与真实拦截行为相反。
// 走 moderation.StrictnessFor 解析,保证回显与 internal/security/censor/policy.go
// 的裁决口径是同一份事实来源(含站点默认与非法值回退)。
"moderationStrictness": func(raw string) string {
return string(moderation.StrictnessFor(raw))
},
}}
})
return funcMap