From 55869f551ef1c1a66dd70a45b6371fd5263cd04d Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Sun, 17 Apr 2022 14:29:43 -0400 Subject: [PATCH] Add ID --- server/server.go | 3 +++ server/types.go | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server/server.go b/server/server.go index 1fad4673..3dc29a2d 100644 --- a/server/server.go +++ b/server/server.go @@ -541,6 +541,9 @@ func (s *Server) parsePublishParams(r *http.Request, v *visitor, m *message) (ca if err := json.Unmarshal([]byte(actionsStr), &actions); err != nil { return false, false, "", false, errHTTPBadRequestDelayNoCache // FIXME error } + for i := range actions { + actions[i].ID = util.RandomString(10) // FIXME + } m.Actions = actions } unifiedpush = readBoolParam(r, false, "x-unifiedpush", "unifiedpush", "up") // see GET too! diff --git a/server/types.go b/server/types.go index 4c5714d6..ccfdc7d9 100644 --- a/server/types.go +++ b/server/types.go @@ -44,9 +44,13 @@ type attachment struct { } type action struct { - Action string `json:"action"` - Label string `json:"label"` - URL string `json:"url,omitempty"` + ID string `json:"id"` + Action string `json:"action"` + Label string `json:"label"` + URL string `json:"url,omitempty"` // used in "view" and "http" + Method string `json:"method,omitempty"` // used in "http" + Headers map[string]string `json:"headers,omitempty"` // used in "http" + Body string `json:"body,omitempty"` // used in "http" } // publishMessage is used as input when publishing as JSON