From e9d5667708842806b9ac47d5d8db48c02e7bc2dd Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Wed, 15 Feb 2023 17:22:44 +0800 Subject: [PATCH] feat(version): move AnswerVersion to site-info API --- Makefile | 2 +- internal/controller/siteinfo_controller.go | 2 +- internal/schema/siteinfo_schema.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dd7c76d5..681ab58b 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,6 @@ install-ui-packages: @corepack prepare pnpm@v7.12.2 --activate ui: - @cd ui && pnpm install && pnpm build && sed -i 's/%AnswerVersion%/'$(VERSION)'/g' ./build/index.html && cd - + @cd ui && pnpm install && pnpm build && cd - all: clean build diff --git a/internal/controller/siteinfo_controller.go b/internal/controller/siteinfo_controller.go index 732a2091..b2a95bdf 100644 --- a/internal/controller/siteinfo_controller.go +++ b/internal/controller/siteinfo_controller.go @@ -31,7 +31,7 @@ func NewSiteinfoController(siteInfoService *siteinfo_common.SiteInfoCommonServic // @Router /answer/api/v1/siteinfo [get] func (sc *SiteinfoController) GetSiteInfo(ctx *gin.Context) { var err error - resp := &schema.SiteInfoResp{} + resp := &schema.SiteInfoResp{Version: constant.Version} resp.General, err = sc.siteInfoService.GetSiteGeneral(ctx) if err != nil { log.Error(err) diff --git a/internal/schema/siteinfo_schema.go b/internal/schema/siteinfo_schema.go index 37291d78..ec17b64b 100644 --- a/internal/schema/siteinfo_schema.go +++ b/internal/schema/siteinfo_schema.go @@ -166,6 +166,7 @@ type SiteInfoResp struct { Theme *SiteThemeResp `json:"theme"` CustomCssHtml *SiteCustomCssHTMLResp `json:"custom_css_html"` SiteSeo *SiteSeoReq `json:"site_seo"` + Version string `json:"version"` } type TemplateSiteInfoResp struct { General *SiteGeneralResp `json:"general"`