Changeset 0.27.3 (#170)
This commit is contained in:
@@ -7,8 +7,9 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"git.gobha.me/xcaliber/chat-switchboard/models"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/taskutil"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/store"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/taskutil"
|
||||
"git.gobha.me/xcaliber/chat-switchboard/webhook"
|
||||
)
|
||||
|
||||
// TaskHandler manages task CRUD and manual execution.
|
||||
@@ -129,6 +130,11 @@ func (h *TaskHandler) Create(c *gin.Context) {
|
||||
|
||||
t.IsActive = true
|
||||
|
||||
// v0.27.3: Generate webhook secret if webhook URL is provided
|
||||
if t.WebhookURL != "" && t.WebhookSecret == "" {
|
||||
t.WebhookSecret = webhook.GenerateSecret()
|
||||
}
|
||||
|
||||
if err := h.stores.Tasks.Create(ctx, &t); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create task: " + err.Error()})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user