feat: 文章属性 — Post Model 扩展 + 置顶系统

- Post 新增 7 字段:Visibility/PostType/ReprintSource/Declaration/ReprintProhibited/PinType/PinnedAt
- 公开列表过滤 private 文章(管理员可见全部)
- 列表排序:全局置顶 > 按时间
- declarationLabel 模板函数(7 种创作声明)
- Pin/Unpin API(admin+,category/global 两种置顶类型)
This commit is contained in:
2026-06-22 00:04:55 +08:00
parent fc57ed17d4
commit 9c452afb40
8 changed files with 127 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import (
"strings"
"metazone.cc/mce/internal/common"
"metazone.cc/mce/internal/model"
)
// TemplateRoot 模板根目录配置
@ -27,6 +28,9 @@ func LoadTemplates(roots ...TemplateRoot) (*template.Template, error) {
"str": str,
"assetV": common.AssetV,
"safeHTML": func(s string) template.HTML { return template.HTML(s) },
"declarationLabel": func(declaration string) string {
return model.DeclarationLabels[declaration]
},
"substr": func(s string, start, length int) string {
runes := []rune(s)
if start >= len(runes) {