Compare commits

..

1 Commits

Author SHA1 Message Date
Ildar Kamalov
317233cec9 client: fix dashboard table styles 2023-07-11 17:19:31 +03:00
11 changed files with 34 additions and 66 deletions

View File

@@ -66,8 +66,6 @@ In this release, the schema version has changed from 23 to 24.
### Fixed ### Fixed
- Two unspecified IPs when a host is blocked in two filter lists ([#5972]).
- Incorrect setting of Parental Control cache size.
- Excessive RAM and CPU consumption by Safe Browsing and Parental Control - Excessive RAM and CPU consumption by Safe Browsing and Parental Control
filters ([#5896]). filters ([#5896]).
@@ -82,7 +80,6 @@ In this release, the schema version has changed from 23 to 24.
image, and reload it from scratch. image, and reload it from scratch.
[#5896]: https://github.com/AdguardTeam/AdGuardHome/issues/5896 [#5896]: https://github.com/AdguardTeam/AdGuardHome/issues/5896
[#5972]: https://github.com/AdguardTeam/AdGuardHome/issues/5972
<!-- <!--
NOTE: Add new changes ABOVE THIS COMMENT. NOTE: Add new changes ABOVE THIS COMMENT.

View File

@@ -1,7 +1,7 @@
.card-header { .card-header {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 0.6rem 1.5rem; padding: 10px 24px;
} }
.card-subtitle { .card-subtitle {
@@ -16,11 +16,11 @@
.card-table-overflow--limited { .card-table-overflow--limited {
overflow-y: auto; overflow-y: auto;
max-height: 17.5rem; max-height: 280px;
} }
.dashboard .card-table-overflow--limited { .dashboard .card-table-overflow--limited {
max-height: 18rem; max-height: 288px;
} }
.card-actions { .card-actions {
@@ -38,7 +38,7 @@
} }
.card-body--status { .card-body--status {
padding: 2.5rem 1.5rem; padding: 40px 24px;
text-align: center; text-align: center;
} }
@@ -81,14 +81,14 @@
position: relative; position: relative;
flex: 1 1 auto; flex: 1 1 auto;
margin: 0; margin: 0;
padding: 1rem 1.5rem; padding: 16px 24px;
} }
.card-value-stats { .card-value-stats {
display: block; display: block;
font-size: 2.1rem; font-size: 2.1rem;
line-height: 2.7rem; line-height: 2.7rem;
height: 2.7rem; height: 44px;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@@ -108,7 +108,7 @@
} }
.card--full { .card--full {
height: calc(100% - 1.5rem); height: calc(100% - 22px);
} }
.card-wrap { .card-wrap {
@@ -125,7 +125,7 @@
@media (min-width: 992px) { @media (min-width: 992px) {
.dashboard .card:not(.card--full) { .dashboard .card:not(.card--full) {
height: 22rem; height: 350px;
} }
} }

View File

@@ -13363,7 +13363,7 @@ a.icon:hover {
padding: 0.5rem 1.5rem; padding: 0.5rem 1.5rem;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
min-height: 3.5rem; min-height: 60px;
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
} }

View File

@@ -21,8 +21,6 @@ func TestHandleDNSRequest_filterDNSResponse(t *testing.T) {
||cname.specific^$dnstype=~CNAME ||cname.specific^$dnstype=~CNAME
||0.0.0.1^$dnstype=~A ||0.0.0.1^$dnstype=~A
||::1^$dnstype=~AAAA ||::1^$dnstype=~AAAA
0.0.0.0 duplicate.domain
0.0.0.0 duplicate.domain
` `
forwardConf := ServerConfig{ forwardConf := ServerConfig{
@@ -139,17 +137,6 @@ func TestHandleDNSRequest_filterDNSResponse(t *testing.T) {
}, },
A: netutil.IPv4Zero(), A: netutil.IPv4Zero(),
}}, }},
}, {
req: createTestMessage("duplicate.domain."),
name: "duplicate_domain",
wantAns: []dns.RR{&dns.A{
Hdr: dns.RR_Header{
Name: "duplicate.domain.",
Rrtype: dns.TypeA,
Class: dns.ClassINET,
},
A: netutil.IPv4Zero(),
}},
}} }}
for _, tc := range testCases { for _, tc := range testCases {

View File

@@ -26,25 +26,11 @@ func (s *Server) makeResponse(req *dns.Msg) (resp *dns.Msg) {
return resp return resp
} }
// containsIP returns true if the IP is already in the list. // ipsFromRules extracts non-IP addresses from the filtering result rules.
func containsIP(ips []net.IP, ip net.IP) bool {
for _, a := range ips {
if a.Equal(ip) {
return true
}
}
return false
}
// ipsFromRules extracts unique non-IP addresses from the filtering result
// rules.
func ipsFromRules(resRules []*filtering.ResultRule) (ips []net.IP) { func ipsFromRules(resRules []*filtering.ResultRule) (ips []net.IP) {
for _, r := range resRules { for _, r := range resRules {
// len(resRules) and len(ips) are actually small enough for O(n^2) to do if r.IP != nil {
// not raise performance questions. ips = append(ips, r.IP)
if ip := r.IP; ip != nil && !containsIP(ips, ip) {
ips = append(ips, ip)
} }
} }

View File

@@ -47,7 +47,7 @@ func fromCacheItem(item *cacheItem) (data []byte) {
data = binary.BigEndian.AppendUint64(data, uint64(expiry)) data = binary.BigEndian.AppendUint64(data, uint64(expiry))
for _, v := range item.hashes { for _, v := range item.hashes {
// nolint:looppointer // The subslice of v is used for a copy. // nolint:looppointer // The subsilce is used for a copy.
data = append(data, v[:]...) data = append(data, v[:]...)
} }
@@ -63,7 +63,7 @@ func (c *Checker) findInCache(
i := 0 i := 0
for _, hash := range hashes { for _, hash := range hashes {
// nolint:looppointer // The has subslice is used for a cache lookup. // nolint:looppointer // The subsilce is used for a safe cache lookup.
data := c.cache.Get(hash[:prefixLen]) data := c.cache.Get(hash[:prefixLen])
if data == nil { if data == nil {
hashes[i] = hash hashes[i] = hash
@@ -98,36 +98,34 @@ func (c *Checker) storeInCache(hashesToRequest, respHashes []hostnameHash) {
for _, hash := range respHashes { for _, hash := range respHashes {
var pref prefix var pref prefix
// nolint:looppointer // The hash subslice is used for a copy. // nolint:looppointer // The subsilce is used for a copy.
copy(pref[:], hash[:]) copy(pref[:], hash[:])
hashToStore[pref] = append(hashToStore[pref], hash) hashToStore[pref] = append(hashToStore[pref], hash)
} }
for pref, hash := range hashToStore { for pref, hash := range hashToStore {
c.setCache(pref, hash) // nolint:looppointer // The subsilce is used for a safe cache lookup.
c.setCache(pref[:], hash)
} }
for _, hash := range hashesToRequest { for _, hash := range hashesToRequest {
// nolint:looppointer // The hash subslice is used for a cache lookup. // nolint:looppointer // The subsilce is used for a safe cache lookup.
val := c.cache.Get(hash[:prefixLen]) pref := hash[:prefixLen]
val := c.cache.Get(pref)
if val == nil { if val == nil {
var pref prefix
// nolint:looppointer // The hash subslice is used for a copy.
copy(pref[:], hash[:])
c.setCache(pref, nil) c.setCache(pref, nil)
} }
} }
} }
// setCache stores hash in cache. // setCache stores hash in cache.
func (c *Checker) setCache(pref prefix, hashes []hostnameHash) { func (c *Checker) setCache(pref []byte, hashes []hostnameHash) {
item := &cacheItem{ item := &cacheItem{
expiry: time.Now().Add(c.cacheTime), expiry: time.Now().Add(c.cacheTime),
hashes: hashes, hashes: hashes,
} }
c.cache.Set(pref[:], fromCacheItem(item)) c.cache.Set(pref, fromCacheItem(item))
log.Debug("%s: stored in cache: %v", c.svc, pref) log.Debug("%s: stored in cache: %v", c.svc, pref)
} }

View File

@@ -173,7 +173,7 @@ func (c *Checker) getQuestion(hashes []hostnameHash) (q string) {
b := &strings.Builder{} b := &strings.Builder{}
for _, hash := range hashes { for _, hash := range hashes {
// nolint:looppointer // The hash subslice is used for hex encoding. // nolint:looppointer // The subsilce is used for safe hex encoding.
stringutil.WriteToBuilder(b, hex.EncodeToString(hash[:prefixLen]), ".") stringutil.WriteToBuilder(b, hex.EncodeToString(hash[:prefixLen]), ".")
} }

View File

@@ -1505,7 +1505,6 @@ var blockedServices = []blockedService{{
"||aus.social^", "||aus.social^",
"||awscommunity.social^", "||awscommunity.social^",
"||climatejustice.social^", "||climatejustice.social^",
"||cupoftea.social^",
"||cyberplace.social^", "||cyberplace.social^",
"||defcon.social^", "||defcon.social^",
"||det.social^", "||det.social^",
@@ -1531,7 +1530,6 @@ var blockedServices = []blockedService{{
"||masto.pt^", "||masto.pt^",
"||mastodon.au^", "||mastodon.au^",
"||mastodon.bida.im^", "||mastodon.bida.im^",
"||mastodon.com.tr^",
"||mastodon.eus^", "||mastodon.eus^",
"||mastodon.green^", "||mastodon.green^",
"||mastodon.ie^", "||mastodon.ie^",
@@ -1553,11 +1551,11 @@ var blockedServices = []blockedService{{
"||mastodont.cat^", "||mastodont.cat^",
"||mastodontech.de^", "||mastodontech.de^",
"||mastodontti.fi^", "||mastodontti.fi^",
"||mastouille.fr^",
"||mathstodon.xyz^", "||mathstodon.xyz^",
"||metalhead.club^", "||metalhead.club^",
"||mindly.social^", "||mindly.social^",
"||mstdn.ca^", "||mstdn.ca^",
"||mstdn.jp^",
"||mstdn.party^", "||mstdn.party^",
"||mstdn.plus^", "||mstdn.plus^",
"||mstdn.social^", "||mstdn.social^",
@@ -1569,6 +1567,7 @@ var blockedServices = []blockedService{{
"||nrw.social^", "||nrw.social^",
"||o3o.ca^", "||o3o.ca^",
"||ohai.social^", "||ohai.social^",
"||pewtix.com^",
"||piaille.fr^", "||piaille.fr^",
"||pol.social^", "||pol.social^",
"||ravenation.club^", "||ravenation.club^",
@@ -1583,19 +1582,20 @@ var blockedServices = []blockedService{{
"||social.linux.pizza^", "||social.linux.pizza^",
"||social.politicaconciencia.org^", "||social.politicaconciencia.org^",
"||social.vivaldi.net^", "||social.vivaldi.net^",
"||sself.co^",
"||stranger.social^", "||stranger.social^",
"||sueden.social^", "||sueden.social^",
"||tech.lgbt^", "||tech.lgbt^",
"||techhub.social^", "||techhub.social^",
"||theblower.au^", "||theblower.au^",
"||tkz.one^", "||tkz.one^",
"||todon.eu^",
"||toot.aquilenet.fr^", "||toot.aquilenet.fr^",
"||toot.community^", "||toot.community^",
"||toot.funami.tech^", "||toot.funami.tech^",
"||toot.io^", "||toot.io^",
"||toot.wales^", "||toot.wales^",
"||troet.cafe^", "||troet.cafe^",
"||twingyeo.kr^",
"||union.place^", "||union.place^",
"||universeodon.com^", "||universeodon.com^",
"||urbanists.social^", "||urbanists.social^",

View File

@@ -470,7 +470,7 @@ func setupDNSFilteringConf(conf *filtering.Config) (err error) {
ServiceName: pcService, ServiceName: pcService,
TXTSuffix: pcTXTSuffix, TXTSuffix: pcTXTSuffix,
CacheTime: cacheTime, CacheTime: cacheTime,
CacheSize: conf.ParentalCacheSize, CacheSize: conf.SafeBrowsingCacheSize,
}) })
conf.SafeSearchConf.CustomResolver = safeSearchResolver{} conf.SafeSearchConf.CustomResolver = safeSearchResolver{}

View File

@@ -13,7 +13,7 @@ require (
golang.org/x/tools v0.11.0 golang.org/x/tools v0.11.0
golang.org/x/vuln v0.2.0 golang.org/x/vuln v0.2.0
// TODO(a.garipov): Return to tagged releases once a new one appears. // TODO(a.garipov): Return to tagged releases once a new one appears.
honnef.co/go/tools v0.5.0-0.dev.0.20230709092525-bc759185c5ee honnef.co/go/tools v0.5.0-0.dev.0.20230706211743-ddee6bbaa341
mvdan.cc/gofumpt v0.5.0 mvdan.cc/gofumpt v0.5.0
mvdan.cc/unparam v0.0.0-20230610194454-9ea02bef9868 mvdan.cc/unparam v0.0.0-20230610194454-9ea02bef9868
) )
@@ -27,7 +27,7 @@ require (
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/exp/typeparams v0.0.0-20230711023510-fffb14384f22 // indirect golang.org/x/exp/typeparams v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.12.0 // indirect golang.org/x/mod v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.10.0 // indirect golang.org/x/sys v0.10.0 // indirect

View File

@@ -52,8 +52,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp/typeparams v0.0.0-20230711023510-fffb14384f22 h1:e8iSCQYXZ4EB6q3kIfy2fgPFTvDbozqzRe4OuIOyrL4= golang.org/x/exp/typeparams v0.0.0-20230626212559-97b1e661b5df h1:jfUqBujZx2dktJVEmZpCkyngz7MWrVv1y9kLOqFNsqw=
golang.org/x/exp/typeparams v0.0.0-20230711023510-fffb14384f22/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230626212559-97b1e661b5df/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
@@ -107,8 +107,8 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.5.0-0.dev.0.20230709092525-bc759185c5ee h1:mpyvMqtlVZTwEv78QL3S2ZDTMHMO1fgNwr2kC7+K7oU= honnef.co/go/tools v0.5.0-0.dev.0.20230706211743-ddee6bbaa341 h1:jNlTAPEjbDiN9qda/1wple0GSpewFnWhvc1GO7bZX1U=
honnef.co/go/tools v0.5.0-0.dev.0.20230709092525-bc759185c5ee/go.mod h1:GUV+uIBCLpdf0/v6UhHHG/yzI/z6qPskBeQCjcNB96k= honnef.co/go/tools v0.5.0-0.dev.0.20230706211743-ddee6bbaa341/go.mod h1:GUV+uIBCLpdf0/v6UhHHG/yzI/z6qPskBeQCjcNB96k=
mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E= mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E=
mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js= mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js=
mvdan.cc/unparam v0.0.0-20230610194454-9ea02bef9868 h1:F4Q7pXcrU9UiU1fq0ZWqSOxKjNAteRuDr7JDk7uVLRQ= mvdan.cc/unparam v0.0.0-20230610194454-9ea02bef9868 h1:F4Q7pXcrU9UiU1fq0ZWqSOxKjNAteRuDr7JDk7uVLRQ=