diff --git a/internal/models/property.go b/internal/models/property.go index 5bc283b..bbc4098 100644 --- a/internal/models/property.go +++ b/internal/models/property.go @@ -62,6 +62,7 @@ type SystemConfig struct { DefaultView string `json:"defaultView"` // 默认视图 grid | list CustomCSS string `json:"customCSS"` // 自定义 CSS CustomJS string `json:"customJS"` // 自定义 JS + Version string `json:"-"` // 系统版本 } // AlertConfig 全局告警配置 diff --git a/internal/service/property_service.go b/internal/service/property_service.go index 43e3875..22ca640 100644 --- a/internal/service/property_service.go +++ b/internal/service/property_service.go @@ -8,6 +8,7 @@ import ( "github.com/dushixiang/pika/internal/models" "github.com/dushixiang/pika/internal/repo" + "github.com/dushixiang/pika/pkg/version" "github.com/dushixiang/pika/web" "github.com/go-orz/cache" "go.uber.org/zap" @@ -117,6 +118,8 @@ func (s *PropertyService) GetSystemConfig(ctx context.Context) (*models.SystemCo if err != nil { return nil, fmt.Errorf("获取系统配置失败: %w", err) } + // 设置系统版本 + systemConfig.Version = version.Version return &systemConfig, nil } diff --git a/web/index.html b/web/index.html index 3ec002d..50e76d2 100644 --- a/web/index.html +++ b/web/index.html @@ -12,6 +12,7 @@ SystemNameEn: "{{.SystemNameEn}}", ICPCode: "{{.ICPCode}}", DefaultView: "{{.DefaultView}}", + Version: "{{.Version}}", }; diff --git a/web/src/components/PublicFooter.tsx b/web/src/components/PublicFooter.tsx index c9b4843..972e161 100644 --- a/web/src/components/PublicFooter.tsx +++ b/web/src/components/PublicFooter.tsx @@ -23,8 +23,7 @@ const PublicFooter = () => { Pika Monitor - | - 保持洞察 · 稳定运行 + {window.SystemConfig.Version} {/* ICP 备案号 */} {icpCode && ( <> diff --git a/web/src/global.d.ts b/web/src/global.d.ts index 1d8a212..e857811 100644 --- a/web/src/global.d.ts +++ b/web/src/global.d.ts @@ -7,6 +7,7 @@ declare global { SystemNameEn: string; ICPCode: string; DefaultView: string; + Version: string; }; } }