From dfbd93c8475e03fdc69d8d4d6f79e01653a4445e Mon Sep 17 00:00:00 2001 From: Victor_Jay Date: Wed, 27 May 2026 15:38:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=20site.brand=20?= =?UTF-8?q?=E5=8F=AF=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E5=90=8D=E7=A7=B0=E6=81=A2=E5=A4=8D=E7=A1=AC=E7=BC=96?= =?UTF-8?q?=E7=A0=81=20MetaLab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 考虑实际需求后,站点名称无需常改,移除前后端全部相关逻辑: - config / middleware / helper 移除 site_brand 注入 - 页脚版权恢复硬编码 MetaLab --- internal/common/helper.go | 3 --- internal/config/site_settings.go | 6 ++---- internal/middleware/site_info.go | 3 +-- templates/MetaLab-2026/html/layout/footer.html | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/internal/common/helper.go b/internal/common/helper.go index 8f51f24..2b845b7 100644 --- a/internal/common/helper.go +++ b/internal/common/helper.go @@ -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 } diff --git a/internal/config/site_settings.go b/internal/config/site_settings.go index 623ba3e..48b9db7 100644 --- a/internal/config/site_settings.go +++ b/internal/config/site_settings.go @@ -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"), } } diff --git a/internal/middleware/site_info.go b/internal/middleware/site_info.go index 8689480..f9f0130 100644 --- a/internal/middleware/site_info.go +++ b/internal/middleware/site_info.go @@ -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() diff --git a/templates/MetaLab-2026/html/layout/footer.html b/templates/MetaLab-2026/html/layout/footer.html index 3f7c705..5830a63 100644 --- a/templates/MetaLab-2026/html/layout/footer.html +++ b/templates/MetaLab-2026/html/layout/footer.html @@ -1,5 +1,5 @@