feat(hide): 密码可见隐藏块,发帖双栏预览与门禁体验修复

增加密码解锁与游客签名 cookie;发帖页对齐 1440 并默认双栏预览;修复 locked 解析、按钮对比度与回复聚焦。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-17 05:46:42 +08:00
parent 01e2fd05ca
commit c44b0efa7d
23 changed files with 911 additions and 132 deletions

View File

@@ -82,17 +82,18 @@ func NormalizePostType(t string) string {
// 正文可见性(由正文 :::hide 块派生;mixed = 多种隐藏类型并存)
const (
ContentAccessPublic = "public" // 公开
ContentAccessLogin = "login" // 仅登录可见块
ContentAccessReply = "reply" // 仅回复可见块
ContentAccessPoints = "points" // 仅积分可见块
ContentAccessMixed = "mixed" // 多种隐藏块混合
ContentAccessPublic = "public" // 公开
ContentAccessLogin = "login" // 仅登录可见块
ContentAccessReply = "reply" // 仅回复可见块
ContentAccessPoints = "points" // 仅积分可见块
ContentAccessPassword = "password" // 仅密码可见块
ContentAccessMixed = "mixed" // 多种隐藏块混合
)
// ValidContentAccess 可见性白名单
func ValidContentAccess(a string) bool {
switch a {
case ContentAccessPublic, ContentAccessLogin, ContentAccessReply, ContentAccessPoints, ContentAccessMixed:
case ContentAccessPublic, ContentAccessLogin, ContentAccessReply, ContentAccessPoints, ContentAccessPassword, ContentAccessMixed:
return true
}
return false
@@ -168,7 +169,7 @@ type Post struct {
Content string `gorm:"type:text;not null" json:"content"`
Tags string `gorm:"size:256" json:"tags"`
PostType string `gorm:"size:16;default:discussion;index" json:"post_type"`
ContentAccess string `gorm:"size:16;default:public;index" json:"content_access"` // public|login|reply|points|mixed(由正文隐藏块派生)
ContentAccess string `gorm:"size:16;default:public;index" json:"content_access"` // public|login|reply|points|password|mixed(由正文隐藏块派生)
AccessPoints int `gorm:"not null;default:0" json:"access_points"` // 积分隐藏块价格之和
TypeMeta string `gorm:"type:text;default:''" json:"type_meta"` // 类型扩展 JSON(投票/悬赏/抽奖壳)
Pinned int `gorm:"default:0" json:"pinned"`