docstring_tokens stringlengths 0 76.5k | code_tokens stringlengths 75 1.81M | label_window listlengths 4 2.12k | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|---|
func (d *DNSFilter) CheckHostRules(host string, rrtype uint16, setts *Settings) (Result, error) {
return d.matchHost(strings.ToLower(host), rrtype, setts) | <mask> return r != NotFilteredNotFound
<mask> }
<mask>
<mask> // CheckHostRules tries to match the host against filtering rules only.
<mask> func (d *DNSFilter) CheckHostRules(host string, qtype uint16, setts *Settings) (Result, error) {
<mask> if !setts.FilteringEnabled {
<mask> return Result{}, nil
<mask> }
<mask>
<mask> host = strings.ToLower(host)
<mask>
<mask> return d.matchHost(host, qtype, setts)
<mask> }
<mask>
<mask> // CheckHost tries to match the host against filtering rules, then safebrowsing
<mask> // and parental control rules, if they are enabled.
<mask> func (d *DNSFilter) CheckHost(
</s> Pull request: 4238 response filtering
Merge in DNS/adguard-home from 4238-response-filtering to master
Closes #4238.
Squashed commit of the following:
commit 2113f83c617a396a39f910bb8df939364fedf391
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 21:04:25 2022 +0300
dnsforward: restore a bit
commit f78607ed97892557c6bd6f3c3332f0bae01c1987
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:52:45 2022 +0300
all: imp code, docs
commit 646074ce141e8ac12a972f46d071389a2ce124e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:37:05 2022 +0300
all: log changes
commit 94556d810549370fc455bcf14537fa1d2783eed1
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:30:57 2022 +0300
all: imp test upstream, cover resp filtering
commit 63e7721822a049734a390c7d7ea6d8416a43c8b5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Feb 1 21:58:08 2022 +0300
all: filter response by rrtype </s> remove qtype uint16,
</s> add rrtype uint16, </s> remove // matchHost is a low-level way to check only if hostname is filtered by rules,
</s> add // matchHost is a low-level way to check only if host is filtered by rules, </s> remove // matchHostProcessAllowList processes the allowlist logic of host
// matching.
</s> add // matchHostProcessAllowList processes the allowlist logic of host matching. </s> remove func (s *Server) checkHostRules(host string, qtype uint16, setts *filtering.Settings) (
</s> add func (s *Server) checkHostRules(host string, rrtype uint16, setts *filtering.Settings) ( | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e783564084c8396fa0f216103e339d9c6991981a | internal/filtering/filtering.go |
// matchHostProcessAllowList processes the allowlist logic of host matching. | <mask>
<mask> return res
<mask> }
<mask>
<mask> // matchHostProcessAllowList processes the allowlist logic of host
<mask> // matching.
<mask> func (d *DNSFilter) matchHostProcessAllowList(
<mask> host string,
<mask> dnsres *urlfilter.DNSResult,
<mask> ) (res Result, err error) {
<mask> var matchedRules []rules.Rule
</s> Pull request: 4238 response filtering
Merge in DNS/adguard-home from 4238-response-filtering to master
Closes #4238.
Squashed commit of the following:
commit 2113f83c617a396a39f910bb8df939364fedf391
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 21:04:25 2022 +0300
dnsforward: restore a bit
commit f78607ed97892557c6bd6f3c3332f0bae01c1987
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:52:45 2022 +0300
all: imp code, docs
commit 646074ce141e8ac12a972f46d071389a2ce124e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:37:05 2022 +0300
all: log changes
commit 94556d810549370fc455bcf14537fa1d2783eed1
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:30:57 2022 +0300
all: imp test upstream, cover resp filtering
commit 63e7721822a049734a390c7d7ea6d8416a43c8b5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Feb 1 21:58:08 2022 +0300
all: filter response by rrtype </s> remove qtype uint16,
</s> add rrtype uint16, </s> remove func (d *DNSFilter) CheckHostRules(host string, qtype uint16, setts *Settings) (Result, error) {
if !setts.FilteringEnabled {
return Result{}, nil
}
host = strings.ToLower(host)
return d.matchHost(host, qtype, setts)
</s> add func (d *DNSFilter) CheckHostRules(host string, rrtype uint16, setts *Settings) (Result, error) {
return d.matchHost(strings.ToLower(host), rrtype, setts) </s> remove // If response contains CNAME, A or AAAA records, we apply filtering to each
// canonical host name or IP address. If this is a match, we set a new response
// in d.Res and return.
func (s *Server) filterDNSResponse(ctx *dnsContext) (*filtering.Result, error) {
</s> add // filterDNSResponse checks each resource record of the response's answer
// section from ctx and returns a non-nil res if at least one of canonnical
// names or IP addresses in it matches the filtering rules.
func (s *Server) filterDNSResponse(ctx *dnsContext) (res *filtering.Result, err error) { </s> remove func (s *Server) checkHostRules(host string, qtype uint16, setts *filtering.Settings) (
</s> add func (s *Server) checkHostRules(host string, rrtype uint16, setts *filtering.Settings) ( | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e783564084c8396fa0f216103e339d9c6991981a | internal/filtering/filtering.go |
// matchHost is a low-level way to check only if host is filtered by rules, | <mask>
<mask> return Result{}
<mask> }
<mask>
<mask> // matchHost is a low-level way to check only if hostname is filtered by rules,
<mask> // skipping expensive safebrowsing and parental lookups.
<mask> func (d *DNSFilter) matchHost(
<mask> host string,
<mask> qtype uint16,
<mask> setts *Settings,
</s> Pull request: 4238 response filtering
Merge in DNS/adguard-home from 4238-response-filtering to master
Closes #4238.
Squashed commit of the following:
commit 2113f83c617a396a39f910bb8df939364fedf391
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 21:04:25 2022 +0300
dnsforward: restore a bit
commit f78607ed97892557c6bd6f3c3332f0bae01c1987
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:52:45 2022 +0300
all: imp code, docs
commit 646074ce141e8ac12a972f46d071389a2ce124e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:37:05 2022 +0300
all: log changes
commit 94556d810549370fc455bcf14537fa1d2783eed1
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:30:57 2022 +0300
all: imp test upstream, cover resp filtering
commit 63e7721822a049734a390c7d7ea6d8416a43c8b5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Feb 1 21:58:08 2022 +0300
all: filter response by rrtype </s> remove qtype uint16,
</s> add rrtype uint16, </s> remove func (d *DNSFilter) CheckHostRules(host string, qtype uint16, setts *Settings) (Result, error) {
if !setts.FilteringEnabled {
return Result{}, nil
}
host = strings.ToLower(host)
return d.matchHost(host, qtype, setts)
</s> add func (d *DNSFilter) CheckHostRules(host string, rrtype uint16, setts *Settings) (Result, error) {
return d.matchHost(strings.ToLower(host), rrtype, setts) </s> remove func (s *Server) checkHostRules(host string, qtype uint16, setts *filtering.Settings) (
</s> add func (s *Server) checkHostRules(host string, rrtype uint16, setts *filtering.Settings) ( </s> remove CName map[string]string
</s> add CName map[string][]string </s> remove // TestUpstream is a mock of real upstream.
type TestUpstream struct {
</s> add // Upstream is a mock implementation of upstream.Upstream.
type Upstream struct { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e783564084c8396fa0f216103e339d9c6991981a | internal/filtering/filtering.go |
rrtype uint16, | <mask> // matchHost is a low-level way to check only if hostname is filtered by rules,
<mask> // skipping expensive safebrowsing and parental lookups.
<mask> func (d *DNSFilter) matchHost(
<mask> host string,
<mask> qtype uint16,
<mask> setts *Settings,
<mask> ) (res Result, err error) {
<mask> if !setts.FilteringEnabled {
<mask> return Result{}, nil
<mask> }
</s> Pull request: 4238 response filtering
Merge in DNS/adguard-home from 4238-response-filtering to master
Closes #4238.
Squashed commit of the following:
commit 2113f83c617a396a39f910bb8df939364fedf391
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 21:04:25 2022 +0300
dnsforward: restore a bit
commit f78607ed97892557c6bd6f3c3332f0bae01c1987
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:52:45 2022 +0300
all: imp code, docs
commit 646074ce141e8ac12a972f46d071389a2ce124e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:37:05 2022 +0300
all: log changes
commit 94556d810549370fc455bcf14537fa1d2783eed1
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:30:57 2022 +0300
all: imp test upstream, cover resp filtering
commit 63e7721822a049734a390c7d7ea6d8416a43c8b5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Feb 1 21:58:08 2022 +0300
all: filter response by rrtype </s> remove // matchHost is a low-level way to check only if hostname is filtered by rules,
</s> add // matchHost is a low-level way to check only if host is filtered by rules, </s> remove func (d *DNSFilter) CheckHostRules(host string, qtype uint16, setts *Settings) (Result, error) {
if !setts.FilteringEnabled {
return Result{}, nil
}
host = strings.ToLower(host)
return d.matchHost(host, qtype, setts)
</s> add func (d *DNSFilter) CheckHostRules(host string, rrtype uint16, setts *Settings) (Result, error) {
return d.matchHost(strings.ToLower(host), rrtype, setts) </s> remove // matchHostProcessAllowList processes the allowlist logic of host
// matching.
</s> add // matchHostProcessAllowList processes the allowlist logic of host matching. </s> remove func (s *Server) checkHostRules(host string, qtype uint16, setts *filtering.Settings) (
</s> add func (s *Server) checkHostRules(host string, rrtype uint16, setts *filtering.Settings) ( | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e783564084c8396fa0f216103e339d9c6991981a | internal/filtering/filtering.go |
DNSType: rrtype, | <mask> SortedClientTags: setts.ClientTags,
<mask> // TODO(e.burkov): Wait for urlfilter update to pass net.IP.
<mask> ClientIP: setts.ClientIP.String(),
<mask> ClientName: setts.ClientName,
<mask> DNSType: qtype,
<mask> }
<mask>
<mask> d.engineLock.RLock()
<mask> // Keep in mind that this lock must be held no just when calling Match() but
<mask> // also while using the rules returned by it.
</s> Pull request: 4238 response filtering
Merge in DNS/adguard-home from 4238-response-filtering to master
Closes #4238.
Squashed commit of the following:
commit 2113f83c617a396a39f910bb8df939364fedf391
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 21:04:25 2022 +0300
dnsforward: restore a bit
commit f78607ed97892557c6bd6f3c3332f0bae01c1987
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:52:45 2022 +0300
all: imp code, docs
commit 646074ce141e8ac12a972f46d071389a2ce124e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:37:05 2022 +0300
all: log changes
commit 94556d810549370fc455bcf14537fa1d2783eed1
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:30:57 2022 +0300
all: imp test upstream, cover resp filtering
commit 63e7721822a049734a390c7d7ea6d8416a43c8b5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Feb 1 21:58:08 2022 +0300
all: filter response by rrtype </s> remove // Check the response only if the it's from an upstream. Don't check
// the response if the protection is disabled since dnsrewrite rules
// aren't applied to it anyway.
</s> add // Check the response only if it's from an upstream. Don't check the
// response if the protection is disabled since dnsrewrite rules aren't
// applied to it anyway. </s> remove func (d *DNSFilter) CheckHostRules(host string, qtype uint16, setts *Settings) (Result, error) {
if !setts.FilteringEnabled {
return Result{}, nil
}
host = strings.ToLower(host)
return d.matchHost(host, qtype, setts)
</s> add func (d *DNSFilter) CheckHostRules(host string, rrtype uint16, setts *Settings) (Result, error) {
return d.matchHost(strings.ToLower(host), rrtype, setts) </s> remove // If response contains CNAME, A or AAAA records, we apply filtering to each
// canonical host name or IP address. If this is a match, we set a new response
// in d.Res and return.
func (s *Server) filterDNSResponse(ctx *dnsContext) (*filtering.Result, error) {
</s> add // filterDNSResponse checks each resource record of the response's answer
// section from ctx and returns a non-nil res if at least one of canonnical
// names or IP addresses in it matches the filtering rules.
func (s *Server) filterDNSResponse(ctx *dnsContext) (res *filtering.Result, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e783564084c8396fa0f216103e339d9c6991981a | internal/filtering/filtering.go |
res = d.matchHostProcessDNSResult(rrtype, dnsres) | <mask> // Don't check non-dnsrewrite filtering results.
<mask> return Result{}, nil
<mask> }
<mask>
<mask> res = d.matchHostProcessDNSResult(qtype, dnsres)
<mask> for _, r := range res.Rules {
<mask> log.Debug(
<mask> "filtering: found rule %q for host %q, filter list id: %d",
<mask> r.Text,
<mask> host,
</s> Pull request: 4238 response filtering
Merge in DNS/adguard-home from 4238-response-filtering to master
Closes #4238.
Squashed commit of the following:
commit 2113f83c617a396a39f910bb8df939364fedf391
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 21:04:25 2022 +0300
dnsforward: restore a bit
commit f78607ed97892557c6bd6f3c3332f0bae01c1987
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:52:45 2022 +0300
all: imp code, docs
commit 646074ce141e8ac12a972f46d071389a2ce124e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:37:05 2022 +0300
all: log changes
commit 94556d810549370fc455bcf14537fa1d2783eed1
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:30:57 2022 +0300
all: imp test upstream, cover resp filtering
commit 63e7721822a049734a390c7d7ea6d8416a43c8b5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Feb 1 21:58:08 2022 +0300
all: filter response by rrtype </s> remove func (d *DNSFilter) CheckHostRules(host string, qtype uint16, setts *Settings) (Result, error) {
if !setts.FilteringEnabled {
return Result{}, nil
}
host = strings.ToLower(host)
return d.matchHost(host, qtype, setts)
</s> add func (d *DNSFilter) CheckHostRules(host string, rrtype uint16, setts *Settings) (Result, error) {
return d.matchHost(strings.ToLower(host), rrtype, setts) </s> remove host = strings.TrimSuffix(host, ".")
res, err := s.checkHostRules(host, d.Req.Question[0].Qtype, ctx.setts)
</s> add log.Debug("dnsforward: checking %s %s for %s", dns.Type(rrtype), host, a.Header().Name)
res, err = s.checkHostRules(host, rrtype, setts) </s> remove qtype uint16,
</s> add rrtype uint16, </s> remove // Check the response only if the it's from an upstream. Don't check
// the response if the protection is disabled since dnsrewrite rules
// aren't applied to it anyway.
</s> add // Check the response only if it's from an upstream. Don't check the
// response if the protection is disabled since dnsrewrite rules aren't
// applied to it anyway. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e783564084c8396fa0f216103e339d9c6991981a | internal/filtering/filtering.go |
locUpstream := &aghtest.Upstream{ | <mask> aghtest.ReplaceLogLevel(t, log.DEBUG)
<mask> w := &bytes.Buffer{}
<mask> aghtest.ReplaceLogWriter(t, w)
<mask>
<mask> locUpstream := &aghtest.TestUpstream{
<mask> Reverse: map[string][]string{
<mask> "192.168.1.1": {"local.domain"},
<mask> "2a00:1450:400c:c06::93": {"ipv6.domain"},
<mask> },
<mask> }
</s> Pull request: 4238 response filtering
Merge in DNS/adguard-home from 4238-response-filtering to master
Closes #4238.
Squashed commit of the following:
commit 2113f83c617a396a39f910bb8df939364fedf391
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 21:04:25 2022 +0300
dnsforward: restore a bit
commit f78607ed97892557c6bd6f3c3332f0bae01c1987
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:52:45 2022 +0300
all: imp code, docs
commit 646074ce141e8ac12a972f46d071389a2ce124e4
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:37:05 2022 +0300
all: log changes
commit 94556d810549370fc455bcf14537fa1d2783eed1
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Feb 3 20:30:57 2022 +0300
all: imp test upstream, cover resp filtering
commit 63e7721822a049734a390c7d7ea6d8416a43c8b5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Feb 1 21:58:08 2022 +0300
all: filter response by rrtype </s> remove locUpstream := &aghtest.TestUpstream{
</s> add locUpstream := &aghtest.Upstream{ </s> remove extUpstream := &aghtest.TestUpstream{
</s> add extUpstream := &aghtest.Upstream{ </s> remove ups := &aghtest.TestUpstream{
</s> add ups := &aghtest.Upstream{ </s> remove }, &aghtest.TestUpstream{
</s> add }, &aghtest.Upstream{ </s> remove func ReplaceLogWriter(t *testing.T, w io.Writer) {
stdWriter := log.Writer()
t.Cleanup(func() {
log.SetOutput(stdWriter)
})
</s> add func ReplaceLogWriter(t testing.TB, w io.Writer) {
t.Helper()
prev := log.Writer()
t.Cleanup(func() { log.SetOutput(prev) }) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e783564084c8396fa0f216103e339d9c6991981a | internal/home/rdns_test.go |
"github.com/insomniacslk/dhcp/dhcpv6"
"github.com/insomniacslk/dhcp/dhcpv6/nclient6" | <mask> "github.com/insomniacslk/dhcp/dhcpv4"
<mask> "github.com/insomniacslk/dhcp/dhcpv4/nclient4"
<mask> "github.com/insomniacslk/dhcp/iana"
<mask> )
<mask>
<mask> // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface,
<mask> // and waits for a response for a period defined by defaultDiscoverTime
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { </s> remove if c != nil {
defer c.Close()
}
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/check_other_dhcp.go |
// CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, | <mask> "github.com/insomniacslk/dhcp/dhcpv4/nclient4"
<mask> "github.com/insomniacslk/dhcp/iana"
<mask> )
<mask>
<mask> // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
<mask> // and waits for a response for a period defined by defaultDiscoverTime
<mask> func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
<mask> iface, err := net.InterfaceByName(ifaceName)
<mask> if err != nil {
<mask> return false, wrapErrPrint(err, "Couldn't find interface by name %s", ifaceName)
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
return false, fmt.Errorf("not supported")
}
func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) { </s> remove if c != nil {
defer c.Close()
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/check_other_dhcp.go |
func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { | <mask> )
<mask>
<mask> // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
<mask> // and waits for a response for a period defined by defaultDiscoverTime
<mask> func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
<mask> iface, err := net.InterfaceByName(ifaceName)
<mask> if err != nil {
<mask> return false, wrapErrPrint(err, "Couldn't find interface by name %s", ifaceName)
<mask> }
<mask>
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
return false, fmt.Errorf("not supported")
}
func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) { </s> remove if c != nil {
defer c.Close()
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/check_other_dhcp.go |
<mask>
<mask> // bind to 0.0.0.0:68
<mask> log.Tracef("Listening to udp4 %+v", udpAddr)
<mask> c, err := nclient4.NewRawUDPConn(ifaceName, 68)
<mask> if c != nil {
<mask> defer c.Close()
<mask> }
<mask> if err != nil {
<mask> return false, wrapErrPrint(err, "Couldn't listen on :68")
<mask> }
<mask>
<mask> // send to 255.255.255.255:67
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/check_other_dhcp.go | |
if c != nil {
defer c.Close()
} | <mask> return false, wrapErrPrint(err, "Couldn't listen on :68")
<mask> }
<mask>
<mask> // send to 255.255.255.255:67
<mask> _, err = c.WriteTo(req.ToBytes(), dstAddr)
<mask> if err != nil {
<mask> return false, wrapErrPrint(err, "Couldn't send a packet to %s", dst)
<mask> }
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove if c != nil {
defer c.Close()
}
</s> add </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/check_other_dhcp.go |
func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
return false, fmt.Errorf("not supported")
}
func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) { | <mask> package dhcpd
<mask>
<mask> import "fmt"
<mask>
<mask> func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
<mask> return false, fmt.Errorf("not supported")
<mask> }
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, </s> remove if c != nil {
defer c.Close()
}
</s> add </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/check_other_dhcp_windows.go |
"github.com/AdguardTeam/golibs/jsonutil" | <mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/util"
<mask>
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> func httpError(r *http.Request, w http.ResponseWriter, code int, format string, args ...interface{}) {
<mask> text := fmt.Sprintf(format, args...)
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
return false, fmt.Errorf("not supported")
}
func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) { </s> remove found, err := CheckIfOtherDHCPServersPresent(interfaceName)
othSrv := map[string]interface{}{}
foundVal := "no"
if found {
foundVal = "yes"
} else if err != nil {
foundVal = "error"
othSrv["error"] = err.Error()
}
othSrv["found"] = foundVal
</s> add found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) | <mask> }
<mask>
<mask> func (s *Server) handleDHCPSetConfig(w http.ResponseWriter, r *http.Request) {
<mask> newconfig := dhcpServerConfigJSON{}
<mask> err := json.NewDecoder(r.Body).Decode(&newconfig)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err)
<mask> return
<mask> }
<mask>
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4conf.InterfaceName = newconfig.InterfaceName
</s> add var s4 DHCPServer
var s6 DHCPServer
v4Enabled := false
v6Enabled := false </s> remove result["other_server"] = othSrv
result["static_ip"] = staticIP
</s> add result["v4"] = v4
result["v6"] = v6 </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove if newconfig.Enabled {
</s> add if s.conf.Enabled { </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
var s4 DHCPServer
var s6 DHCPServer
v4Enabled := false
v6Enabled := false | <mask> httpError(r, w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err)
<mask> return
<mask> }
<mask>
<mask> v4conf := v4JSONToServerConf(newconfig.V4)
<mask> v4conf.Enabled = newconfig.Enabled
<mask> if len(v4conf.RangeStart) == 0 {
<mask> v4conf.Enabled = false
<mask> }
<mask> v4conf.InterfaceName = newconfig.InterfaceName
<mask>
<mask> c4 := V4ServerConf{}
<mask> s.srv4.WriteDiskConfig4(&c4)
<mask> v4conf.notify = c4.notify
<mask> v4conf.ICMPTimeout = c4.ICMPTimeout
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout
</s> add if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName </s> remove s4, err := v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
}
</s> add c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName | <mask> v4conf.Enabled = false
<mask> }
<mask> v4conf.InterfaceName = newconfig.InterfaceName
<mask>
<mask> c4 := V4ServerConf{}
<mask> s.srv4.WriteDiskConfig4(&c4)
<mask> v4conf.notify = c4.notify
<mask> v4conf.ICMPTimeout = c4.ICMPTimeout
<mask>
<mask> s4, err := v4Create(v4conf)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
<mask> return
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove s4, err := v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
}
</s> add c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout </s> remove v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4conf.InterfaceName = newconfig.InterfaceName
</s> add var s4 DHCPServer
var s6 DHCPServer
v4Enabled := false
v6Enabled := false </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout | <mask> s.srv4.WriteDiskConfig4(&c4)
<mask> v4conf.notify = c4.notify
<mask> v4conf.ICMPTimeout = c4.ICMPTimeout
<mask>
<mask> s4, err := v4Create(v4conf)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
<mask> return
<mask> }
<mask>
<mask> v6conf := v6JSONToServerConf(newconfig.V6)
<mask> v6conf.Enabled = newconfig.Enabled
<mask> if len(v6conf.RangeStart) == 0 {
<mask> v6conf.Enabled = false
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout
</s> add if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} </s> remove v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4conf.InterfaceName = newconfig.InterfaceName
</s> add var s4 DHCPServer
var s6 DHCPServer
v4Enabled := false
v6Enabled := false </s> remove if newconfig.Enabled {
</s> add if s.conf.Enabled { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} | <mask> httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
<mask> return
<mask> }
<mask>
<mask> v6conf := v6JSONToServerConf(newconfig.V6)
<mask> v6conf.Enabled = newconfig.Enabled
<mask> if len(v6conf.RangeStart) == 0 {
<mask> v6conf.Enabled = false
<mask> }
<mask> v6conf.InterfaceName = newconfig.InterfaceName
<mask> v6conf.notify = s.onNotify
<mask> s6, err := v6Create(v6conf)
<mask> if s6 == nil {
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} </s> remove s4, err := v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
}
</s> add c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout </s> remove c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout
</s> add if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName </s> remove v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4conf.InterfaceName = newconfig.InterfaceName
</s> add var s4 DHCPServer
var s6 DHCPServer
v4Enabled := false
v6Enabled := false | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} | <mask> v6conf.Enabled = newconfig.Enabled
<mask> if len(v6conf.RangeStart) == 0 {
<mask> v6conf.Enabled = false
<mask> }
<mask> v6conf.InterfaceName = newconfig.InterfaceName
<mask> v6conf.notify = s.onNotify
<mask> s6, err := v6Create(v6conf)
<mask> if s6 == nil {
<mask> httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
<mask> return
<mask> }
<mask>
<mask> if newconfig.Enabled && !v4conf.Enabled && !v6conf.Enabled {
<mask> httpError(r, w, http.StatusBadRequest, "DHCPv4 or DHCPv6 configuration must be complete")
<mask> return
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove if newconfig.Enabled && !v4conf.Enabled && !v6conf.Enabled {
</s> add if newconfig.Enabled && !v4Enabled && !v6Enabled { </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove s4, err := v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
}
</s> add c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout </s> remove c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout
</s> add if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName </s> remove v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4conf.InterfaceName = newconfig.InterfaceName
</s> add var s4 DHCPServer
var s6 DHCPServer
v4Enabled := false
v6Enabled := false | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
if newconfig.Enabled && !v4Enabled && !v6Enabled { | <mask> httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
<mask> return
<mask> }
<mask>
<mask> if newconfig.Enabled && !v4conf.Enabled && !v6conf.Enabled {
<mask> httpError(r, w, http.StatusBadRequest, "DHCPv4 or DHCPv6 configuration must be complete")
<mask> return
<mask> }
<mask>
<mask> s.Stop()
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove s4, err := v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
}
</s> add c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout </s> remove c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout
</s> add if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
if js.Exists("enabled") {
s.conf.Enabled = newconfig.Enabled
}
if js.Exists("interface_name") {
s.conf.InterfaceName = newconfig.InterfaceName
} | <mask> }
<mask>
<mask> s.Stop()
<mask>
<mask> s.conf.Enabled = newconfig.Enabled
<mask> s.conf.InterfaceName = newconfig.InterfaceName
<mask> s.srv4 = s4
<mask> s.srv6 = s6
<mask>
<mask> s.conf.ConfigModified()
<mask>
<mask> if newconfig.Enabled {
<mask> staticIP, err := HasStaticIP(newconfig.InterfaceName)
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove if newconfig.Enabled {
</s> add if s.conf.Enabled { </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
if s4 != nil {
s.srv4 = s4
}
if s6 != nil {
s.srv6 = s6
} | <mask> if js.Exists("interface_name") {
<mask> s.conf.InterfaceName = newconfig.InterfaceName
<mask> }
<mask>
<mask> s.conf.ConfigModified()
<mask> s.dbLoad()
<mask>
<mask> if s.conf.Enabled {
<mask> staticIP, err := HasStaticIP(newconfig.InterfaceName)
<mask> if !staticIP && err == nil {
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove s.conf.Enabled = newconfig.Enabled
s.conf.InterfaceName = newconfig.InterfaceName
s.srv4 = s4
s.srv6 = s6
</s> add if js.Exists("enabled") {
s.conf.Enabled = newconfig.Enabled
}
if js.Exists("interface_name") {
s.conf.InterfaceName = newconfig.InterfaceName
} </s> remove if newconfig.Enabled {
</s> add if s.conf.Enabled { </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
s.dbLoad() | <mask> if s6 != nil {
<mask> s.srv6 = s6
<mask> }
<mask> s.conf.ConfigModified()
<mask>
<mask> if s.conf.Enabled {
<mask> staticIP, err := HasStaticIP(newconfig.InterfaceName)
<mask> if !staticIP && err == nil {
<mask> err = SetStaticIP(newconfig.InterfaceName)
<mask> if err != nil {
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove if newconfig.Enabled {
</s> add if s.conf.Enabled { </s> remove s.conf.Enabled = newconfig.Enabled
s.conf.InterfaceName = newconfig.InterfaceName
s.srv4 = s4
s.srv6 = s6
</s> add if js.Exists("enabled") {
s.conf.Enabled = newconfig.Enabled
}
if js.Exists("interface_name") {
s.conf.InterfaceName = newconfig.InterfaceName
} </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err := v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
</s> add if js.Exists("v6") {
v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
}
v6Enabled = v6conf.Enabled
v6conf.InterfaceName = newconfig.InterfaceName
v6conf.notify = s.onNotify
s6, err = v6Create(v6conf)
if s6 == nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
return
} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
if s.conf.Enabled { | <mask> s.srv6 = s6
<mask>
<mask> s.conf.ConfigModified()
<mask>
<mask> if newconfig.Enabled {
<mask> staticIP, err := HasStaticIP(newconfig.InterfaceName)
<mask> if !staticIP && err == nil {
<mask> err = SetStaticIP(newconfig.InterfaceName)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove s.conf.Enabled = newconfig.Enabled
s.conf.InterfaceName = newconfig.InterfaceName
s.srv4 = s4
s.srv6 = s6
</s> add if js.Exists("enabled") {
s.conf.Enabled = newconfig.Enabled
}
if js.Exists("interface_name") {
s.conf.InterfaceName = newconfig.InterfaceName
} </s> remove result["other_server"] = othSrv
result["static_ip"] = staticIP
</s> add result["v4"] = v4
result["v6"] = v6 </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName) | <mask> http.Error(w, errorText, http.StatusBadRequest)
<mask> return
<mask> }
<mask>
<mask> found, err := CheckIfOtherDHCPServersPresent(interfaceName)
<mask>
<mask> othSrv := map[string]interface{}{}
<mask> foundVal := "no"
<mask> if found {
<mask> foundVal = "yes"
<mask> } else if err != nil {
<mask> foundVal = "error"
<mask> othSrv["error"] = err.Error()
<mask> }
<mask> othSrv["found"] = foundVal
<mask>
<mask> staticIP := map[string]interface{}{}
<mask> isStaticIP, err := HasStaticIP(interfaceName)
<mask> staticIPStatus := "yes"
<mask> if err != nil {
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove result["other_server"] = othSrv
result["static_ip"] = staticIP
</s> add result["v4"] = v4
result["v6"] = v6 </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} </s> remove c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout
</s> add if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
result["v4"] = v4
result["v6"] = v6 | <mask> }
<mask> staticIP["static"] = staticIPStatus
<mask>
<mask> result := map[string]interface{}{}
<mask> result["other_server"] = othSrv
<mask> result["static_ip"] = staticIP
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
<mask> err = json.NewEncoder(w).Encode(result)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "Failed to marshal DHCP found json: %s", err)
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove found, err := CheckIfOtherDHCPServersPresent(interfaceName)
othSrv := map[string]interface{}{}
foundVal := "no"
if found {
foundVal = "yes"
} else if err != nil {
foundVal = "error"
othSrv["error"] = err.Error()
}
othSrv["found"] = foundVal
</s> add found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName) </s> remove if newconfig.Enabled {
</s> add if s.conf.Enabled { </s> remove err := json.NewDecoder(r.Body).Decode(&newconfig)
</s> add newconfig.Enabled = s.conf.Enabled
newconfig.InterfaceName = s.conf.InterfaceName
js, err := jsonutil.DecodeObject(&newconfig, r.Body) </s> remove v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4conf.InterfaceName = newconfig.InterfaceName
</s> add var s4 DHCPServer
var s6 DHCPServer
v4Enabled := false
v6Enabled := false </s> remove v6conf := v6JSONToServerConf(newconfig.V6)
v6conf.Enabled = newconfig.Enabled
if len(v6conf.RangeStart) == 0 {
v6conf.Enabled = false
</s> add s4, err = v4Create(v4conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
return
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | dhcpd/dhcp_http.go |
version: "0.104" | <mask> openapi: 3.0.3
<mask> info:
<mask> title: AdGuard Home
<mask> description: AdGuard Home REST API. Admin web interface is built on top of this REST API.
<mask> version: "0.102"
<mask> contact:
<mask> name: "AdGuard Home"
<mask> url: "https://github.com/AdguardTeam/AdGuardHome"
<mask>
<mask> servers:
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove if c != nil {
defer c.Close()
}
</s> add </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | openapi/openapi.yaml |
properties:
v4:
$ref: "#/components/schemas/DhcpSearchV4"
v6:
$ref: "#/components/schemas/DhcpSearchV6"
DhcpSearchV4:
type: object | <mask> DhcpSearchResult:
<mask> type: object
<mask> description: Information about a DHCP server discovered in the current network
<mask> properties:
<mask> other_server:
<mask> $ref: "#/components/schemas/DhcpSearchResultOtherServer"
<mask> static_ip:
<mask> $ref: "#/components/schemas/DhcpSearchResultStaticIP"
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { </s> remove version: "0.102"
</s> add version: "0.104" | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | openapi/openapi.yaml |
DhcpSearchV6:
type: object
properties:
other_server:
$ref: "#/components/schemas/DhcpSearchResultOtherServer"
| <mask> $ref: "#/components/schemas/DhcpSearchResultOtherServer"
<mask> static_ip:
<mask> $ref: "#/components/schemas/DhcpSearchResultStaticIP"
<mask> DhcpSearchResultOtherServer:
<mask> type: object
<mask> properties:
<mask> found:
<mask> type: string
<mask> description: yes|no|error
</s> * POST /control/dhcp/find_active_dhcp: add dhcpv6 server info </s> remove version: "0.102"
</s> add version: "0.104" </s> remove c4 := V4ServerConf{}
s.srv4.WriteDiskConfig4(&c4)
v4conf.notify = c4.notify
v4conf.ICMPTimeout = c4.ICMPTimeout
</s> add if js.Exists("v4") {
v4conf := v4JSONToServerConf(newconfig.V4)
v4conf.Enabled = newconfig.Enabled
if len(v4conf.RangeStart) == 0 {
v4conf.Enabled = false
}
v4Enabled = v4conf.Enabled
v4conf.InterfaceName = newconfig.InterfaceName </s> remove // CheckIfOtherDHCPServersPresent sends a DHCP request to the specified network interface,
</s> add // CheckIfOtherDHCPServersPresentV4 sends a DHCP request to the specified network interface, </s> remove func CheckIfOtherDHCPServersPresent(ifaceName string) (bool, error) {
</s> add func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) { | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7bef3a4480ea0cd6d4d6d612ca3f0e3d737a222 | openapi/openapi.yaml |
"rewrite_updated": "DNS rewrite successfully updated", | <mask> "rewrite_added": "DNS rewrite for \"{{key}}\" successfully added",
<mask> "rewrite_deleted": "DNS rewrite for \"{{key}}\" successfully deleted",
<mask> "rewrite_add": "Add DNS rewrite",
<mask> "rewrite_edit": "Edit DNS rewrite",
<mask> "rewrite_not_found": "No DNS rewrites found",
<mask> "rewrite_confirm_delete": "Are you sure you want to delete DNS rewrite for \"{{key}}\"?",
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/__locales/en.json |
"rewrite_edit": "Edit DNS rewrite", | <mask> "rewrite_updated": "DNS rewrite successfully updated",
<mask> "rewrite_add": "Add DNS rewrite",
<mask> "rewrite_not_found": "No DNS rewrites found",
<mask> "rewrite_confirm_delete": "Are you sure you want to delete DNS rewrite for \"{{key}}\"?",
<mask> "rewrite_desc": "Allows to easily configure custom DNS response for a specific domain name.",
<mask> "rewrite_applied": "Rewrite rule is applied",
<mask> "rewrite_hosts_applied": "Rewritten by the hosts file rule",
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/__locales/en.json |
REWRITE_UPDATE = { path: 'rewrite/update', method: 'PUT' };
| <mask> REWRITE_ADD = { path: 'rewrite/add', method: 'POST' };
<mask>
<mask> REWRITE_DELETE = { path: 'rewrite/delete', method: 'POST' };
<mask>
<mask> getRewritesList() {
<mask> const { path, method } = this.REWRITES_LIST;
<mask> return this.makeRequest(path, method);
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/api/Api.js |
updateRewrite(config) {
const { path, method } = this.REWRITE_UPDATE;
const parameters = {
data: config,
};
return this.makeRequest(path, method, parameters);
}
| <mask> }
<mask>
<mask> deleteRewrite(config) {
<mask> const { path, method } = this.REWRITE_DELETE;
<mask> const parameters = {
<mask> data: config,
<mask> };
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/api/Api.js |
initialValues: PropTypes.object, | <mask> submitting: PropTypes.bool.isRequired,
<mask> processingAdd: PropTypes.bool.isRequired,
<mask> t: PropTypes.func.isRequired,
<mask> };
<mask>
<mask> export default flow([
<mask> withTranslation(),
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Form.js |
import { MODAL_TYPE } from '../../../helpers/constants'; | <mask> import { Trans, withTranslation } from 'react-i18next';
<mask> import ReactModal from 'react-modal';
<mask>
<mask> import Form from './Form';
<mask>
<mask> const Modal = (props) => {
<mask> const {
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Modal.js |
modalType,
currentRewrite, | <mask> toggleRewritesModal,
<mask> processingAdd,
<mask> processingDelete,
<mask> } = props;
<mask>
<mask> return (
<mask> <ReactModal
<mask> className="Modal__Bootstrap modal-dialog modal-dialog-centered"
<mask> closeTimeoutMS={0}
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Modal.js |
{modalType === MODAL_TYPE.EDIT_REWRITE ? (
<Trans>rewrite_edit</Trans>
) : (
<Trans>rewrite_add</Trans>
)} | <mask> >
<mask> <div className="modal-content">
<mask> <div className="modal-header">
<mask> <h4 className="modal-title">
<mask> <Trans>rewrite_add</Trans>
<mask> </h4>
<mask> <button type="button" className="close" onClick={() => toggleRewritesModal()}>
<mask> <span className="sr-only">Close</span>
<mask> </button>
<mask> </div>
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove onClick={() => toggleRewritesModal()}
</s> add onClick={() => toggleRewritesModal({ type: MODAL_TYPE.ADD_REWRITE })} </s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Modal.js |
initialValues={{ ...currentRewrite }} | <mask> <span className="sr-only">Close</span>
<mask> </button>
<mask> </div>
<mask> <Form
<mask> onSubmit={handleSubmit}
<mask> toggleRewritesModal={toggleRewritesModal}
<mask> processingAdd={processingAdd}
<mask> processingDelete={processingDelete}
<mask> />
<mask> </div>
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove <Trans>rewrite_add</Trans>
</s> add {modalType === MODAL_TYPE.EDIT_REWRITE ? (
<Trans>rewrite_edit</Trans>
) : (
<Trans>rewrite_add</Trans>
)} </s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Modal.js |
modalType: PropTypes.string.isRequired,
currentRewrite: PropTypes.object, | <mask> toggleRewritesModal: PropTypes.func.isRequired,
<mask> processingAdd: PropTypes.bool.isRequired,
<mask> processingDelete: PropTypes.bool.isRequired,
<mask> };
<mask>
<mask> export default withTranslation()(Modal);
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Modal.js |
import { MODAL_TYPE } from '../../../helpers/constants'; | <mask> import ReactTable from 'react-table';
<mask> import { withTranslation } from 'react-i18next';
<mask> import { sortIp } from '../../../helpers/helpers';
<mask>
<mask> class Table extends Component {
<mask> cellWrap = ({ value }) => (
<mask> <div className="logs__row o-hidden">
<mask> <span className="logs__text" title={value}>
<mask> {value}
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Table.js |
Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, | <mask> accessor: 'actions',
<mask> maxWidth: 100,
<mask> sortable: false,
<mask> resizable: false,
<mask> Cell: (value) => (
<mask> <div className="logs__row logs__row--center">
<mask> <button
<mask> type="button"
<mask> className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
<mask> onClick={() => this.props.handleDelete({
<mask> answer: value.row.answer,
<mask> domain: value.row.domain,
<mask> })
<mask> }
<mask> title={this.props.t('delete_table_action')}
<mask> >
<mask> <svg className="icons">
<mask> <use xlinkHref="#delete" />
<mask> </svg>
<mask> </button>
<mask> </div>
<mask> ),
<mask> },
<mask> ];
<mask>
<mask> render() {
<mask> const {
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove <Trans>rewrite_add</Trans>
</s> add {modalType === MODAL_TYPE.EDIT_REWRITE ? (
<Trans>rewrite_edit</Trans>
) : (
<Trans>rewrite_add</Trans>
)} </s> remove onClick={() => toggleRewritesModal()}
</s> add onClick={() => toggleRewritesModal({ type: MODAL_TYPE.ADD_REWRITE })} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"k... | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Table.js |
processingUpdate: PropTypes.bool.isRequired, | <mask> list: PropTypes.array.isRequired,
<mask> processing: PropTypes.bool.isRequired,
<mask> processingAdd: PropTypes.bool.isRequired,
<mask> processingDelete: PropTypes.bool.isRequired,
<mask> handleDelete: PropTypes.func.isRequired,
<mask> toggleRewritesModal: PropTypes.func.isRequired,
<mask> };
<mask>
<mask> export default withTranslation()(Table);
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Table.js |
toggleRewritesModal: PropTypes.func.isRequired, | <mask> processingUpdate: PropTypes.bool.isRequired,
<mask> handleDelete: PropTypes.func.isRequired,
<mask> };
<mask>
<mask> export default withTranslation()(Table);
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"add",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/Table.js |
import { MODAL_TYPE } from '../../../helpers/constants'; | <mask> import Modal from './Modal';
<mask> import Card from '../../ui/Card';
<mask> import PageTitle from '../../ui/PageTitle';
<mask>
<mask> class Rewrites extends Component {
<mask> componentDidMount() {
<mask> this.props.getRewritesList();
<mask> }
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove handleSubmit = (values) => {
this.props.addRewrite(values);
};
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
<mask> componentDidMount() {
<mask> this.props.getRewritesList();
<mask> }
<mask>
<mask> handleSubmit = (values) => {
<mask> this.props.addRewrite(values);
<mask> };
<mask>
<mask> handleDelete = (values) => {
<mask> // eslint-disable-next-line no-alert
<mask> if (window.confirm(this.props.t('rewrite_confirm_delete', { key: values.domain }))) {
<mask> this.props.deleteRewrite(values);
<mask> }
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js | |
handleSubmit = (values) => {
const { modalType, currentRewrite } = this.props.rewrites;
if (modalType === MODAL_TYPE.EDIT_REWRITE && currentRewrite) {
this.props.updateRewrite({
target: currentRewrite,
update: values,
});
} else {
this.props.addRewrite(values);
}
};
| <mask> this.props.deleteRewrite(values);
<mask> }
<mask> };
<mask>
<mask> render() {
<mask> const {
<mask> t,
<mask> rewrites,
<mask> toggleRewritesModal,
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove handleSubmit = (values) => {
this.props.addRewrite(values);
};
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
processingUpdate,
modalType,
currentRewrite, | <mask> processingAdd,
<mask> processingDelete,
<mask> } = rewrites;
<mask>
<mask> return (
<mask> <Fragment>
<mask> <PageTitle
<mask> title={t('dns_rewrites')}
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
processingUpdate={processingUpdate} | <mask> processingAdd={processingAdd}
<mask> processingDelete={processingDelete}
<mask> handleDelete={this.handleDelete}
<mask> toggleRewritesModal={toggleRewritesModal}
<mask> />
<mask>
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
toggleRewritesModal={toggleRewritesModal} | <mask> processingDelete={processingDelete}
<mask> processingUpdate={processingUpdate}
<mask> handleDelete={this.handleDelete}
<mask> />
<mask>
<mask> <button
<mask> type="button"
<mask> className="btn btn-success btn-standard mt-3"
<mask> onClick={() => toggleRewritesModal({ type: MODAL_TYPE.ADD_REWRITE })}
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove onClick={() => toggleRewritesModal()}
</s> add onClick={() => toggleRewritesModal({ type: MODAL_TYPE.ADD_REWRITE })} </s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, </s> remove <Trans>rewrite_add</Trans>
</s> add {modalType === MODAL_TYPE.EDIT_REWRITE ? (
<Trans>rewrite_edit</Trans>
) : (
<Trans>rewrite_add</Trans>
)} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
onClick={() => toggleRewritesModal({ type: MODAL_TYPE.ADD_REWRITE })} | <mask>
<mask> <button
<mask> type="button"
<mask> className="btn btn-success btn-standard mt-3"
<mask> onClick={() => toggleRewritesModal()}
<mask> disabled={processingAdd}
<mask> >
<mask> <Trans>rewrite_add</Trans>
<mask> </button>
<mask>
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove <Trans>rewrite_add</Trans>
</s> add {modalType === MODAL_TYPE.EDIT_REWRITE ? (
<Trans>rewrite_edit</Trans>
) : (
<Trans>rewrite_add</Trans>
)} </s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
modalType={modalType} | <mask>
<mask> <Modal
<mask> isModalOpen={isModalOpen}
<mask> toggleRewritesModal={toggleRewritesModal}
<mask> handleSubmit={this.handleSubmit}
<mask> processingAdd={processingAdd}
<mask> processingDelete={processingDelete}
<mask> processingUpdate={processingUpdate}
<mask> currentRewrite={currentRewrite}
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
processingUpdate={processingUpdate}
currentRewrite={currentRewrite} | <mask> handleSubmit={this.handleSubmit}
<mask> processingAdd={processingAdd}
<mask> processingDelete={processingDelete}
<mask> />
<mask> </Fragment>
<mask> </Card>
<mask> </Fragment>
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
updateRewrite: PropTypes.func.isRequired, | <mask> getRewritesList: PropTypes.func.isRequired,
<mask> toggleRewritesModal: PropTypes.func.isRequired,
<mask> addRewrite: PropTypes.func.isRequired,
<mask> deleteRewrite: PropTypes.func.isRequired,
<mask> rewrites: PropTypes.object.isRequired,
<mask> };
<mask>
<mask> export default withTranslation()(Rewrites);
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Rewrites/index.js |
// eslint-disable-next-line react/prop-types | <mask> Header: <Trans>list_url_table_header</Trans>,
<mask> accessor: 'url',
<mask> minWidth: 180,
<mask> Cell: ({ value }) => (
<mask> <div className="logs__row">
<mask> {isValidAbsolutePath(value) ? value
<mask> : <a
<mask> href={value}
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove <Trans>rewrite_add</Trans>
</s> add {modalType === MODAL_TYPE.EDIT_REWRITE ? (
<Trans>rewrite_edit</Trans>
) : (
<Trans>rewrite_add</Trans>
)} </s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/Filters/Table.js |
protectionDisabledDuration: PropTypes.number,
toggleProtectionSuccess: PropTypes.func.isRequired, | <mask> };
<mask>
<mask> ProtectionTimer.propTypes = {
<mask> setProtectionTimerTime: PropTypes.func.isRequired,
<mask> };
<mask>
<mask> const mapStateToProps = (state) => {
<mask> const { dashboard } = state;
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/components/ProtectionTimer/index.js |
updateRewrite, | <mask> import {
<mask> getRewritesList,
<mask> addRewrite,
<mask> deleteRewrite,
<mask> toggleRewritesModal,
<mask> } from '../actions/rewrites';
<mask> import Rewrites from '../components/Filters/Rewrites';
<mask>
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/containers/DnsRewrites.js |
updateRewrite, | <mask> getRewritesList,
<mask> addRewrite,
<mask> deleteRewrite,
<mask> toggleRewritesModal,
<mask> };
<mask>
<mask> export default connect(
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/containers/DnsRewrites.js |
ADD_REWRITE: 'ADD_REWRITE',
EDIT_REWRITE: 'EDIT_REWRITE', | <mask> ADD_FILTERS: 'ADD_FILTERS',
<mask> EDIT_FILTERS: 'EDIT_FILTERS',
<mask> CHOOSE_FILTERING_LIST: 'CHOOSE_FILTERING_LIST',
<mask> };
<mask>
<mask> export const CLIENT_ID = {
<mask> MAC: 'mac',
<mask> IP: 'ip',
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/helpers/constants.js |
[actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
| <mask> [actions.deleteRewriteRequest]: (state) => ({ ...state, processingDelete: true }),
<mask> [actions.deleteRewriteFailure]: (state) => ({ ...state, processingDelete: false }),
<mask> [actions.deleteRewriteSuccess]: (state) => ({ ...state, processingDelete: false }),
<mask>
<mask> [actions.toggleRewritesModal]: (state) => {
<mask> const newState = {
<mask> ...state,
<mask> isModalOpen: !state.isModalOpen,
<mask> };
<mask> return newState;
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/reducers/rewrites.js |
processingUpdate: false, | <mask> processingAdd: false,
<mask> processingDelete: false,
<mask> isModalOpen: false,
<mask> modalType: '',
<mask> currentRewrite: {},
<mask> list: [],
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
</s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/reducers/rewrites.js |
modalType: '',
currentRewrite: {}, | <mask> processingUpdate: false,
<mask> isModalOpen: false,
<mask> list: [],
<mask> },
<mask> );
<mask>
</s> Pull request 1889: AG-22207 handle rewrite update
Updates #1577
Squashed commit of the following:
commit a07ff51fb3f1eb58ab9a922d7bc11ed1d65ef3a7
Merge: 7db696814 2f515e8d8
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 16:50:09 2023 +0300
Merge branch 'master' into AG-22207
commit 7db696814f2134fd3a3415cbcfa0ffdac1fabda3
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:57:09 2023 +0300
fix changelog
commit bf9458b3f18697ca1fc504c51fa443934f76371f
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 14:48:20 2023 +0300
changelog
commit bc2bf3f9507957afe63a654334b6e22858d1e41b
Author: Ildar Kamalov <ik@adguard.com>
Date: Fri Jun 23 13:28:28 2023 +0300
client: handle rewrite edit </s> remove [actions.toggleRewritesModal]: (state) => {
</s> add [actions.updateRewriteRequest]: (state) => ({ ...state, processingUpdate: true }),
[actions.updateRewriteFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.updateRewriteSuccess]: (state) => {
const newState = {
...state,
processingUpdate: false,
};
return newState;
},
[actions.toggleRewritesModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
modalType: payload.type || '',
isModalOpen: !state.isModalOpen,
currentRewrite: payload.currentRewrite,
};
return newState;
}
</s> remove Cell: (value) => (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-icon--green btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete({
answer: value.row.answer,
domain: value.row.domain,
})
}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
),
</s> add Cell: (value) => {
const currentRewrite = {
answer: value.row.answer,
domain: value.row.domain,
};
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() => {
this.props.toggleRewritesModal({
type: MODAL_TYPE.EDIT_REWRITE,
currentRewrite,
});
}}
disabled={this.props.processingUpdate}
title={this.props.t('edit_table_action')}
>
<svg className="icons icon12">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.handleDelete(currentRewrite)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
}, | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e7e638443fd4dbb3a074d615f1b82719699e8a1d | client/src/reducers/rewrites.js |
var webHandlersRegistered = false
| <mask> const leaseExpireStatic = 1
<mask>
<mask> // Lease contains the necessary information about a DHCP lease
<mask> // field ordering is important -- yaml fields will mirror ordering from here
<mask> type Lease struct {
<mask> HWAddr net.HardwareAddr `json:"mac" yaml:"hwaddr"`
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove if s.conf.HTTPRegister != nil {
s.registerHandlers()
}
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | dhcpd/dhcpd.go |
<mask> log.Error("DHCP: %s", err)
<mask> return nil
<mask> }
<mask> }
<mask> if s.conf.HTTPRegister != nil {
<mask> s.registerHandlers()
<mask> }
<mask>
<mask> // we can't delay database loading until DHCP server is started,
<mask> // because we need static leases functionality available beforehand
<mask> s.dbLoad()
<mask> return &s
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | dhcpd/dhcpd.go | |
if !webHandlersRegistered && s.conf.HTTPRegister != nil {
webHandlersRegistered = true
s.registerHandlers()
}
| <mask> // Start will listen on port 67 and serve DHCP requests.
<mask> func (s *Server) Start() error {
<mask>
<mask> // TODO: don't close if interface and addresses are the same
<mask> if s.conn != nil {
<mask> s.closeConn()
<mask> }
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove clients.registerWebHandlers()
</s> add // Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | dhcpd/dhcpd.go |
var webHandlersRegistered = false
| <mask> clientsUpdatePeriod = 1 * time.Hour
<mask> )
<mask>
<mask> // Client information
<mask> type Client struct {
<mask> IDs []string
<mask> Tags []string
<mask> Name string
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> remove clients.registerWebHandlers()
</s> add // Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/clients.go |
<mask> clients.dhcpServer = dhcpServer
<mask> clients.addFromConfig(objects)
<mask>
<mask> if !clients.testing {
<mask> go clients.periodicUpdate()
<mask>
<mask> clients.addFromDHCP()
<mask> clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
<mask>
<mask> clients.registerWebHandlers()
<mask> }
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove clients.registerWebHandlers()
</s> add // Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/clients.go | |
}
} | <mask> if !clients.testing {
<mask> clients.addFromDHCP()
<mask> clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
<mask>
<mask> // Start - start the module
<mask> func (clients *clientsContainer) Start() {
<mask> if !clients.testing {
<mask> if !webHandlersRegistered {
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove clients.registerWebHandlers()
</s> add // Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() </s> remove go clients.periodicUpdate()
</s> add </s> remove stopHTTPServer()
</s> add </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/clients.go |
// Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() | <mask>
<mask> clients.addFromDHCP()
<mask> clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
<mask>
<mask> clients.registerWebHandlers()
<mask> }
<mask> }
<mask>
<mask> // Reload - reload auto-clients
<mask> func (clients *clientsContainer) Reload() {
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove go clients.periodicUpdate()
</s> add </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/clients.go |
http.Redirect(w, r, "/install.html", http.StatusFound) | <mask> return func(w http.ResponseWriter, r *http.Request) {
<mask> if Context.firstRun &&
<mask> !strings.HasPrefix(r.URL.Path, "/install.") &&
<mask> r.URL.Path != "/favicon.png" {
<mask> http.Redirect(w, r, "/install.html", http.StatusSeeOther) // should not be cacheable
<mask> return
<mask> }
<mask> // enforce https?
<mask> if config.TLS.ForceHTTPS && r.TLS == nil && config.TLS.Enabled && config.TLS.PortHTTPS != 0 && Context.httpsServer.server != nil {
<mask> // yes, and we want host from host:port
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/control.go |
registerControlHandlers()
| <mask> return
<mask> }
<mask>
<mask> // this needs to be done in a goroutine because Shutdown() is a blocking call, and it will block
<mask> // until all requests are finished, and _we_ are inside a request right now, so it will block indefinitely
<mask> if restartHTTP {
<mask> go func() {
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove
// wait indefinitely for other go-routines to complete their job
select {}
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/control_install.go |
<mask> // Complete an update procedure
<mask> func finishUpdate(u *updateInfo) {
<mask> log.Info("Stopping all tasks")
<mask> cleanup()
<mask> stopHTTPServer()
<mask> cleanupAlways()
<mask>
<mask> if runtime.GOOS == "windows" {
<mask> if Context.runningAsService {
<mask> // Note:
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> remove clients.registerWebHandlers()
</s> add // Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() </s> remove http.Redirect(w, r, "/install.html", http.StatusSeeOther) // should not be cacheable
</s> add http.Redirect(w, r, "/install.html", http.StatusFound) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/control_update.go | |
<mask>
<mask> import (
<mask> "fmt"
<mask> "net"
<mask> "os"
<mask> "path/filepath"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> "github.com/AdguardTeam/AdGuardHome/dnsforward"
<mask> "github.com/AdguardTeam/AdGuardHome/querylog"
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> remove if s.conf.HTTPRegister != nil {
s.registerHandlers()
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/dns.go | |
var err error | <mask> // so that we had access to the query log and the stats
<mask> func initDNSServer() error {
<mask> baseDir := Context.getDataDir()
<mask>
<mask> statsConf := stats.Config{
<mask> Filename: filepath.Join(baseDir, "stats.db"),
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove err := os.MkdirAll(baseDir, 0755)
if err != nil {
return fmt.Errorf("Cannot create DNS data dir at %s: %s", baseDir, err)
}
</s> add </s> remove
// wait indefinitely for other go-routines to complete their job
select {}
</s> add </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/dns.go |
<mask> // so that we had access to the query log and the stats
<mask> func initDNSServer() error {
<mask> baseDir := Context.getDataDir()
<mask>
<mask> err := os.MkdirAll(baseDir, 0755)
<mask> if err != nil {
<mask> return fmt.Errorf("Cannot create DNS data dir at %s: %s", baseDir, err)
<mask> }
<mask>
<mask> statsConf := stats.Config{
<mask> Filename: filepath.Join(baseDir, "stats.db"),
<mask> LimitDays: config.DNS.StatsInterval,
<mask> ConfigModified: onConfigModified,
<mask> HTTPRegister: httpRegister,
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/dns.go | |
<mask> closeDNSServer()
<mask> return fmt.Errorf("dnsServer.Prepare: %s", err)
<mask> }
<mask>
<mask> sessFilename := filepath.Join(baseDir, "sessions.db")
<mask> Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
<mask> if Context.auth == nil {
<mask> closeDNSServer()
<mask> return fmt.Errorf("Couldn't initialize Auth module")
<mask> }
<mask> config.Users = nil
<mask>
<mask> Context.rdns = InitRDNS(Context.dnsServer, &Context.clients)
<mask> Context.whois = initWhois(&Context.clients)
<mask>
<mask> Context.filters.Init()
<mask> return nil
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") </s> remove if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> add </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/dns.go | |
Context.clients.Start()
| <mask> enableFilters(false)
<mask>
<mask> err := Context.dnsServer.Start()
<mask> if err != nil {
<mask> return errorx.Decorate(err, "Couldn't start forwarding DNS server")
<mask> }
<mask>
<mask> Context.dnsFilter.Start()
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() </s> remove err := os.MkdirAll(baseDir, 0755)
if err != nil {
return fmt.Errorf("Cannot create DNS data dir at %s: %s", baseDir, err)
}
</s> add </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/dns.go |
<mask> Context.queryLog.Close()
<mask> Context.queryLog = nil
<mask> }
<mask>
<mask> if Context.auth != nil {
<mask> Context.auth.Close()
<mask> Context.auth = nil
<mask> }
<mask>
<mask> Context.filters.Close()
<mask>
<mask> log.Debug("Closed all DNS modules")
<mask> }
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> remove sessFilename := filepath.Join(baseDir, "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
closeDNSServer()
return fmt.Errorf("Couldn't initialize Auth module")
}
config.Users = nil
</s> add </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/dns.go | |
if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
} | <mask> config.BindPort = args.bindPort
<mask> }
<mask>
<mask> if !Context.firstRun {
<mask> // Save the updated config
<mask> err := config.write()
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") </s> remove clients.registerWebHandlers()
</s> add // Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
}
err := os.MkdirAll(Context.getDataDir(), 0755)
if err != nil {
log.Fatalf("Cannot create DNS data dir at %s: %s", Context.getDataDir(), err)
} | <mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask>
<mask> err = initWeb()
<mask> if err != nil {
<mask> log.Fatalf("%s", err)
<mask> }
<mask>
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() | <mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask>
<mask> err = initDNSServer()
<mask> if err != nil {
<mask> log.Fatalf("%s", err)
<mask> }
<mask> go func() {
<mask> err := startDNSServer()
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove err := os.MkdirAll(baseDir, 0755)
if err != nil {
return fmt.Errorf("Cannot create DNS data dir at %s: %s", baseDir, err)
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") | <mask> log.Fatal(err)
<mask> }
<mask> }
<mask>
<mask> if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
<mask> Context.pidFileName = args.pidFile
<mask> }
<mask>
<mask> // Initialize and run the admin Web interface
<mask> box := packr.NewBox("../build/static")
<mask>
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove http.Redirect(w, r, "/install.html", http.StatusSeeOther) // should not be cacheable
</s> add http.Redirect(w, r, "/install.html", http.StatusFound) </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
config.Users = nil | <mask> if Context.auth == nil {
<mask> return fmt.Errorf("Couldn't initialize Auth module")
<mask> }
<mask>
<mask> // Initialize and run the admin Web interface
<mask> box := packr.NewBox("../build/static")
<mask>
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") </s> remove sessFilename := filepath.Join(baseDir, "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
closeDNSServer()
return fmt.Errorf("Couldn't initialize Auth module")
}
config.Users = nil
</s> add </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> remove if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
<mask> box := packr.NewBox("../build/static")
<mask>
<mask> // if not configured, redirect / to /install.html, otherwise redirect /install.html to /
<mask> http.Handle("/", postInstallHandler(optionalAuthHandler(gziphandler.GzipHandler(http.FileServer(box)))))
<mask> registerControlHandlers()
<mask>
<mask> // add handlers for /install paths, we only need them when we're not configured yet
<mask> if Context.firstRun {
<mask> log.Info("This is the first launch of AdGuard Home, redirecting everything to /install.html ")
<mask> http.Handle("/install.html", preInstallHandler(http.FileServer(box)))
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove
// wait indefinitely for other go-routines to complete their job
select {}
</s> add </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") </s> remove http.Redirect(w, r, "/install.html", http.StatusSeeOther) // should not be cacheable
</s> add http.Redirect(w, r, "/install.html", http.StatusFound) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go | |
} else {
registerControlHandlers() | <mask> if Context.firstRun {
<mask> log.Info("This is the first launch of AdGuard Home, redirecting everything to /install.html ")
<mask> http.Handle("/install.html", preInstallHandler(http.FileServer(box)))
<mask> registerInstallHandlers()
<mask> }
<mask>
<mask> Context.httpsServer.cond = sync.NewCond(&Context.httpsServer.Mutex)
<mask> return nil
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove registerControlHandlers()
</s> add </s> remove _ = Context.httpServer.Shutdown(context.TODO())
</s> add if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
return nil
} | <mask> registerControlHandlers()
<mask> }
<mask>
<mask> Context.httpsServer.cond = sync.NewCond(&Context.httpsServer.Mutex)
<mask>
<mask> func startWeb() {
<mask> // for https, we have a separate goroutine loop
<mask> go httpServerLoop()
<mask>
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove
// wait indefinitely for other go-routines to complete their job
select {}
</s> add </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
func startWeb() { | <mask> Context.httpsServer.cond = sync.NewCond(&Context.httpsServer.Mutex)
<mask> return nil
<mask> }
<mask>
<mask> // for https, we have a separate goroutine loop
<mask> go httpServerLoop()
<mask>
<mask> // this loop is used as an ability to change listening host and/or port
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove
// wait indefinitely for other go-routines to complete their job
select {}
</s> add </s> remove if s.conf.HTTPRegister != nil {
s.registerHandlers()
}
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
<mask> log.Fatal(err)
<mask> }
<mask> // We use ErrServerClosed as a sign that we need to rebind on new address, so go back to the start of the loop
<mask> }
<mask>
<mask> // wait indefinitely for other go-routines to complete their job
<mask> select {}
<mask> }
<mask>
<mask> func httpServerLoop() {
<mask> for !Context.httpsServer.shutdown {
<mask> Context.httpsServer.cond.L.Lock()
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove if len(args.pidFile) != 0 && writePIDFile(args.pidFile) {
Context.pidFileName = args.pidFile
</s> add startWeb()
// wait indefinitely for other go-routines to complete their job
select {}
}
// Initialize Web modules
func initWeb() error {
sessFilename := filepath.Join(Context.getDataDir(), "sessions.db")
Context.auth = InitAuth(sessFilename, config.Users, config.WebSessionTTLHours*60*60)
if Context.auth == nil {
return fmt.Errorf("Couldn't initialize Auth module") </s> remove registerControlHandlers()
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go | |
stopHTTPServer()
| <mask> log.Info("Stopping AdGuard Home")
<mask>
<mask> err := stopDNSServer()
<mask> if err != nil {
<mask> log.Error("Couldn't stop DNS server: %s", err)
<mask> }
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() </s> remove err := os.MkdirAll(baseDir, 0755)
if err != nil {
return fmt.Errorf("Cannot create DNS data dir at %s: %s", baseDir, err)
}
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
if Context.httpServer != nil {
_ = Context.httpServer.Shutdown(context.TODO())
}
if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
| <mask> Context.httpsServer.shutdown = true
<mask> if Context.httpsServer.server != nil {
<mask> _ = Context.httpsServer.server.Shutdown(context.TODO())
<mask> }
<mask> _ = Context.httpServer.Shutdown(context.TODO())
<mask> log.Info("Stopped HTTP server")
<mask> }
<mask>
<mask> // This function is called before application exits
<mask> func cleanupAlways() {
</s> * refactor
1. Auth module was initialized inside dns.go - now it's moved to initWeb()
2. stopHTTPServer() wasn't called on server stop - now we do that
3. Don't use postInstall() HTTP filter where it's not necessary.
Now we register handlers after installation is complete. </s> remove clients.registerWebHandlers()
</s> add // Start - start the module
func (clients *clientsContainer) Start() {
if !clients.testing {
if !webHandlersRegistered {
webHandlersRegistered = true
clients.registerWebHandlers()
}
go clients.periodicUpdate() </s> remove err = initDNSServer()
</s> add err = initWeb()
if err != nil {
log.Fatalf("%s", err)
}
if !Context.firstRun {
err := initDNSServer() </s> remove if Context.auth != nil {
Context.auth.Close()
Context.auth = nil
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8129f15c7985ca12fbdd13f1c49c792c3f0a03a | home/home.go |
httpError(r, w, http.StatusBadRequest, "invalid dhcpv4 configuration: %s", err)
| <mask> v4conf.ICMPTimeout = c4.ICMPTimeout
<mask>
<mask> s4, err = v4Create(v4conf)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> if js.Exists("v6") {
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
</s> remove staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
if !staticIP && err == nil {
err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
if err != nil {
httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
return
}
}
err = s.Start()
</s> add var code int
code, err = s.enableDHCP(newconfig.InterfaceName) </s> remove httpError(r, w, http.StatusBadRequest, "Failed to start DHCP server: %s", err)
</s> add httpError(r, w, code, "enabling dhcp: %s", err)
</s> remove if !ok && len(descr) != 0 {
m["orgname"] = trimValue(descr)
} else if !ok && len(netname) != 0 {
m["orgname"] = trimValue(netname)
</s> add if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} </s> remove // descr or netname -> orgname
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/dhcpd/dhcphttp.go |
httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
| <mask> v6conf.InterfaceName = newconfig.InterfaceName
<mask> v6conf.notify = s.onNotify
<mask> s6, err = v6Create(v6conf)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> if newconfig.Enabled && !v4Enabled && !v6Enabled {
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove httpError(r, w, http.StatusBadRequest, "DHCPv4 or DHCPv6 configuration must be complete")
</s> add httpError(r, w, http.StatusBadRequest, "dhcpv4 or dhcpv6 configuration must be complete")
</s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv4 configuration: %s", err)
</s> remove staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
if !staticIP && err == nil {
err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
if err != nil {
httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
return
}
}
err = s.Start()
</s> add var code int
code, err = s.enableDHCP(newconfig.InterfaceName) </s> remove if !ok && len(descr) != 0 {
m["orgname"] = trimValue(descr)
} else if !ok && len(netname) != 0 {
m["orgname"] = trimValue(netname)
</s> add if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} </s> remove // descr or netname -> orgname
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/dhcpd/dhcphttp.go |
httpError(r, w, http.StatusBadRequest, "dhcpv4 or dhcpv6 configuration must be complete")
| <mask> }
<mask> }
<mask>
<mask> if newconfig.Enabled && !v4Enabled && !v6Enabled {
<mask> httpError(r, w, http.StatusBadRequest, "DHCPv4 or DHCPv6 configuration must be complete")
<mask> return
<mask> }
<mask>
<mask> s.Stop()
<mask>
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
</s> remove staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
if !staticIP && err == nil {
err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
if err != nil {
httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
return
}
}
err = s.Start()
</s> add var code int
code, err = s.enableDHCP(newconfig.InterfaceName) </s> remove httpError(r, w, http.StatusBadRequest, "Failed to start DHCP server: %s", err)
</s> add httpError(r, w, code, "enabling dhcp: %s", err)
</s> remove // descr or netname -> orgname
</s> add </s> remove if !ok && len(descr) != 0 {
m["orgname"] = trimValue(descr)
} else if !ok && len(netname) != 0 {
m["orgname"] = trimValue(netname)
</s> add if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/dhcpd/dhcphttp.go |
var code int
code, err = s.enableDHCP(newconfig.InterfaceName) | <mask> s.conf.ConfigModified()
<mask> s.dbLoad()
<mask>
<mask> if s.conf.Enabled {
<mask> staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
<mask> if !staticIP && err == nil {
<mask> err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> err = s.Start()
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "Failed to start DHCP server: %s", err)
<mask> return
<mask> }
<mask> }
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove httpError(r, w, http.StatusBadRequest, "Failed to start DHCP server: %s", err)
</s> add httpError(r, w, code, "enabling dhcp: %s", err)
</s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
</s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv4 configuration: %s", err)
</s> remove if !ok && len(descr) != 0 {
m["orgname"] = trimValue(descr)
} else if !ok && len(netname) != 0 {
m["orgname"] = trimValue(netname)
</s> add if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} </s> remove // descr or netname -> orgname
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/dhcpd/dhcphttp.go |
httpError(r, w, code, "enabling dhcp: %s", err)
| <mask> }
<mask>
<mask> err = s.Start()
<mask> if err != nil {
<mask> httpError(r, w, http.StatusBadRequest, "Failed to start DHCP server: %s", err)
<mask> return
<mask> }
<mask> }
<mask> }
<mask>
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
if !staticIP && err == nil {
err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
if err != nil {
httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
return
}
}
err = s.Start()
</s> add var code int
code, err = s.enableDHCP(newconfig.InterfaceName) </s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv4 configuration: %s", err)
</s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
</s> remove httpError(r, w, http.StatusBadRequest, "DHCPv4 or DHCPv6 configuration must be complete")
</s> add httpError(r, w, http.StatusBadRequest, "dhcpv4 or dhcpv6 configuration must be complete")
</s> remove if !ok && len(descr) != 0 {
m["orgname"] = trimValue(descr)
} else if !ok && len(netname) != 0 {
m["orgname"] = trimValue(netname)
</s> add if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/dhcpd/dhcphttp.go |
case "city", "country", "orgname": | <mask>
<mask> switch k {
<mask> case "org-name":
<mask> m["orgname"] = trimValue(v)
<mask> case "orgname":
<mask> fallthrough
<mask> case "city":
<mask> fallthrough
<mask> case "country":
<mask> m[k] = trimValue(v)
<mask>
<mask> case "descr":
<mask> if len(descr) == 0 {
<mask> descr = v
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove // descr or netname -> orgname
</s> add </s> remove if !ok && len(descr) != 0 {
m["orgname"] = trimValue(descr)
} else if !ok && len(netname) != 0 {
m["orgname"] = trimValue(netname)
</s> add if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} </s> remove staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
if !staticIP && err == nil {
err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
if err != nil {
httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
return
}
}
err = s.Start()
</s> add var code int
code, err = s.enableDHCP(newconfig.InterfaceName) </s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
</s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv4 configuration: %s", err)
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/home/whois.go |
<mask> }
<mask> }
<mask> }
<mask>
<mask> // descr or netname -> orgname
<mask> _, ok := m["orgname"]
<mask> if !ok && len(descr) != 0 {
<mask> m["orgname"] = trimValue(descr)
<mask> } else if !ok && len(netname) != 0 {
<mask> m["orgname"] = trimValue(netname)
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove if !ok && len(descr) != 0 {
m["orgname"] = trimValue(descr)
} else if !ok && len(netname) != 0 {
m["orgname"] = trimValue(netname)
</s> add if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} </s> remove case "orgname":
fallthrough
case "city":
fallthrough
case "country":
</s> add case "city", "country", "orgname": </s> remove staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
if !staticIP && err == nil {
err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
if err != nil {
httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
return
}
}
err = s.Start()
</s> add var code int
code, err = s.enableDHCP(newconfig.InterfaceName) </s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
</s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv4 configuration: %s", err)
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/home/whois.go | |
if !ok {
// Set orgname from either descr or netname for the frontent.
//
// TODO(a.garipov): Perhaps don't do that in the V1 HTTP API?
if descr != "" {
m["orgname"] = trimValue(descr)
} else if netname != "" {
m["orgname"] = trimValue(netname)
} | <mask> }
<mask>
<mask> // descr or netname -> orgname
<mask> _, ok := m["orgname"]
<mask> if !ok && len(descr) != 0 {
<mask> m["orgname"] = trimValue(descr)
<mask> } else if !ok && len(netname) != 0 {
<mask> m["orgname"] = trimValue(netname)
<mask> }
<mask>
<mask> return m
<mask> }
<mask>
</s> Pull request #976: all: imp cyclomatic complexity, minor improvements
Merge in DNS/adguard-home from less-cyclo to master
Updates #2646.
Squashed commit of the following:
commit 42f81c9f716ca7a2878d481b96d31d86f7c4151b
Merge: f61e2366 42b88c32
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:07:04 2021 +0300
Merge branch 'master' into less-cyclo
commit f61e2366ea10a289cec2f76b700e7117850cd4e2
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 5 15:06:02 2021 +0300
home: imp docs
commit e3c2310ce09cb78dd53ebbe728de4d2e72e6caf7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jan 27 21:14:30 2021 +0300
all: imp cyclomatic complexity, minor improvements </s> remove // descr or netname -> orgname
</s> add </s> remove staticIP, err := sysutil.IfaceHasStaticIP(newconfig.InterfaceName)
if !staticIP && err == nil {
err = sysutil.IfaceSetStaticIP(newconfig.InterfaceName)
if err != nil {
httpError(r, w, http.StatusInternalServerError, "Failed to configure static IP: %s", err)
return
}
}
err = s.Start()
</s> add var code int
code, err = s.enableDHCP(newconfig.InterfaceName) </s> remove case "orgname":
fallthrough
case "city":
fallthrough
case "country":
</s> add case "city", "country", "orgname": </s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv6 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv6 configuration: %s", err)
</s> remove httpError(r, w, http.StatusBadRequest, "Invalid DHCPv4 configuration: %s", err)
</s> add httpError(r, w, http.StatusBadRequest, "invalid dhcpv4 configuration: %s", err)
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e84effffc386fccfb3165279ff959f4537c3c6d0 | internal/home/whois.go |
<mask> "orgname": "Organization name",
<mask> "netname": "Network name",
<mask> "descr": "Description",
<mask> "whois": "Whois",
<mask> "filtering_rules_learn_more": "<0>Learn more</0> about creating your own hosts blocklists."
<mask> } </s> + client: handle blocked by response in query log </s> remove reason, filterId, rule, status,
</s> add reason, filterId, rule, status, originalAnswer, </s> remove {this.renderResponseList(responses, status)}
</s> add {originalAnswer
? this.renderResponseList(normalizedAnswer, status)
: this.renderResponseList(responses, status)
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8885dbf3e8f4e9f5e486031813712c88625ba64 | client/src/__locales/en.json | |
normalizeResponse = response => (
response.map((response) => {
const { value, type, ttl } = response;
return `${type}: ${value} (ttl=${ttl})`;
})
);
| <mask> </div>
<mask> );
<mask> };
<mask>
<mask> getResponseCell = ({ value: responses, original }) => {
<mask> const {
<mask> reason, filterId, rule, status, originalAnswer,
<mask> } = original;
</s> + client: handle blocked by response in query log </s> remove reason, filterId, rule, status,
</s> add reason, filterId, rule, status, originalAnswer, </s> remove serviceName: service_name,
</s> add </s> remove {this.renderResponseList(responses, status)}
</s> add {originalAnswer
? this.renderResponseList(normalizedAnswer, status)
: this.renderResponseList(responses, status)
} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/e8885dbf3e8f4e9f5e486031813712c88625ba64 | client/src/components/Logs/index.js |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.