An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Add a 'Remember me' checkbox when logging in to save a session https://github.com/siyuan-note/siyuan/pull/14964 https://github.com/siyuan-note/siyuan/issues/13147
Daniel46d6fbf033cd
diff --git a/kernel/model/session.go b/kernel/model/session.goindex 9facca9d59..ef3bc103ac 100644--- a/kernel/model/session.go+++ b/kernel/model/session.go@@ -92,6 +92,13 @@ func LoginAuth(c *gin.Context) {ret.Code = 1ret.Msg = Conf.Language(22)logging.LogWarnf("invalid captcha")++ workspaceSession.Captcha = gulu.Rand.String(7) // https://github.com/siyuan-note/siyuan/issues/13147+ if err := session.Save(c); err != nil {+ logging.LogErrorf("save session failed: " + err.Error())+ c.Status(http.StatusInternalServerError)+ return+ }return}}diff --git a/kernel/server/serve.go b/kernel/server/serve.goindex dea0ed7fcd..8de6fc91a4 100644--- a/kernel/server/serve.go+++ b/kernel/server/serve.go@@ -36,7 +36,7 @@ import ("github.com/emersion/go-webdav/carddav""github.com/gin-contrib/gzip""github.com/gin-contrib/sessions"- "github.com/gin-contrib/sessions/memstore"+ "github.com/gin-contrib/sessions/cookie""github.com/gin-gonic/gin""github.com/mssola/useragent""github.com/olahol/melody"@@ -61,8 +61,7 @@ const ()var (- // 这里用的是内存存储,意味着重启后所有 session 会丢失,需要重新登录- sessionStore = memstore.NewStore([]byte("ATN51UlxVq1Gcvdf"))+ sessionStore = cookie.NewStore([]byte("ATN51UlxVq1Gcvdf"))HttpMethods = []string{http.MethodGet,