From 942f0fa6c3f8aef21f71a22b42884b0c671869fd Mon Sep 17 00:00:00 2001 From: ZacharyZcR <2903735704@qq.com> Date: Mon, 1 Jun 2026 08:34:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20web=20API=20=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8A=A8=E6=80=81=E8=8E=B7=E5=8F=96=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E7=A1=AC=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/globals.go | 2 ++ web/api/router.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/globals.go b/common/globals.go index 447dd3d..9ee1929 100644 --- a/common/globals.go +++ b/common/globals.go @@ -70,6 +70,8 @@ var ( date = "unknown" ) +func GetVersion() string { return version } + // 运行时数据已迁移到Config对象中,使用GetGlobalConfig()访问 // Shell状态已迁移到State对象中,使用GetGlobalState()访问 diff --git a/web/api/router.go b/web/api/router.go index 91bd08c..03634ce 100644 --- a/web/api/router.go +++ b/web/api/router.go @@ -3,8 +3,10 @@ package api import ( + "fmt" "net/http" + "github.com/shadow1ng/fscan/common" "github.com/shadow1ng/fscan/web/ws" ) @@ -49,5 +51,5 @@ func healthCheck(w http.ResponseWriter, r *http.Request) { // systemInfo 系统信息 func systemInfo(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") - w.Write([]byte(`{"version":"2.1.4","build":"web"}`)) + fmt.Fprintf(w, `{"version":"%s","build":"web"}`, common.GetVersion()) }