From 20b0e0c4bd1eeda1d236601f4cb96a21e103f748 Mon Sep 17 00:00:00 2001 From: v-me-50 Date: Tue, 24 Jun 2025 17:49:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=96=E6=B6=88=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E5=85=A5=E5=8F=A3=20=E4=BF=AE=E5=A4=8D=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=88=86=E6=94=AF=E5=92=8C=E5=B9=B6=E8=A1=8C=E5=88=86?= =?UTF-8?q?=E6=94=AF=E4=B8=8B=E7=9A=84=E5=B9=B6=E8=A1=8C=E5=88=86=E6=94=AF?= =?UTF-8?q?panic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/workflow/workflow.go | 10 +++++++++- backend/middleware/auth.go | 5 +++++ cmd/main.go | 6 +++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/backend/internal/workflow/workflow.go b/backend/internal/workflow/workflow.go index aa17387..02bf4eb 100644 --- a/backend/internal/workflow/workflow.go +++ b/backend/internal/workflow/workflow.go @@ -245,7 +245,12 @@ func RunNode(node *WorkflowNode, ctx *ExecutionContext) error { var wg sync.WaitGroup errChan := make(chan error, len(node.ConditionNodes)) for _, branch := range node.ConditionNodes { - branch.ChildNode.Config["fromNodeData"] = node.Config["fromNodeData"] + if branch.ChildNode != nil { + if branch.ChildNode.ChildNode == nil { + branch.ChildNode.Config = make(map[string]any) + } + branch.ChildNode.Config["fromNodeData"] = node.Config["fromNodeData"] + } wg.Add(1) go func(node *WorkflowNode) { defer wg.Done() @@ -271,6 +276,9 @@ func RunNode(node *WorkflowNode, ctx *ExecutionContext) error { for _, branch := range node.ConditionNodes { if branch.Config["type"] == string(lastStatus) { if branch.ChildNode != nil { + if branch.ChildNode.Config == nil { + branch.ChildNode.Config = make(map[string]any) + } fromNodeData, ok := ctx.GetOutput(node.Config["fromNodeId"].(string)) if !ok { fromNodeData = nil diff --git a/backend/middleware/auth.go b/backend/middleware/auth.go index 8030beb..a204dd2 100644 --- a/backend/middleware/auth.go +++ b/backend/middleware/auth.go @@ -33,6 +33,11 @@ func SessionAuthMiddleware() gin.HandlerFunc { session := sessions.Default(c) now := time.Now() gob.Register(time.Time{}) + if public.Secure == "" && session.Get("secure") == nil { + session.Set("secure", true) + session.Set("lastRequestTime", now) + session.Save() + } last := session.Get("lastRequestTime") if routePath == public.Secure { diff --git a/cmd/main.go b/cmd/main.go index c9acb87..e382a5c 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -39,7 +39,11 @@ func main() { if public.GetSettingIgnoreError("https") == "1" { http = "https" } - url := fmt.Sprintf("%s://127.0.0.1:%s%s", http, public.Port, public.Secure) + secure := "/login" + if public.Secure != "" { + secure = public.Secure + } + url := fmt.Sprintf("%s://127.0.0.1:%s%s", http, public.Port, secure) err := exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() if err != nil { fmt.Println("无法打开浏览器,请手动访问:", url)