all: imp code

This commit is contained in:
Stanislav Chzhen 2025-09-02 19:11:14 +03:00
parent 4215551bb3
commit 614879f2c8
3 changed files with 10 additions and 6 deletions

View File

@ -18,6 +18,10 @@ See also the [v0.107.66 GitHub milestone][ms-v0.107.66].
NOTE: Add new changes BELOW THIS COMMENT.
-->
### Changed
- Optimized matching of filtering rules.
### Fixed
- Authentication errors in the Web UI when AdGuard Home is behind a proxy that sets Basic Auth headers ([#7987]).

View File

@ -24,13 +24,13 @@ type IgnoreEngine struct {
// NewIgnoreEngine creates a new instance of the IgnoreEngine and stores the
// list of rules for ignoring hostnames.
func NewIgnoreEngine(ignored []string) (e *IgnoreEngine, err error) {
ruleList := []filterlist.Interface{
ruleLists := []filterlist.Interface{
filterlist.NewString(&filterlist.StringConfig{
RulesText: strings.ToLower(strings.Join(ignored, "\n")),
IgnoreCosmetic: true,
}),
}
ruleStorage, err := filterlist.NewRuleStorage(ruleList)
ruleStorage, err := filterlist.NewRuleStorage(ruleLists)
if err != nil {
return nil, err
}

View File

@ -796,9 +796,9 @@ func ruleListFromFilter(f Filter) (rl filterlist.Interface, skip bool, err error
id := int(f.ID)
if len(f.Data) != 0 {
return filterlist.NewString(&filterlist.StringConfig{
return filterlist.NewBytes(&filterlist.BytesConfig{
ID: id,
RulesText: string(f.Data),
RulesText: f.Data,
IgnoreCosmetic: true,
}), false, nil
}
@ -818,9 +818,9 @@ func ruleListFromFilter(f Filter) (rl filterlist.Interface, skip bool, err error
return nil, false, fmt.Errorf("reading filter content: %w", err)
}
return filterlist.NewString(&filterlist.StringConfig{
return filterlist.NewBytes(&filterlist.BytesConfig{
ID: id,
RulesText: string(data),
RulesText: data,
IgnoreCosmetic: true,
}), false, nil
}