chore: 移除 site.brand 可配置功能,站点名称恢复硬编码 MetaLab
考虑实际需求后,站点名称无需常改,移除前后端全部相关逻辑: - config / middleware / helper 移除 site_brand 注入 - 页脚版权恢复硬编码 MetaLab
This commit is contained in:
@ -57,9 +57,6 @@ func BuildAdminPageData(c *gin.Context, extra gin.H) gin.H {
|
||||
|
||||
// injectSiteInfo 从 context 注入站点展示信息
|
||||
func injectSiteInfo(c *gin.Context, data gin.H) {
|
||||
if brand, exists := c.Get("site_brand"); exists {
|
||||
data["Brand"] = brand
|
||||
}
|
||||
if framework, exists := c.Get("site_framework"); exists {
|
||||
data["Framework"] = framework
|
||||
}
|
||||
|
||||
@ -112,16 +112,14 @@ func (s *SiteSettings) IsAuditTypeEnabled(auditType string, defaultVal bool) boo
|
||||
|
||||
// SiteInfoDefaults 站点展示信息的默认值
|
||||
type SiteInfoDefaults struct {
|
||||
Brand string // 品牌名,默认 "MetaLab"
|
||||
Framework string // 框架名,默认 "MetaZone"
|
||||
Framework string // 附加标识,默认 "Framework: MetaZone"
|
||||
CopyrightStart string // 版权起始年份,默认 "2024"
|
||||
}
|
||||
|
||||
// SiteInfo 获取站点展示信息(优先 DB 设置,fallback 默认值)
|
||||
func (s *SiteSettings) SiteInfo() SiteInfoDefaults {
|
||||
return SiteInfoDefaults{
|
||||
Brand: s.Get("site.brand", "MetaLab"),
|
||||
Framework: s.Get("site.framework", "MetaZone"),
|
||||
Framework: s.Get("site.framework", "Framework: MetaZone"),
|
||||
CopyrightStart: s.Get("site.copyright_start", "2024"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,11 +7,10 @@ import (
|
||||
)
|
||||
|
||||
// InjectSiteInfo 注入站点展示信息到请求上下文(供 BuildPageData 使用)
|
||||
// 应用于引擎级全局中间件,确保所有 SSR 页面都能读取 Brand/Framework/CopyrightStart
|
||||
// 应用于引擎级全局中间件,确保所有 SSR 页面都能读取 Framework/CopyrightStart
|
||||
func InjectSiteInfo(siteSettings *config.SiteSettings) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
info := siteSettings.SiteInfo()
|
||||
c.Set("site_brand", info.Brand)
|
||||
c.Set("site_framework", info.Framework)
|
||||
c.Set("site_copyright_start", info.CopyrightStart)
|
||||
c.Next()
|
||||
|
||||
Reference in New Issue
Block a user