Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat(version): move AnswerVersion to site-info API

LinkinStarse9d566770884
diff --git a/Makefile b/Makefile
index dd7c76d5..681ab58b 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,6 @@ install-ui-packages:
@corepack prepare [email protected] --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"`