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

feat: implement proxy URL per feed

This commit is contained in:
Frédéric Guillot 2025-04-06 18:04:50 -07:00
parent c45b51d1f8
commit d17f8a7bfa
48 changed files with 333 additions and 192 deletions

View file

@ -42,6 +42,7 @@ type FeedForm struct {
NtfyTopic string
PushoverEnabled bool
PushoverPriority int
ProxyURL string
}
// Merge updates the fields of the given feed.
@ -77,6 +78,7 @@ func (f FeedForm) Merge(feed *model.Feed) *model.Feed {
feed.NtfyTopic = f.NtfyTopic
feed.PushoverEnabled = f.PushoverEnabled
feed.PushoverPriority = f.PushoverPriority
feed.ProxyURL = f.ProxyURL
return feed
}
@ -86,6 +88,7 @@ func NewFeedForm(r *http.Request) *FeedForm {
if err != nil {
categoryID = 0
}
ntfyPriority, err := strconv.Atoi(r.FormValue("ntfy_priority"))
if err != nil {
ntfyPriority = 0
@ -126,5 +129,6 @@ func NewFeedForm(r *http.Request) *FeedForm {
NtfyTopic: r.FormValue("ntfy_topic"),
PushoverEnabled: r.FormValue("pushover_enabled") == "1",
PushoverPriority: pushoverPriority,
ProxyURL: r.FormValue("proxy_url"),
}
}

View file

@ -28,6 +28,7 @@ type SubscriptionForm struct {
KeeplistRules string
UrlRewriteRules string
DisableHTTP2 bool
ProxyURL string
}
// Validate makes sure the form values locale.are valid.
@ -52,6 +53,10 @@ func (s *SubscriptionForm) Validate() *locale.LocalizedError {
return locale.NewLocalizedError("error.feed_invalid_urlrewrite_rule")
}
if s.ProxyURL != "" && !validator.IsValidURL(s.ProxyURL) {
return locale.NewLocalizedError("error.invalid_feed_proxy_url")
}
return nil
}
@ -78,5 +83,6 @@ func NewSubscriptionForm(r *http.Request) *SubscriptionForm {
KeeplistRules: r.FormValue("keeplist_rules"),
UrlRewriteRules: r.FormValue("urlrewrite_rules"),
DisableHTTP2: r.FormValue("disable_http2") == "1",
ProxyURL: r.FormValue("proxy_url"),
}
}