1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

feat(pushover): add integration with pushover.net

This commit is contained in:
Sergio Moura 2025-02-12 13:05:28 -05:00 committed by Frédéric Guillot
parent 76acd81fa4
commit 3387201634
32 changed files with 510 additions and 6 deletions

View file

@ -67,6 +67,8 @@ func (h *handler) showEditFeedPage(w http.ResponseWriter, r *http.Request) {
DisableHTTP2: feed.DisableHTTP2,
NtfyEnabled: feed.NtfyEnabled,
NtfyPriority: feed.NtfyPriority,
PushoverEnabled: feed.PushoverEnabled,
PushoverPriority: feed.PushoverPriority,
}
sess := session.New(h.store, request.SessionID(r))

View file

@ -39,6 +39,8 @@ type FeedForm struct {
DisableHTTP2 bool
NtfyEnabled bool
NtfyPriority int
PushoverEnabled bool
PushoverPriority int
}
// Merge updates the fields of the given feed.
@ -71,6 +73,8 @@ func (f FeedForm) Merge(feed *model.Feed) *model.Feed {
feed.DisableHTTP2 = f.DisableHTTP2
feed.NtfyEnabled = f.NtfyEnabled
feed.NtfyPriority = f.NtfyPriority
feed.PushoverEnabled = f.PushoverEnabled
feed.PushoverPriority = f.PushoverPriority
return feed
}
@ -84,6 +88,12 @@ func NewFeedForm(r *http.Request) *FeedForm {
if err != nil {
ntfyPriority = 0
}
pushoverPriority, err := strconv.Atoi(r.FormValue("pushover_priority"))
if err != nil {
pushoverPriority = 0
}
return &FeedForm{
FeedURL: r.FormValue("feed_url"),
SiteURL: r.FormValue("site_url"),
@ -111,5 +121,7 @@ func NewFeedForm(r *http.Request) *FeedForm {
DisableHTTP2: r.FormValue("disable_http2") == "1",
NtfyEnabled: r.FormValue("ntfy_enabled") == "1",
NtfyPriority: ntfyPriority,
PushoverEnabled: r.FormValue("pushover_enabled") == "1",
PushoverPriority: pushoverPriority,
}
}

View file

@ -117,6 +117,11 @@ type IntegrationForm struct {
DiscordWebhookLink string
SlackEnabled bool
SlackWebhookLink string
PushoverEnabled bool
PushoverUser string
PushoverToken string
PushoverDevice string
PushoverPrefix string
}
// Merge copy form values to the model.
@ -223,6 +228,11 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
integration.DiscordWebhookLink = i.DiscordWebhookLink
integration.SlackEnabled = i.SlackEnabled
integration.SlackWebhookLink = i.SlackWebhookLink
integration.PushoverEnabled = i.PushoverEnabled
integration.PushoverUser = i.PushoverUser
integration.PushoverToken = i.PushoverToken
integration.PushoverDevice = i.PushoverDevice
integration.PushoverPrefix = i.PushoverPrefix
}
// NewIntegrationForm returns a new IntegrationForm.
@ -332,6 +342,11 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
DiscordWebhookLink: r.FormValue("discord_webhook_link"),
SlackEnabled: r.FormValue("slack_enabled") == "1",
SlackWebhookLink: r.FormValue("slack_webhook_link"),
PushoverEnabled: r.FormValue("pushover_enabled") == "1",
PushoverUser: r.FormValue("pushover_user"),
PushoverToken: r.FormValue("pushover_token"),
PushoverDevice: r.FormValue("pushover_device"),
PushoverPrefix: r.FormValue("pushover_prefix"),
}
}

View file

@ -131,6 +131,11 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
DiscordWebhookLink: integration.DiscordWebhookLink,
SlackEnabled: integration.SlackEnabled,
SlackWebhookLink: integration.SlackWebhookLink,
PushoverEnabled: integration.PushoverEnabled,
PushoverUser: integration.PushoverUser,
PushoverToken: integration.PushoverToken,
PushoverDevice: integration.PushoverDevice,
PushoverPrefix: integration.PushoverPrefix,
}
sess := session.New(h.store, request.SessionID(r))