feat: 注册准则阅读控制 + Footer 合规信息
准则阅读(三层控制): - registration.show_guidelines — 弹窗/复选框模式 - registration.force_guidelines — 是否强制倒计时+滚动 - registration.guidelines_timer — 倒计时秒数 Footer 合规(8 字段,空值不显示,链接纯手写): - site.operator_name / site.icp_number / site.icp_license - site.police_number / site.wenwangwen / site.algorithm_filing - site.privacy_url / site.terms_url - 新增 safeHTML 模板函数输出不转义 HTML
This commit is contained in:
@ -117,16 +117,32 @@ type SiteInfoDefaults struct {
|
||||
ContactEmail string // 联系/申诉邮箱,默认 "metazone@foxmail.com"
|
||||
Framework string // 附加标识,默认 "Framework: MetaGenesis"
|
||||
CopyrightStart string // 版权起始年份,默认 "2024"
|
||||
OperatorName string // 运营主体
|
||||
ICPNumber string // ICP 备案(HTML,含链接)
|
||||
ICPLicense string // ICP 经营许可证(HTML)
|
||||
PoliceNumber string // 公安备案(HTML)
|
||||
WenWangWen string // 文网文(HTML)
|
||||
AlgorithmFiling string // 算法备案(HTML)
|
||||
PrivacyURL string // 隐私政策(HTML)
|
||||
TermsURL string // 服务条款(HTML)
|
||||
}
|
||||
|
||||
// SiteInfo 获取站点展示信息(优先 DB 设置,fallback 默认值)
|
||||
func (s *SiteSettings) SiteInfo() SiteInfoDefaults {
|
||||
return SiteInfoDefaults{
|
||||
SiteName: s.Get("site.name", "MetaLab"),
|
||||
SiteTagline: s.Get("site.tagline", "下一代开发者社区"),
|
||||
ContactEmail: s.Get("site.contact_email", "metazone@foxmail.com"),
|
||||
Framework: s.Get("site.framework", "Framework: MetaGenesis"),
|
||||
CopyrightStart: s.Get("site.copyright_start", "2024"),
|
||||
SiteName: s.Get("site.name", "MetaLab"),
|
||||
SiteTagline: s.Get("site.tagline", "下一代开发者社区"),
|
||||
ContactEmail: s.Get("site.contact_email", "metazone@foxmail.com"),
|
||||
Framework: s.Get("site.framework", "Framework: MetaGenesis"),
|
||||
CopyrightStart: s.Get("site.copyright_start", "2024"),
|
||||
OperatorName: s.Get("site.operator_name", ""),
|
||||
ICPNumber: s.Get("site.icp_number", ""),
|
||||
ICPLicense: s.Get("site.icp_license", ""),
|
||||
PoliceNumber: s.Get("site.police_number", ""),
|
||||
WenWangWen: s.Get("site.wenwangwen", ""),
|
||||
AlgorithmFiling: s.Get("site.algorithm_filing", ""),
|
||||
PrivacyURL: s.Get("site.privacy_url", ""),
|
||||
TermsURL: s.Get("site.terms_url", ""),
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,6 +156,26 @@ func (s *SiteSettings) IsRegistrationEnabled() bool {
|
||||
return s.GetBool("registration.enabled", true)
|
||||
}
|
||||
|
||||
// ShowGuidelinesModal 注册时是否弹窗显示社区准则
|
||||
func (s *SiteSettings) ShowGuidelinesModal() bool {
|
||||
return s.GetBool("registration.show_guidelines", true)
|
||||
}
|
||||
|
||||
// ForceGuidelines 是否强制阅读准则(需要倒计时+滚动到底部)
|
||||
func (s *SiteSettings) ForceGuidelines() bool {
|
||||
return s.GetBool("registration.force_guidelines", true)
|
||||
}
|
||||
|
||||
// GuidelinesTimer 强制阅读倒计时秒数
|
||||
func (s *SiteSettings) GuidelinesTimer() int {
|
||||
val := s.Get("registration.guidelines_timer", "60")
|
||||
n, err := strconv.Atoi(val)
|
||||
if err != nil || n < 1 {
|
||||
return 60
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// IsMaintenanceEnabled 是否处于维护模式(维护期间仅站长可登录和访问)
|
||||
func (s *SiteSettings) IsMaintenanceEnabled() bool {
|
||||
return s.GetBool("maintenance.enabled", false)
|
||||
|
||||
Reference in New Issue
Block a user