|
@@ -31,7 +31,6 @@ import (
|
|
|
"strings"
|
|
"strings"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
- "miniflux.app/v2/internal/config"
|
|
|
|
|
"miniflux.app/v2/internal/model"
|
|
"miniflux.app/v2/internal/model"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -70,10 +69,6 @@ func parseRule(userDefinedRule string) (bool, filterRule) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func IsBlockedEntry(blockRules filterRules, allowRules filterRules, feed *model.Feed, entry *model.Entry) bool {
|
|
func IsBlockedEntry(blockRules filterRules, allowRules filterRules, feed *model.Feed, entry *model.Entry) bool {
|
|
|
- if isBlockedGlobally(entry) {
|
|
|
|
|
- return true
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if matchesEntryFilterRules(blockRules, feed, entry) {
|
|
if matchesEntryFilterRules(blockRules, feed, entry) {
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
@@ -101,26 +96,6 @@ func IsBlockedEntry(blockRules filterRules, allowRules filterRules, feed *model.
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func isBlockedGlobally(entry *model.Entry) bool {
|
|
|
|
|
- if config.Opts == nil {
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if config.Opts.FilterEntryMaxAgeDays() > 0 {
|
|
|
|
|
- maxAge := time.Duration(config.Opts.FilterEntryMaxAgeDays()) * 24 * time.Hour
|
|
|
|
|
- if entry.Date.Before(time.Now().Add(-maxAge)) {
|
|
|
|
|
- slog.Debug("Entry is blocked globally due to max age",
|
|
|
|
|
- slog.String("entry_url", entry.URL),
|
|
|
|
|
- slog.Time("entry_date", entry.Date),
|
|
|
|
|
- slog.Duration("max_age", maxAge),
|
|
|
|
|
- )
|
|
|
|
|
- return true
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return false
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// matchesEntryRegexRules checks if the entry matches the regex rules defined in the feed or user settings.
|
|
// matchesEntryRegexRules checks if the entry matches the regex rules defined in the feed or user settings.
|
|
|
// It returns true if the entry matches the regex pattern, and a boolean indicating if the regex is valid.
|
|
// It returns true if the entry matches the regex pattern, and a boolean indicating if the regex is valid.
|
|
|
func matchesEntryRegexRules(regexPattern string, feed *model.Feed, entry *model.Entry) (bool, bool) {
|
|
func matchesEntryRegexRules(regexPattern string, feed *model.Feed, entry *model.Entry) (bool, bool) {
|