feat: 品牌CMS配置化 + cookie_secure配置
- config.yaml 新增 server.cookie_secure 配置项
- site_settings 新增 site_name/site_tagline/contact_email 站点信息
- SiteInfo 结构体扩展,支持运行时从 DB 读取站点品牌信息
- cookie.go 使用 cfg.Server.CookieSecure 替代 Mode!=debug 判断
- SetSessionCookie/ClearSessionCookie 支持 siteSettings 运行时覆盖
- 模板替换硬编码 MetaLab → {{.SiteName}}(nav/header/footer/home/login/register/guidelines/admin,12+处)
- 管理后台站点设置页新增站点名称/标语/联系邮箱输入项
- 页脚版权年份改为动态 CurrentYear
- 注册成功消息 CMS 化(后端+前端)
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"metazone.cc/mce/internal/model"
|
||||
|
||||
@ -159,10 +160,20 @@ func RedirectToLogin(c *gin.Context) {
|
||||
|
||||
// injectSiteInfo 从 context 注入站点展示信息
|
||||
func injectSiteInfo(c *gin.Context, data gin.H) {
|
||||
if siteName, exists := c.Get("site_name"); exists {
|
||||
data["SiteName"] = siteName
|
||||
}
|
||||
if siteTagline, exists := c.Get("site_tagline"); exists {
|
||||
data["SiteTagline"] = siteTagline
|
||||
}
|
||||
if contactEmail, exists := c.Get("site_contact_email"); exists {
|
||||
data["ContactEmail"] = contactEmail
|
||||
}
|
||||
if framework, exists := c.Get("site_framework"); exists {
|
||||
data["Framework"] = framework
|
||||
}
|
||||
if copyrightStart, exists := c.Get("site_copyright_start"); exists {
|
||||
data["CopyrightStart"] = copyrightStart
|
||||
}
|
||||
data["CurrentYear"] = time.Now().Year()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user