Pull request: 4983 fix custom svcs

Merge in DNS/adguard-home from 4983-fix-custom-svcs to master

Updates #4945.
Updates #4982.

* commit '739e0098ec127045197ea697bae78acb2bd2c729':
  all: imp code, wording
  home: fix empty svcs
  bugfix: Fixed bug which was causing clients to continue following global service blocks even when user opted to not do that
This commit is contained in:
Eugene Burkov 2022-10-03 17:57:13 +03:00
commit 61bd217eb3
3 changed files with 12 additions and 6 deletions

View file

@ -24,7 +24,8 @@ and this project adheres to
### Fixed
- User-specific blocked services not applying correctly.
- User-specific blocked services not applying correctly ([#4945], [#4982],
[#4983]).
- `only application/json is allowed` errors in various APIs ([#4970]).
[#4970]: https://github.com/AdguardTeam/AdGuardHome/issues/4970
@ -96,6 +97,9 @@ All JSON APIs that expect a body now check if the request actually has
[#2993]: https://github.com/AdguardTeam/AdGuardHome/issues/2993
[#4927]: https://github.com/AdguardTeam/AdGuardHome/issues/4927
[#4930]: https://github.com/AdguardTeam/AdGuardHome/issues/4930
[#4945]: https://github.com/AdguardTeam/AdGuardHome/issues/4945
[#4982]: https://github.com/AdguardTeam/AdGuardHome/issues/4982
[#4983]: https://github.com/AdguardTeam/AdGuardHome/issues/4983
[ms-v0.107.14]: https://github.com/AdguardTeam/AdGuardHome/milestone/50?closed=1

View file

@ -244,10 +244,6 @@ func (clients *clientsContainer) addFromConfig(objects []*clientObject) {
}
}
if cli.BlockedServices == nil && cli.UseOwnBlockedServices {
cli.BlockedServices = []string{}
}
for _, t := range o.Tags {
if clients.allTags.Has(t) {
cli.Tags = append(cli.Tags, t)

View file

@ -358,7 +358,13 @@ func applyAdditionalFiltering(clientIP net.IP, clientID string, setts *filtering
log.Debug("%s: using settings for client %q (%s; %q)", pref, c.Name, clientIP, clientID)
if c.UseOwnBlockedServices {
Context.filters.ApplyBlockedServices(setts, c.BlockedServices)
// TODO(e.burkov): Get rid of this crutch.
svcs := c.BlockedServices
if svcs == nil {
svcs = []string{}
}
Context.filters.ApplyBlockedServices(setts, svcs)
log.Debug("%s: services for client %q set: %s", pref, c.Name, svcs)
}
setts.ClientName = c.Name