Skip to content

Commit

Permalink
✨ — Add bigImageUrl option to push command
Browse files Browse the repository at this point in the history
  • Loading branch information
ldidry committed Sep 4, 2024
1 parent 1998489 commit a3b737d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion command/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ func Push() cli.Command {
cli.StringFlag{Name: "url", Usage: "Override the Gotify URL"},
cli.BoolFlag{Name: "quiet,q", Usage: "Do not output anything (on success)"},
cli.StringFlag{Name: "contentType", Usage: "The content type of the message. See https://gotify.net/docs/msgextras#client-display"},
cli.StringFlag{Name: "clickUrl", Usage: "An URL to open upon clicking the notification. See https://gotify.net/docs/msgextras#client-notification"},
cli.StringFlag{Name: "clickUrl", Usage: "An URL to open upon clicking the notification. See https://gotify.net/docs/msgextras#clickurl"},
cli.StringFlag{Name: "bigImageUrl", Usage: "the URL of an image to display in the notification. See https://gotify.net/docs/msgextras#bigimageurl"},
cli.BoolFlag{Name: "disable-unescape-backslash", Usage: "Disable evaluating \\n and \\t (if set, \\n and \\t will be seen as a string)"},
},
Action: doPush,
Expand All @@ -50,6 +51,7 @@ func doPush(ctx *cli.Context) {
quiet := ctx.Bool("quiet")
contentType := ctx.String("contentType")
clickUrl := ctx.String("clickUrl")
bigImageUrl := ctx.String("bigImageUrl")

if token == "" {
if confErr != nil {
Expand Down Expand Up @@ -95,6 +97,12 @@ func doPush(ctx *cli.Context) {
}
}

if bigImageUrl != "" {
msg.Extras["client::notification"] = map[string]interface{}{
"bigImageUrl": bigImageUrl,
}
}

parsedURL, err := url.Parse(stringURL)
if err != nil {
utils.Exit1With("invalid url", stringURL)
Expand Down

0 comments on commit a3b737d

Please sign in to comment.