diff --git a/libcs/client/web/api/api.go b/libcs/client/web/api/api.go index 06afe5fc..f1dab0e8 100644 --- a/libcs/client/web/api/api.go +++ b/libcs/client/web/api/api.go @@ -10,8 +10,6 @@ import ( "github.com/isrc-cas/gt/web/server/model/request" "github.com/isrc-cas/gt/web/server/model/response" "github.com/isrc-cas/gt/web/server/util" - "os" - "os/exec" ) func HealthCheck(ctx *gin.Context) { @@ -183,7 +181,7 @@ func SaveConfigToFile(c *client.Client) gin.HandlerFunc { } c.Logger.Info().Str("config", fullPath).Msg("save config to file") - err = ReloadServicesCommand(c) + Reload(ctx) if err != nil { response.FailWithMessage(err.Error(), ctx) return @@ -191,16 +189,6 @@ func SaveConfigToFile(c *client.Client) gin.HandlerFunc { response.SuccessWithMessage("save config to "+fullPath, ctx) } } -func ReloadServicesCommand(c *client.Client) (err error) { - execPath := os.Args[0] - command := exec.Command(execPath, "-s", "reload") - _, err = command.CombinedOutput() - if err != nil { - c.Logger.Logger.Info().Msg("failed to exec command-reload:" + err.Error()) - return - } - return -} // Restart for a brand-new config process, // not only reload the services, @@ -214,6 +202,15 @@ func Restart(ctx *gin.Context) { response.Success(ctx) } +func Reload(ctx *gin.Context) { + err := util.SendSignal("reload") + if err != nil { + response.FailWithMessage(err.Error(), ctx) + return + } + response.Success(ctx) +} + func Stop(ctx *gin.Context) { err := util.SendSignal("stop") if err != nil { diff --git a/libcs/web/front/src/languages/lang/zh.ts b/libcs/web/front/src/languages/lang/zh.ts index e71083f0..f86dfa14 100644 --- a/libcs/web/front/src/languages/lang/zh.ts +++ b/libcs/web/front/src/languages/lang/zh.ts @@ -102,7 +102,7 @@ export namespace zh { Local: "本地服务的 URL", LocalURL: "本地服务的 URL", LocalTimeout: "本地连接的超时时间。支持值如 '30s'、'5m'", - UseLocalAsHTTPHost: "使用本地主机作为GT-Server主机", + UseLocalAsHTTPHost: "使用本地URL作为HTTP Header Host的值", // Sentry 设置 SentryDSN: "要使用的 Sentry DSN", @@ -238,7 +238,7 @@ export namespace zh { RemoteTCPRandom: "GT-Server TCP随机端口", LocalURL: "本地 URL", LocalTimeout: "本地连接超时时间", - UseLocalAsHTTPHost: "使用本地主机运行GT-Server", + UseLocalAsHTTPHost: "HTTP Header Host替换", TcpForwardAddr: "TCP 转发地址", TcpForwardHostPrefix: "TCP 转发主机前缀", TcpForwardConnections: "TCP 转发连接数",