1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

feat(integration): add ntfy integration

This commit is contained in:
Frédéric Guillot 2024-07-13 16:52:30 -07:00
parent 3ca52c7f7f
commit 968355f9b9
32 changed files with 567 additions and 17 deletions

View file

@ -36,6 +36,8 @@ type FeedForm struct {
CategoryHidden bool // Category has "hide_globally"
AppriseServiceURLs string
DisableHTTP2 bool
NtfyEnabled bool
NtfyPriority int
}
// Merge updates the fields of the given feed.
@ -65,6 +67,8 @@ func (f FeedForm) Merge(feed *model.Feed) *model.Feed {
feed.HideGlobally = f.HideGlobally
feed.AppriseServiceURLs = f.AppriseServiceURLs
feed.DisableHTTP2 = f.DisableHTTP2
feed.NtfyEnabled = f.NtfyEnabled
feed.NtfyPriority = f.NtfyPriority
return feed
}
@ -74,6 +78,10 @@ func NewFeedForm(r *http.Request) *FeedForm {
if err != nil {
categoryID = 0
}
ntfyPriority, err := strconv.Atoi(r.FormValue("ntfy_priority"))
if err != nil {
ntfyPriority = 0
}
return &FeedForm{
FeedURL: r.FormValue("feed_url"),
SiteURL: r.FormValue("site_url"),
@ -98,5 +106,7 @@ func NewFeedForm(r *http.Request) *FeedForm {
HideGlobally: r.FormValue("hide_globally") == "1",
AppriseServiceURLs: r.FormValue("apprise_service_urls"),
DisableHTTP2: r.FormValue("disable_http2") == "1",
NtfyEnabled: r.FormValue("ntfy_enabled") == "1",
NtfyPriority: ntfyPriority,
}
}

View file

@ -103,6 +103,13 @@ type IntegrationForm struct {
BetulaEnabled bool
BetulaURL string
BetulaToken string
NtfyEnabled bool
NtfyTopic string
NtfyURL string
NtfyAPIToken string
NtfyUsername string
NtfyPassword string
NtfyIconURL string
}
// Merge copy form values to the model.
@ -195,6 +202,13 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
integration.BetulaEnabled = i.BetulaEnabled
integration.BetulaURL = i.BetulaURL
integration.BetulaToken = i.BetulaToken
integration.NtfyEnabled = i.NtfyEnabled
integration.NtfyTopic = i.NtfyTopic
integration.NtfyURL = i.NtfyURL
integration.NtfyAPIToken = i.NtfyAPIToken
integration.NtfyUsername = i.NtfyUsername
integration.NtfyPassword = i.NtfyPassword
integration.NtfyIconURL = i.NtfyIconURL
}
// NewIntegrationForm returns a new IntegrationForm.
@ -290,6 +304,13 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
BetulaEnabled: r.FormValue("betula_enabled") == "1",
BetulaURL: r.FormValue("betula_url"),
BetulaToken: r.FormValue("betula_token"),
NtfyEnabled: r.FormValue("ntfy_enabled") == "1",
NtfyTopic: r.FormValue("ntfy_topic"),
NtfyURL: r.FormValue("ntfy_url"),
NtfyAPIToken: r.FormValue("ntfy_api_token"),
NtfyUsername: r.FormValue("ntfy_username"),
NtfyPassword: r.FormValue("ntfy_password"),
NtfyIconURL: r.FormValue("ntfy_icon_url"),
}
}