From 977918490621c6ee4c093a21fa1fc2c42fdc3b72 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 11 Jan 2024 20:04:31 +0800 Subject: [PATCH 1/2] :art: The production environment will no longer register `/debug/pprof/` https://github.com/siyuan-note/siyuan/issues/10152 --- kernel/server/serve.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/server/serve.go b/kernel/server/serve.go index 89092040b91..32c62b73ca2 100644 --- a/kernel/server/serve.go +++ b/kernel/server/serve.go @@ -392,6 +392,11 @@ func serveRepoDiff(ginServer *gin.Engine) { } func serveDebug(ginServer *gin.Engine) { + if "prod" == util.Mode { + // The production environment will no longer register `/debug/pprof/` https://github.com/siyuan-note/siyuan/issues/10152 + return + } + ginServer.GET("/debug/pprof/", gin.WrapF(pprof.Index)) ginServer.GET("/debug/pprof/allocs", gin.WrapF(pprof.Index)) ginServer.GET("/debug/pprof/block", gin.WrapF(pprof.Index)) From e771fe7d7b4e2f153a26051378e73dac6470ae53 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 11 Jan 2024 20:13:25 +0800 Subject: [PATCH 2/2] :art: https://github.com/siyuan-note/siyuan/issues/10153 --- kernel/api/notification.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/api/notification.go b/kernel/api/notification.go index 00f9c0b74e7..704107680e0 100644 --- a/kernel/api/notification.go +++ b/kernel/api/notification.go @@ -18,6 +18,7 @@ package api import ( "net/http" + "strings" "github.com/88250/gulu" "github.com/gin-gonic/gin" @@ -33,7 +34,13 @@ func pushMsg(c *gin.Context) { return } - msg := arg["msg"].(string) + msg := strings.TrimSpace(arg["msg"].(string)) + if "" == msg { + ret.Code = -1 + ret.Msg = "msg can't be empty" + return + } + timeout := 7000 if nil != arg["timeout"] { timeout = int(arg["timeout"].(float64))