Pull request 2005: 6181-safebrowsing-default
Updates #6181. Squashed commit of the following: commit 3c4d0fe0750823c81548c2e81988ec27c718028f Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Sep 8 14:23:13 2023 +0300 home: fix default safe browsing, parental
This commit is contained in:
parent
62da8f4974
commit
5f696da9dc
|
@ -23,6 +23,13 @@ See also the [v0.107.38 GitHub milestone][ms-v0.107.38].
|
|||
NOTE: Add new changes BELOW THIS COMMENT.
|
||||
-->
|
||||
|
||||
### Fixed
|
||||
|
||||
- Empty or default Safe Browsing and Parental Control settings ([#6181]).
|
||||
- Various UI issues.
|
||||
|
||||
[#6181]: https://github.com/AdguardTeam/AdGuardHome/issues/6181
|
||||
|
||||
<!--
|
||||
NOTE: Add new changes ABOVE THIS COMMENT.
|
||||
-->
|
||||
|
|
|
@ -282,6 +282,12 @@ type statsConfig struct {
|
|||
Enabled bool `yaml:"enabled"`
|
||||
}
|
||||
|
||||
// Default block host constants.
|
||||
const (
|
||||
defaultSafeBrowsingBlockHost = "standard-block.dns.adguard.com"
|
||||
defaultParentalBlockHost = "family-block.dns.adguard.com"
|
||||
)
|
||||
|
||||
// config is the global configuration structure.
|
||||
//
|
||||
// TODO(a.garipov, e.burkov): This global is awful and must be removed.
|
||||
|
@ -389,6 +395,9 @@ var config = &configuration{
|
|||
Schedule: schedule.EmptyWeekly(),
|
||||
IDs: []string{},
|
||||
},
|
||||
|
||||
ParentalBlockHost: defaultParentalBlockHost,
|
||||
SafeBrowsingBlockHost: defaultSafeBrowsingBlockHost,
|
||||
},
|
||||
DHCP: &dhcpd.ServerConfig{
|
||||
LocalDomainName: "lan",
|
||||
|
|
|
@ -359,9 +359,6 @@ func setupDNSFilteringConf(conf *filtering.Config) (err error) {
|
|||
pcService = "parental control"
|
||||
defaultParentalServer = `https://family.adguard-dns.com/dns-query`
|
||||
pcTXTSuffix = `pc.dns.adguard.com.`
|
||||
|
||||
defaultSafeBrowsingBlockHost = "standard-block.dns.adguard.com"
|
||||
defaultParentalBlockHost = "family-block.dns.adguard.com"
|
||||
)
|
||||
|
||||
conf.EtcHosts = Context.etcHosts
|
||||
|
@ -398,8 +395,15 @@ func setupDNSFilteringConf(conf *filtering.Config) (err error) {
|
|||
CacheSize: conf.SafeBrowsingCacheSize,
|
||||
})
|
||||
|
||||
if conf.SafeBrowsingBlockHost != "" {
|
||||
conf.SafeBrowsingBlockHost = defaultSafeBrowsingBlockHost
|
||||
// Protect against invalid configuration, see #6181.
|
||||
//
|
||||
// TODO(a.garipov): Validate against an empty host instead of setting it to
|
||||
// default.
|
||||
if conf.SafeBrowsingBlockHost == "" {
|
||||
host := defaultSafeBrowsingBlockHost
|
||||
log.Info("%s: warning: empty blocking host; using default: %q", sbService, host)
|
||||
|
||||
conf.SafeBrowsingBlockHost = host
|
||||
}
|
||||
|
||||
parUps, err := upstream.AddressToUpstream(defaultParentalServer, upsOpts)
|
||||
|
@ -415,8 +419,15 @@ func setupDNSFilteringConf(conf *filtering.Config) (err error) {
|
|||
CacheSize: conf.ParentalCacheSize,
|
||||
})
|
||||
|
||||
if conf.ParentalBlockHost != "" {
|
||||
conf.ParentalBlockHost = defaultParentalBlockHost
|
||||
// Protect against invalid configuration, see #6181.
|
||||
//
|
||||
// TODO(a.garipov): Validate against an empty host instead of setting it to
|
||||
// default.
|
||||
if conf.ParentalBlockHost == "" {
|
||||
host := defaultParentalBlockHost
|
||||
log.Info("%s: warning: empty blocking host; using default: %q", pcService, host)
|
||||
|
||||
conf.ParentalBlockHost = host
|
||||
}
|
||||
|
||||
conf.SafeSearchConf.CustomResolver = safeSearchResolver{}
|
||||
|
|
|
@ -30,7 +30,7 @@ const (
|
|||
twoskyURI = "https://twosky.int.agrd.dev/api/v1"
|
||||
|
||||
readLimit = 1 * 1024 * 1024
|
||||
uploadTimeout = 10 * time.Second
|
||||
uploadTimeout = 20 * time.Second
|
||||
)
|
||||
|
||||
// blockerLangCodes is the codes of languages which need to be fully translated.
|
||||
|
|
Loading…
Reference in New Issue