jswinoga/feature/rename-feed-site-url #63
No files matched your search
+2
-2
@@ -80,11 +80,11 @@ This section defines which entries are included in the digest.
|
||||
| `logic` | String | `OR` | Logic for combining different field conditions. <br> - `OR`: Match if *any* field condition is met.<br> - `AND`: Match only if *all* defined field conditions are met. |
|
||||
| `feed_titles` | String[] | - | Exact matches for the RSS feed title. |
|
||||
| `category_titles` | String[] | - | Exact matches for the Miniflux category title. |
|
||||
| `site_urls` | String[] | - | Prefix matches for the feed's site URL. |
|
||||
| `site_urls` | String[] | - | Prefix matches for the site URL. (Legacy: `feed_urls`) |
|
||||
| `entry_urls` | String[] | - | Prefix matches for the entry's URL. |
|
||||
| `feed_title_patterns` | String[] | - | Regex matches for the feed title. |
|
||||
| `category_title_patterns` | String[] | - | Regex matches for the category title. |
|
||||
| `site_url_patterns` | String[] | - | Regex matches for the site URL. |
|
||||
| `site_url_patterns` | String[] | - | Regex matches for the site URL. (Legacy: `feed_url_patterns`) |
|
||||
| `entry_url_patterns` | String[] | - | Regex matches for the entry URL. |
|
||||
|
||||
**Note:** Conditions *within* a single list (e.g., multiple `feed_titles`) are always treated as **OR**.
|
||||
|
||||
@@ -54,10 +54,12 @@ type ConfigFilters struct {
|
||||
Logic string `koanf:"logic" validate:"omitempty,oneof=AND OR"`
|
||||
FeedTitles []string `koanf:"feed_titles"`
|
||||
CategoryTitles []string `koanf:"category_titles"`
|
||||
SiteURLs []string `koanf:"site_urls"`
|
||||
FeedURLs []string `koanf:"feed_urls"`
|
||||
EntryURLs []string `koanf:"entry_urls"`
|
||||
FeedTitlePatterns []string `koanf:"feed_title_patterns"`
|
||||
CategoryTitlePatterns []string `koanf:"category_title_patterns"`
|
||||
SiteURLPatterns []string `koanf:"site_url_patterns"`
|
||||
FeedURLPatterns []string `koanf:"feed_url_patterns"`
|
||||
EntryURLPatterns []string `koanf:"entry_url_patterns"`
|
||||
}
|
||||
@@ -135,6 +137,7 @@ func (c *Config) Validate() error {
|
||||
|
||||
validatePatterns(digest.Filters.FeedTitlePatterns, "Filters.FeedTitlePatterns")
|
||||
validatePatterns(digest.Filters.CategoryTitlePatterns, "Filters.CategoryTitlePatterns")
|
||||
validatePatterns(digest.Filters.SiteURLPatterns, "Filters.SiteURLPatterns")
|
||||
validatePatterns(digest.Filters.FeedURLPatterns, "Filters.FeedURLPatterns")
|
||||
validatePatterns(digest.Filters.EntryURLPatterns, "Filters.EntryURLPatterns")
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func NewMatcher(cfg config.ConfigFilters) (*Matcher, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m.siteURLRegex, err = compileRegexes(cfg.FeedURLPatterns)
|
||||
m.siteURLRegex, err = compileRegexes(append(cfg.SiteURLPatterns, cfg.FeedURLPatterns...))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -80,8 +80,8 @@ func (m *Matcher) Matches(entry *models.Entry, cfg config.ConfigFilters) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if (len(cfg.FeedURLs) > 0 || len(m.siteURLRegex) > 0) &&
|
||||
!matchString(entry.SiteURL, cfg.FeedURLs, m.siteURLRegex, false) {
|
||||
if (len(cfg.SiteURLs) > 0 || len(cfg.FeedURLs) > 0 || len(m.siteURLRegex) > 0) &&
|
||||
!matchString(entry.SiteURL, append(cfg.SiteURLs, cfg.FeedURLs...), m.siteURLRegex, false) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ func (m *Matcher) Matches(entry *models.Entry, cfg config.ConfigFilters) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if (len(cfg.FeedURLs) > 0 || len(m.siteURLRegex) > 0) &&
|
||||
matchString(entry.SiteURL, cfg.FeedURLs, m.siteURLRegex, false) {
|
||||
if (len(cfg.SiteURLs) > 0 || len(cfg.FeedURLs) > 0 || len(m.siteURLRegex) > 0) &&
|
||||
matchString(entry.SiteURL, append(cfg.SiteURLs, cfg.FeedURLs...), m.siteURLRegex, false) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -155,10 +155,12 @@ func matchString(value string, exacts []string, patterns []*regexp.Regexp, exact
|
||||
func isEmpty(cfg config.ConfigFilters) bool {
|
||||
return len(cfg.FeedTitles) == 0 &&
|
||||
len(cfg.CategoryTitles) == 0 &&
|
||||
len(cfg.SiteURLs) == 0 &&
|
||||
len(cfg.FeedURLs) == 0 &&
|
||||
len(cfg.EntryURLs) == 0 &&
|
||||
len(cfg.FeedTitlePatterns) == 0 &&
|
||||
len(cfg.CategoryTitlePatterns) == 0 &&
|
||||
len(cfg.SiteURLPatterns) == 0 &&
|
||||
len(cfg.FeedURLPatterns) == 0 &&
|
||||
len(cfg.EntryURLPatterns) == 0
|
||||
}
|
||||
Reference in new issue
Block a user