diff --git a/internal/app/app.go b/internal/app/app.go index cbabb619..34caccff 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -746,7 +746,11 @@ func setupRoutes( // 前端页面 router.GET("/", func(c *gin.Context) { - c.HTML(http.StatusOK, "index.html", nil) + version := app.config.Version + if version == "" { + version = "v1.0.0" + } + c.HTML(http.StatusOK, "index.html", gin.H{"Version": version}) }) } diff --git a/internal/config/config.go b/internal/config/config.go index 8d37e9eb..4ecbcd9a 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -13,6 +13,7 @@ import ( ) type Config struct { + Version string `yaml:"version,omitempty" json:"version,omitempty"` // 前端显示的版本号,如 v1.3.3 Server ServerConfig `yaml:"server"` Log LogConfig `yaml:"log"` MCP MCPConfig `yaml:"mcp"` diff --git a/web/static/css/style.css b/web/static/css/style.css index 728aed57..f433429b 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -499,6 +499,17 @@ header { opacity: 0.85; } +.version-badge { + display: inline-block; + margin-left: 6px; + font-size: 0.6875rem; + font-weight: 400; + color: var(--text-muted); + letter-spacing: 0.02em; + vertical-align: 0.35em; + user-select: none; +} + .header-right { display: flex; align-items: center; diff --git a/web/templates/index.html b/web/templates/index.html index 61d5d383..77e4bc7a 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -32,9 +32,9 @@
-

AI 驱动的自动化安全测试平台