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 |
|---|---|---|---|---|
<mask> }
<mask>
<mask> // AddStaticLease adds a static lease (thread-safe)
<mask> func (s *Server) AddStaticLease(l Lease) error {
<mask> if s.IPpool == nil {
<mask> return fmt.Errorf("DHCP server isn't started")
<mask> }
<mask>
<mask> if len(l.IP) != 4 {
<mask> return fmt.Errorf("Invalid IP")
<mask> }
<mask> if len(l.HWAddr) != 6 {
<mask> return fmt.Errorf("Invalid MAC")
</s> * dhcp: now static leases functionality works before DHCP is started </s> remove if s.IPpool == nil {
return fmt.Errorf("DHCP server isn't started")
}
</s> add </s> remove s.dbLoad()
</s> add </s> remove if s.IPpool == nil {
s.dbLoad()
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b9c0b5535694fea37fad8fc85e3b1e897860f6ea | dhcpd/dhcpd.go | |
<mask> }
<mask>
<mask> // RemoveStaticLease removes a static lease (thread-safe)
<mask> func (s *Server) RemoveStaticLease(l Lease) error {
<mask> if s.IPpool == nil {
<mask> return fmt.Errorf("DHCP server isn't started")
<mask> }
<mask>
<mask> if len(l.IP) != 4 {
<mask> return fmt.Errorf("Invalid IP")
<mask> }
<mask> if len(l.HWAddr) != 6 {
<mask> return fmt.Errorf("Invalid MAC")
</s> * dhcp: now static leases functionality works before DHCP is started </s> remove if s.IPpool == nil {
return fmt.Errorf("DHCP server isn't started")
}
</s> add </s> remove s.dbLoad()
</s> add </s> remove if s.IPpool == nil {
s.dbLoad()
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b9c0b5535694fea37fad8fc85e3b1e897860f6ea | dhcpd/dhcpd.go | |
<mask> func (s *Server) StaticLeases() []Lease {
<mask> s.leasesLock.Lock()
<mask> defer s.leasesLock.Unlock()
<mask>
<mask> if s.IPpool == nil {
<mask> s.dbLoad()
<mask> }
<mask>
<mask> var result []Lease
<mask> for _, lease := range s.leases {
<mask> if lease.Expiry.Unix() == 1 {
<mask> result = append(result, *lease)
<mask> }
</s> * dhcp: now static leases functionality works before DHCP is started </s> remove if s.IPpool == nil {
return fmt.Errorf("DHCP server isn't started")
}
</s> add </s> remove if s.IPpool == nil {
return fmt.Errorf("DHCP server isn't started")
}
</s> add </s> remove s.dbLoad()
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b9c0b5535694fea37fad8fc85e3b1e897860f6ea | dhcpd/dhcpd.go | |
diskConf := yobj{} | <mask>
<mask> // Performs necessary upgrade operations if needed
<mask> func upgradeConfig() error {
<mask> // read a config file into an interface map, so we can manipulate values without losing any
<mask> diskConfig := yobj{}
<mask> body, err := readConfigFile()
<mask> if err != nil {
<mask> return err
<mask> }
<mask>
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove default:
err := fmt.Errorf("configuration file contains unknown schema_version, abort")
log.Println(err)
return err
</s> add </s> remove func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
switch oldVersion {
case 0:
err := upgradeSchema0to1(diskConfig)
if err != nil {
return err
}
fallthrough
case 1:
err := upgradeSchema1to2(diskConfig)
if err != nil {
return err
}
fallthrough
case 2:
err := upgradeSchema2to3(diskConfig)
if err != nil {
return err
}
fallthrough
case 3:
err := upgradeSchema3to4(diskConfig)
if err != nil {
return err
}
fallthrough
case 4:
err := upgradeSchema4to5(diskConfig)
if err != nil {
return err
}
fallthrough
case 5:
err := upgradeSchema5to6(diskConfig)
if err != nil {
return err
}
fallthrough
case 6:
err := upgradeSchema6to7(diskConfig)
if err != nil {
return err
}
case 7:
err := upgradeSchema7to8(diskConfig)
if err != nil {
return err
</s> add func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove // Let's read dns configuration from diskConfig
dnsConfig, ok := (*diskConfig)["dns"]
</s> add // Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
err = yaml.Unmarshal(body, &diskConf) | <mask> if err != nil {
<mask> return err
<mask> }
<mask>
<mask> err = yaml.Unmarshal(body, &diskConfig)
<mask> if err != nil {
<mask> log.Printf("Couldn't parse config file: %s", err)
<mask> return err
<mask> }
<mask>
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove log.Printf("Couldn't save YAML config: %s", err)
return err
</s> add return fmt.Errorf("saving new config: %w", err) </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove err = file.SafeWrite(configFile, body)
</s> add confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) </s> remove func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
switch oldVersion {
case 0:
err := upgradeSchema0to1(diskConfig)
if err != nil {
return err
}
fallthrough
case 1:
err := upgradeSchema1to2(diskConfig)
if err != nil {
return err
}
fallthrough
case 2:
err := upgradeSchema2to3(diskConfig)
if err != nil {
return err
}
fallthrough
case 3:
err := upgradeSchema3to4(diskConfig)
if err != nil {
return err
}
fallthrough
case 4:
err := upgradeSchema4to5(diskConfig)
if err != nil {
return err
}
fallthrough
case 5:
err := upgradeSchema5to6(diskConfig)
if err != nil {
return err
}
fallthrough
case 6:
err := upgradeSchema6to7(diskConfig)
if err != nil {
return err
}
case 7:
err := upgradeSchema7to8(diskConfig)
if err != nil {
return err
</s> add func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
schemaVersionInterface, ok := diskConf["schema_version"] | <mask> log.Printf("Couldn't parse config file: %s", err)
<mask> return err
<mask> }
<mask>
<mask> schemaVersionInterface, ok := diskConfig["schema_version"]
<mask> log.Tracef("got schema version %v", schemaVersionInterface)
<mask> if !ok {
<mask> // no schema version, set it to 0
<mask> schemaVersionInterface = 0
<mask> }
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove err = yaml.Unmarshal(body, &diskConfig)
</s> add err = yaml.Unmarshal(body, &diskConf) </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove err = file.SafeWrite(configFile, body)
</s> add confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) </s> remove log.Printf("Couldn't save YAML config: %s", err)
return err
</s> add return fmt.Errorf("saving new config: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
return upgradeConfigSchema(schemaVersion, diskConf) | <mask> // do nothing
<mask> return nil
<mask> }
<mask>
<mask> return upgradeConfigSchema(schemaVersion, &diskConfig)
<mask> }
<mask>
<mask> // Upgrade from oldVersion to newVersion
<mask> func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
<mask> switch oldVersion {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
switch oldVersion {
case 0:
err := upgradeSchema0to1(diskConfig)
if err != nil {
return err
}
fallthrough
case 1:
err := upgradeSchema1to2(diskConfig)
if err != nil {
return err
}
fallthrough
case 2:
err := upgradeSchema2to3(diskConfig)
if err != nil {
return err
}
fallthrough
case 3:
err := upgradeSchema3to4(diskConfig)
if err != nil {
return err
}
fallthrough
case 4:
err := upgradeSchema4to5(diskConfig)
if err != nil {
return err
}
fallthrough
case 5:
err := upgradeSchema5to6(diskConfig)
if err != nil {
return err
}
fallthrough
case 6:
err := upgradeSchema6to7(diskConfig)
if err != nil {
return err
}
case 7:
err := upgradeSchema7to8(diskConfig)
if err != nil {
return err
</s> add func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ </s> remove // Let's read dns configuration from diskConfig
dnsConfig, ok := (*diskConfig)["dns"]
</s> add // Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] </s> remove func upgradeSchema2to3(diskConfig *yobj) error {
</s> add func upgradeSchema2to3(diskConf yobj) error { </s> remove err = yaml.Unmarshal(body, &diskConfig)
</s> add err = yaml.Unmarshal(body, &diskConf) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
// upgradeFunc is a function that upgrades a config and returns an error.
type upgradeFunc = func(diskConf yobj) (err error)
| <mask>
<mask> return upgradeConfigSchema(schemaVersion, diskConf)
<mask> }
<mask>
<mask> // Upgrade from oldVersion to newVersion
<mask> func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
<mask> upgrades := []upgradeFunc{
<mask> upgradeSchema0to1,
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove return upgradeConfigSchema(schemaVersion, &diskConfig)
</s> add return upgradeConfigSchema(schemaVersion, diskConf) </s> remove func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
switch oldVersion {
case 0:
err := upgradeSchema0to1(diskConfig)
if err != nil {
return err
}
fallthrough
case 1:
err := upgradeSchema1to2(diskConfig)
if err != nil {
return err
}
fallthrough
case 2:
err := upgradeSchema2to3(diskConfig)
if err != nil {
return err
}
fallthrough
case 3:
err := upgradeSchema3to4(diskConfig)
if err != nil {
return err
}
fallthrough
case 4:
err := upgradeSchema4to5(diskConfig)
if err != nil {
return err
}
fallthrough
case 5:
err := upgradeSchema5to6(diskConfig)
if err != nil {
return err
}
fallthrough
case 6:
err := upgradeSchema6to7(diskConfig)
if err != nil {
return err
}
case 7:
err := upgradeSchema7to8(diskConfig)
if err != nil {
return err
</s> add func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ </s> remove func upgradeSchema7to8(diskConfig *yobj) (err error) {
</s> add func upgradeSchema7to8(diskConf yobj) (err error) { </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove // Let's read dns configuration from diskConfig
dnsConfig, ok := (*diskConfig)["dns"]
</s> add // Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ | <mask> return upgradeConfigSchema(schemaVersion, &diskConfig)
<mask> }
<mask>
<mask> // Upgrade from oldVersion to newVersion
<mask> func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
<mask> switch oldVersion {
<mask> case 0:
<mask> err := upgradeSchema0to1(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> fallthrough
<mask> case 1:
<mask> err := upgradeSchema1to2(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> fallthrough
<mask> case 2:
<mask> err := upgradeSchema2to3(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> fallthrough
<mask> case 3:
<mask> err := upgradeSchema3to4(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> fallthrough
<mask> case 4:
<mask> err := upgradeSchema4to5(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> fallthrough
<mask> case 5:
<mask> err := upgradeSchema5to6(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> fallthrough
<mask> case 6:
<mask> err := upgradeSchema6to7(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> case 7:
<mask> err := upgradeSchema7to8(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> default:
<mask> err := fmt.Errorf("configuration file contains unknown schema_version, abort")
<mask> log.Println(err)
<mask> return err
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove default:
err := fmt.Errorf("configuration file contains unknown schema_version, abort")
log.Println(err)
return err
</s> add </s> remove err = yaml.Unmarshal(body, &diskConfig)
</s> add err = yaml.Unmarshal(body, &diskConf) </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove err = file.SafeWrite(configFile, body)
</s> add confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
<mask> err := upgradeSchema7to8(diskConfig)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> default:
<mask> err := fmt.Errorf("configuration file contains unknown schema_version, abort")
<mask> log.Println(err)
<mask> return err
<mask> }
<mask>
<mask> configFile := config.getConfigFilename()
<mask> body, err := yaml.Marshal(diskConfig)
<mask> if err != nil {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
switch oldVersion {
case 0:
err := upgradeSchema0to1(diskConfig)
if err != nil {
return err
}
fallthrough
case 1:
err := upgradeSchema1to2(diskConfig)
if err != nil {
return err
}
fallthrough
case 2:
err := upgradeSchema2to3(diskConfig)
if err != nil {
return err
}
fallthrough
case 3:
err := upgradeSchema3to4(diskConfig)
if err != nil {
return err
}
fallthrough
case 4:
err := upgradeSchema4to5(diskConfig)
if err != nil {
return err
}
fallthrough
case 5:
err := upgradeSchema5to6(diskConfig)
if err != nil {
return err
}
fallthrough
case 6:
err := upgradeSchema6to7(diskConfig)
if err != nil {
return err
}
case 7:
err := upgradeSchema7to8(diskConfig)
if err != nil {
return err
</s> add func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove err = file.SafeWrite(configFile, body)
</s> add confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) </s> remove diskConfig := yobj{}
</s> add diskConf := yobj{} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go | |
if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) | <mask> log.Println(err)
<mask> return err
<mask> }
<mask>
<mask> configFile := config.getConfigFilename()
<mask> body, err := yaml.Marshal(diskConfig)
<mask> if err != nil {
<mask> log.Printf("Couldn't generate YAML file: %s", err)
<mask> return err
<mask> }
<mask>
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove default:
err := fmt.Errorf("configuration file contains unknown schema_version, abort")
log.Println(err)
return err
</s> add </s> remove err = file.SafeWrite(configFile, body)
</s> add confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) </s> remove err = yaml.Unmarshal(body, &diskConfig)
</s> add err = yaml.Unmarshal(body, &diskConf) </s> remove log.Printf("Couldn't save YAML config: %s", err)
return err
</s> add return fmt.Errorf("saving new config: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
return fmt.Errorf("generating new config: %w", err) | <mask>
<mask> configFile := config.getConfigFilename()
<mask> body, err := yaml.Marshal(diskConfig)
<mask> if err != nil {
<mask> log.Printf("Couldn't generate YAML file: %s", err)
<mask> return err
<mask> }
<mask>
<mask> config.fileData = body
<mask> err = file.SafeWrite(configFile, body)
<mask> if err != nil {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove err = file.SafeWrite(configFile, body)
</s> add confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove log.Printf("Couldn't save YAML config: %s", err)
return err
</s> add return fmt.Errorf("saving new config: %w", err) </s> remove default:
err := fmt.Errorf("configuration file contains unknown schema_version, abort")
log.Println(err)
return err
</s> add </s> remove err = yaml.Unmarshal(body, &diskConfig)
</s> add err = yaml.Unmarshal(body, &diskConf) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) | <mask> return err
<mask> }
<mask>
<mask> config.fileData = body
<mask> err = file.SafeWrite(configFile, body)
<mask> if err != nil {
<mask> log.Printf("Couldn't save YAML config: %s", err)
<mask> return err
<mask> }
<mask>
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove log.Printf("Couldn't save YAML config: %s", err)
return err
</s> add return fmt.Errorf("saving new config: %w", err) </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove err = yaml.Unmarshal(body, &diskConfig)
</s> add err = yaml.Unmarshal(body, &diskConf) </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
switch oldVersion {
case 0:
err := upgradeSchema0to1(diskConfig)
if err != nil {
return err
}
fallthrough
case 1:
err := upgradeSchema1to2(diskConfig)
if err != nil {
return err
}
fallthrough
case 2:
err := upgradeSchema2to3(diskConfig)
if err != nil {
return err
}
fallthrough
case 3:
err := upgradeSchema3to4(diskConfig)
if err != nil {
return err
}
fallthrough
case 4:
err := upgradeSchema4to5(diskConfig)
if err != nil {
return err
}
fallthrough
case 5:
err := upgradeSchema5to6(diskConfig)
if err != nil {
return err
}
fallthrough
case 6:
err := upgradeSchema6to7(diskConfig)
if err != nil {
return err
}
case 7:
err := upgradeSchema7to8(diskConfig)
if err != nil {
return err
</s> add func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
return fmt.Errorf("saving new config: %w", err) | <mask>
<mask> config.fileData = body
<mask> err = file.SafeWrite(configFile, body)
<mask> if err != nil {
<mask> log.Printf("Couldn't save YAML config: %s", err)
<mask> return err
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove err = file.SafeWrite(configFile, body)
</s> add confFile := config.getConfigFilename()
err = file.SafeWrite(confFile, body) </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove err = yaml.Unmarshal(body, &diskConfig)
</s> add err = yaml.Unmarshal(body, &diskConf) </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) </s> remove func upgradeConfigSchema(oldVersion int, diskConfig *yobj) error {
switch oldVersion {
case 0:
err := upgradeSchema0to1(diskConfig)
if err != nil {
return err
}
fallthrough
case 1:
err := upgradeSchema1to2(diskConfig)
if err != nil {
return err
}
fallthrough
case 2:
err := upgradeSchema2to3(diskConfig)
if err != nil {
return err
}
fallthrough
case 3:
err := upgradeSchema3to4(diskConfig)
if err != nil {
return err
}
fallthrough
case 4:
err := upgradeSchema4to5(diskConfig)
if err != nil {
return err
}
fallthrough
case 5:
err := upgradeSchema5to6(diskConfig)
if err != nil {
return err
}
fallthrough
case 6:
err := upgradeSchema6to7(diskConfig)
if err != nil {
return err
}
case 7:
err := upgradeSchema7to8(diskConfig)
if err != nil {
return err
</s> add func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgrades := []upgradeFunc{
upgradeSchema0to1,
upgradeSchema1to2,
upgradeSchema2to3,
upgradeSchema3to4,
upgradeSchema4to5,
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
}
n := 0
for i, u := range upgrades {
if i >= oldVersion {
err = u(diskConf)
if err != nil {
return err
}
n++ | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema0to1(diskConf yobj) error { | <mask> }
<mask>
<mask> // The first schema upgrade:
<mask> // No more "dnsfilter.txt", filters are now kept in data/filters/
<mask> func upgradeSchema0to1(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> dnsFilterPath := filepath.Join(Context.workDir, "dnsfilter.txt")
<mask> if _, err := os.Stat(dnsFilterPath); !os.IsNotExist(err) {
<mask> log.Printf("Deleting %s as we don't need it anymore", dnsFilterPath)
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema1to2(diskConfig *yobj) error {
</s> add func upgradeSchema1to2(diskConf yobj) error { </s> remove func upgradeSchema2to3(diskConfig *yobj) error {
</s> add func upgradeSchema2to3(diskConf yobj) error { </s> remove (*diskConfig)["schema_version"] = 2
</s> add diskConf["schema_version"] = 2 </s> remove // Let's read dns configuration from diskConfig
dnsConfig, ok := (*diskConfig)["dns"]
</s> add // Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] </s> remove schemaVersionInterface, ok := diskConfig["schema_version"]
</s> add schemaVersionInterface, ok := diskConf["schema_version"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 1 | <mask> // not fatal, move on
<mask> }
<mask> }
<mask>
<mask> (*diskConfig)["schema_version"] = 1
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // Second schema upgrade:
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove if _, ok := (*diskConfig)["dns"]; !ok {
(*diskConfig)["dns"] = (*diskConfig)["coredns"]
delete((*diskConfig), "coredns")
</s> add if _, ok := diskConf["dns"]; !ok {
diskConf["dns"] = diskConf["coredns"]
delete(diskConf, "coredns") </s> remove (*diskConfig)["schema_version"] = 2
</s> add diskConf["schema_version"] = 2 </s> remove (*diskConfig)["schema_version"] = 3
</s> add diskConf["schema_version"] = 3 </s> remove (*diskConfig)["dns"] = newDNSConfig
</s> add diskConf["dns"] = newDNSConfig </s> remove (*diskConfig)["users"] = users
</s> add diskConf["users"] = users | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema1to2(diskConf yobj) error { | <mask>
<mask> // Second schema upgrade:
<mask> // coredns is now dns in config
<mask> // delete 'Corefile', since we don't use that anymore
<mask> func upgradeSchema1to2(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> coreFilePath := filepath.Join(Context.workDir, "Corefile")
<mask> if _, err := os.Stat(coreFilePath); !os.IsNotExist(err) {
<mask> log.Printf("Deleting %s as we don't need it anymore", coreFilePath)
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema0to1(diskConfig *yobj) error {
</s> add func upgradeSchema0to1(diskConf yobj) error { </s> remove func upgradeSchema2to3(diskConfig *yobj) error {
</s> add func upgradeSchema2to3(diskConf yobj) error { </s> remove // Let's read dns configuration from diskConfig
dnsConfig, ok := (*diskConfig)["dns"]
</s> add // Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] </s> remove diskConfig := yobj{}
</s> add diskConf := yobj{} </s> remove schemaVersionInterface, ok := diskConfig["schema_version"]
</s> add schemaVersionInterface, ok := diskConf["schema_version"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
if _, ok := diskConf["dns"]; !ok {
diskConf["dns"] = diskConf["coredns"]
delete(diskConf, "coredns") | <mask> // not fatal, move on
<mask> }
<mask> }
<mask>
<mask> if _, ok := (*diskConfig)["dns"]; !ok {
<mask> (*diskConfig)["dns"] = (*diskConfig)["coredns"]
<mask> delete((*diskConfig), "coredns")
<mask> }
<mask> (*diskConfig)["schema_version"] = 2
<mask>
<mask> return nil
<mask> }
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 2
</s> add diskConf["schema_version"] = 2 </s> remove (*diskConfig)["schema_version"] = 1
</s> add diskConf["schema_version"] = 1 </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove dnsVal, ok := (*diskConfig)["dns"]
</s> add dnsVal, ok := diskConf["dns"] </s> remove (*diskConfig)["schema_version"] = 5
</s> add diskConf["schema_version"] = 5 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 2 | <mask> if _, ok := (*diskConfig)["dns"]; !ok {
<mask> (*diskConfig)["dns"] = (*diskConfig)["coredns"]
<mask> delete((*diskConfig), "coredns")
<mask> }
<mask> (*diskConfig)["schema_version"] = 2
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // Third schema upgrade:
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove if _, ok := (*diskConfig)["dns"]; !ok {
(*diskConfig)["dns"] = (*diskConfig)["coredns"]
delete((*diskConfig), "coredns")
</s> add if _, ok := diskConf["dns"]; !ok {
diskConf["dns"] = diskConf["coredns"]
delete(diskConf, "coredns") </s> remove func upgradeSchema2to3(diskConfig *yobj) error {
</s> add func upgradeSchema2to3(diskConf yobj) error { </s> remove (*diskConfig)["schema_version"] = 1
</s> add diskConf["schema_version"] = 1 </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove (*diskConfig)["dns"] = newDNSConfig
</s> add diskConf["dns"] = newDNSConfig | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema2to3(diskConf yobj) error { | <mask> }
<mask>
<mask> // Third schema upgrade:
<mask> // Bootstrap DNS becomes an array
<mask> func upgradeSchema2to3(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> // Let's read dns configuration from diskConfig
<mask> dnsConfig, ok := (*diskConfig)["dns"]
<mask> if !ok {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove // Let's read dns configuration from diskConfig
dnsConfig, ok := (*diskConfig)["dns"]
</s> add // Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] </s> remove (*diskConfig)["schema_version"] = 2
</s> add diskConf["schema_version"] = 2 </s> remove func upgradeSchema1to2(diskConfig *yobj) error {
</s> add func upgradeSchema1to2(diskConf yobj) error { </s> remove diskConfig := yobj{}
</s> add diskConf := yobj{} </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
// Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] | <mask> // Bootstrap DNS becomes an array
<mask> func upgradeSchema2to3(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> // Let's read dns configuration from diskConfig
<mask> dnsConfig, ok := (*diskConfig)["dns"]
<mask> if !ok {
<mask> return fmt.Errorf("no DNS configuration in config file")
<mask> }
<mask>
<mask> // Convert interface{} to yobj
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema2to3(diskConfig *yobj) error {
</s> add func upgradeSchema2to3(diskConf yobj) error { </s> remove diskConfig := yobj{}
</s> add diskConf := yobj{} </s> remove func upgradeSchema1to2(diskConfig *yobj) error {
</s> add func upgradeSchema1to2(diskConf yobj) error { </s> remove return upgradeConfigSchema(schemaVersion, &diskConfig)
</s> add return upgradeConfigSchema(schemaVersion, diskConf) </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["dns"] = newDNSConfig | <mask> }
<mask>
<mask> newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)}
<mask> newDNSConfig["bootstrap_dns"] = newBootstrapConfig
<mask> (*diskConfig)["dns"] = newDNSConfig
<mask>
<mask> // Bump schema version
<mask> (*diskConfig)["schema_version"] = 3
<mask>
<mask> return nil
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 3
</s> add diskConf["schema_version"] = 3 </s> remove (*diskConfig)["schema_version"] = 2
</s> add diskConf["schema_version"] = 2 </s> remove schemaVersionInterface, ok := diskConfig["schema_version"]
</s> add schemaVersionInterface, ok := diskConf["schema_version"] </s> remove (*diskConfig)["schema_version"] = 1
</s> add diskConf["schema_version"] = 1 </s> remove if _, ok := (*diskConfig)["dns"]; !ok {
(*diskConfig)["dns"] = (*diskConfig)["coredns"]
delete((*diskConfig), "coredns")
</s> add if _, ok := diskConf["dns"]; !ok {
diskConf["dns"] = diskConf["coredns"]
delete(diskConf, "coredns") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 3 | <mask> newDNSConfig["bootstrap_dns"] = newBootstrapConfig
<mask> (*diskConfig)["dns"] = newDNSConfig
<mask>
<mask> // Bump schema version
<mask> (*diskConfig)["schema_version"] = 3
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // Add use_global_blocked_services=true setting for existing "clients" array
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["dns"] = newDNSConfig
</s> add diskConf["dns"] = newDNSConfig </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 </s> remove func upgradeSchema3to4(diskConfig *yobj) error {
</s> add func upgradeSchema3to4(diskConf yobj) error { </s> remove (*diskConfig)["schema_version"] = 2
</s> add diskConf["schema_version"] = 2 </s> remove (*diskConfig)["schema_version"] = 1
</s> add diskConf["schema_version"] = 1 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema3to4(diskConf yobj) error { | <mask> return nil
<mask> }
<mask>
<mask> // Add use_global_blocked_services=true setting for existing "clients" array
<mask> func upgradeSchema3to4(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 4
<mask>
<mask> clients, ok := (*diskConfig)["clients"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 </s> remove (*diskConfig)["schema_version"] = 3
</s> add diskConf["schema_version"] = 3 </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 4 | <mask> // Add use_global_blocked_services=true setting for existing "clients" array
<mask> func upgradeSchema3to4(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 4
<mask>
<mask> clients, ok := (*diskConfig)["clients"]
<mask> if !ok {
<mask> return nil
<mask> }
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema3to4(diskConfig *yobj) error {
</s> add func upgradeSchema3to4(diskConf yobj) error { </s> remove (*diskConfig)["schema_version"] = 3
</s> add diskConf["schema_version"] = 3 </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
clients, ok := diskConf["clients"] | <mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 4
<mask>
<mask> clients, ok := (*diskConfig)["clients"]
<mask> if !ok {
<mask> return nil
<mask> }
<mask>
<mask> switch arr := clients.(type) {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 </s> remove func upgradeSchema3to4(diskConfig *yobj) error {
</s> add func upgradeSchema3to4(diskConf yobj) error { </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove name, ok := (*diskConfig)["auth_name"]
</s> add name, ok := diskConf["auth_name"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema4to5(diskConf yobj) error { | <mask> // users:
<mask> // - name: "..."
<mask> // password: "..."
<mask> // ...
<mask> func upgradeSchema4to5(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 5
<mask>
<mask> name, ok := (*diskConfig)["auth_name"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 5
</s> add diskConf["schema_version"] = 5 </s> remove func upgradeSchema5to6(diskConfig *yobj) error {
</s> add func upgradeSchema5to6(diskConf yobj) error { </s> remove name, ok := (*diskConfig)["auth_name"]
</s> add name, ok := diskConf["auth_name"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove func upgradeSchema6to7(diskConfig *yobj) error {
</s> add func upgradeSchema6to7(diskConf yobj) error { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 5 | <mask> // ...
<mask> func upgradeSchema4to5(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 5
<mask>
<mask> name, ok := (*diskConfig)["auth_name"]
<mask> if !ok {
<mask> return nil
<mask> }
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema4to5(diskConfig *yobj) error {
</s> add func upgradeSchema4to5(diskConf yobj) error { </s> remove name, ok := (*diskConfig)["auth_name"]
</s> add name, ok := diskConf["auth_name"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 </s> remove (*diskConfig)["schema_version"] = 7
</s> add diskConf["schema_version"] = 7 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
name, ok := diskConf["auth_name"] | <mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 5
<mask>
<mask> name, ok := (*diskConfig)["auth_name"]
<mask> if !ok {
<mask> return nil
<mask> }
<mask> nameStr, ok := name.(string)
<mask> if !ok {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 5
</s> add diskConf["schema_version"] = 5 </s> remove func upgradeSchema4to5(diskConfig *yobj) error {
</s> add func upgradeSchema4to5(diskConf yobj) error { </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
pass, ok := diskConf["auth_pass"] | <mask> log.Fatal("Please use double quotes in your user name in \"auth_name\" and restart AdGuardHome")
<mask> return nil
<mask> }
<mask>
<mask> pass, ok := (*diskConfig)["auth_pass"]
<mask> if !ok {
<mask> return nil
<mask> }
<mask> passStr, ok := pass.(string)
<mask> if !ok {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove name, ok := (*diskConfig)["auth_name"]
</s> add name, ok := diskConf["auth_name"] </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove if _, ok := (*diskConfig)["dns"]; !ok {
(*diskConfig)["dns"] = (*diskConfig)["coredns"]
delete((*diskConfig), "coredns")
</s> add if _, ok := diskConf["dns"]; !ok {
diskConf["dns"] = diskConf["coredns"]
delete(diskConf, "coredns") </s> remove dhcpVal, ok := (*diskConfig)["dhcp"]
</s> add dhcpVal, ok := diskConf["dhcp"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["users"] = users | <mask> Name: nameStr,
<mask> PasswordHash: string(hash),
<mask> }
<mask> users := []User{u}
<mask> (*diskConfig)["users"] = users
<mask> return nil
<mask> }
<mask>
<mask> // clients:
<mask> // ...
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 5
</s> add diskConf["schema_version"] = 5 </s> remove name, ok := (*diskConfig)["auth_name"]
</s> add name, ok := diskConf["auth_name"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove (*diskConfig)["schema_version"] = 7
</s> add diskConf["schema_version"] = 7 </s> remove (*diskConfig)["schema_version"] = 1
</s> add diskConf["schema_version"] = 1 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema5to6(diskConf yobj) error { | <mask> // ...
<mask> // ids:
<mask> // - 127.0.0.1
<mask> // - ...
<mask> func upgradeSchema5to6(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 6
<mask>
<mask> clients, ok := (*diskConfig)["clients"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove func upgradeSchema4to5(diskConfig *yobj) error {
</s> add func upgradeSchema4to5(diskConf yobj) error { </s> remove func upgradeSchema6to7(diskConfig *yobj) error {
</s> add func upgradeSchema6to7(diskConf yobj) error { </s> remove (*diskConfig)["schema_version"] = 5
</s> add diskConf["schema_version"] = 5 </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 6 | <mask> // - ...
<mask> func upgradeSchema5to6(diskConfig *yobj) error {
<mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 6
<mask>
<mask> clients, ok := (*diskConfig)["clients"]
<mask> if !ok {
<mask> return nil
<mask> }
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema5to6(diskConfig *yobj) error {
</s> add func upgradeSchema5to6(diskConf yobj) error { </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 </s> remove (*diskConfig)["schema_version"] = 5
</s> add diskConf["schema_version"] = 5 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
clients, ok := diskConf["clients"] | <mask> log.Printf("%s(): called", funcName())
<mask>
<mask> (*diskConfig)["schema_version"] = 6
<mask>
<mask> clients, ok := (*diskConfig)["clients"]
<mask> if !ok {
<mask> return nil
<mask> }
<mask>
<mask> switch arr := clients.(type) {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 </s> remove (*diskConfig)["schema_version"] = 4
</s> add diskConf["schema_version"] = 4 </s> remove dhcpVal, ok := (*diskConfig)["dhcp"]
</s> add dhcpVal, ok := diskConf["dhcp"] </s> remove func upgradeSchema3to4(diskConfig *yobj) error {
</s> add func upgradeSchema3to4(diskConf yobj) error { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema6to7(diskConf yobj) error { | <mask> // interface_name: vboxnet0
<mask> // dhcpv4:
<mask> // gateway_ip: 192.168.56.1
<mask> // ...
<mask> func upgradeSchema6to7(diskConfig *yobj) error {
<mask> log.Printf("Upgrade yaml: 6 to 7")
<mask>
<mask> (*diskConfig)["schema_version"] = 7
<mask>
<mask> dhcpVal, ok := (*diskConfig)["dhcp"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 7
</s> add diskConf["schema_version"] = 7 </s> remove dhcpVal, ok := (*diskConfig)["dhcp"]
</s> add dhcpVal, ok := diskConf["dhcp"] </s> remove func upgradeSchema7to8(diskConfig *yobj) (err error) {
</s> add func upgradeSchema7to8(diskConf yobj) (err error) { </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove func upgradeSchema5to6(diskConfig *yobj) error {
</s> add func upgradeSchema5to6(diskConf yobj) error { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 7 | <mask> // ...
<mask> func upgradeSchema6to7(diskConfig *yobj) error {
<mask> log.Printf("Upgrade yaml: 6 to 7")
<mask>
<mask> (*diskConfig)["schema_version"] = 7
<mask>
<mask> dhcpVal, ok := (*diskConfig)["dhcp"]
<mask> if !ok {
<mask> return nil
<mask> }
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema6to7(diskConfig *yobj) error {
</s> add func upgradeSchema6to7(diskConf yobj) error { </s> remove dhcpVal, ok := (*diskConfig)["dhcp"]
</s> add dhcpVal, ok := diskConf["dhcp"] </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove dnsVal, ok := (*diskConfig)["dns"]
</s> add dnsVal, ok := diskConf["dns"] </s> remove (*diskConfig)["schema_version"] = 6
</s> add diskConf["schema_version"] = 6 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
dhcpVal, ok := diskConf["dhcp"] | <mask> log.Printf("Upgrade yaml: 6 to 7")
<mask>
<mask> (*diskConfig)["schema_version"] = 7
<mask>
<mask> dhcpVal, ok := (*diskConfig)["dhcp"]
<mask> if !ok {
<mask> return nil
<mask> }
<mask>
<mask> switch dhcp := dhcpVal.(type) {
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 7
</s> add diskConf["schema_version"] = 7 </s> remove func upgradeSchema6to7(diskConfig *yobj) error {
</s> add func upgradeSchema6to7(diskConf yobj) error { </s> remove dnsVal, ok := (*diskConfig)["dns"]
</s> add dnsVal, ok := diskConf["dns"] </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove clients, ok := (*diskConfig)["clients"]
</s> add clients, ok := diskConf["clients"] | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
func upgradeSchema7to8(diskConf yobj) (err error) { | <mask> // 'dns':
<mask> // 'bind_hosts':
<mask> // - '127.0.0.1'
<mask> //
<mask> func upgradeSchema7to8(diskConfig *yobj) (err error) {
<mask> log.Printf("Upgrade yaml: 7 to 8")
<mask>
<mask> (*diskConfig)["schema_version"] = 8
<mask>
<mask> dnsVal, ok := (*diskConfig)["dns"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove dnsVal, ok := (*diskConfig)["dns"]
</s> add dnsVal, ok := diskConf["dns"] </s> remove func upgradeSchema6to7(diskConfig *yobj) error {
</s> add func upgradeSchema6to7(diskConf yobj) error { </s> remove (*diskConfig)["schema_version"] = 7
</s> add diskConf["schema_version"] = 7 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
diskConf["schema_version"] = 8 | <mask> //
<mask> func upgradeSchema7to8(diskConfig *yobj) (err error) {
<mask> log.Printf("Upgrade yaml: 7 to 8")
<mask>
<mask> (*diskConfig)["schema_version"] = 8
<mask>
<mask> dnsVal, ok := (*diskConfig)["dns"]
<mask> if !ok {
<mask> return nil
<mask> }
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove func upgradeSchema7to8(diskConfig *yobj) (err error) {
</s> add func upgradeSchema7to8(diskConf yobj) (err error) { </s> remove dnsVal, ok := (*diskConfig)["dns"]
</s> add dnsVal, ok := diskConf["dns"] </s> remove (*diskConfig)["schema_version"] = 7
</s> add diskConf["schema_version"] = 7 </s> remove dhcpVal, ok := (*diskConfig)["dhcp"]
</s> add dhcpVal, ok := diskConf["dhcp"] </s> remove func upgradeSchema6to7(diskConfig *yobj) error {
</s> add func upgradeSchema6to7(diskConf yobj) error { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
dnsVal, ok := diskConf["dns"] | <mask> log.Printf("Upgrade yaml: 7 to 8")
<mask>
<mask> (*diskConfig)["schema_version"] = 8
<mask>
<mask> dnsVal, ok := (*diskConfig)["dns"]
<mask> if !ok {
<mask> return nil
<mask> }
<mask>
<mask> dns, ok := dnsVal.(yobj)
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove (*diskConfig)["schema_version"] = 8
</s> add diskConf["schema_version"] = 8 </s> remove func upgradeSchema7to8(diskConfig *yobj) (err error) {
</s> add func upgradeSchema7to8(diskConf yobj) (err error) { </s> remove dhcpVal, ok := (*diskConfig)["dhcp"]
</s> add dhcpVal, ok := diskConf["dhcp"] </s> remove (*diskConfig)["schema_version"] = 7
</s> add diskConf["schema_version"] = 7 </s> remove if _, ok := (*diskConfig)["dns"]; !ok {
(*diskConfig)["dns"] = (*diskConfig)["coredns"]
delete((*diskConfig), "coredns")
</s> add if _, ok := diskConf["dns"]; !ok {
diskConf["dns"] = diskConf["coredns"]
delete(diskConf, "coredns") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade.go |
err := upgradeSchema1to2(diskConf) | <mask>
<mask> func TestUpgradeSchema1to2(t *testing.T) {
<mask> diskConf := testDiskConf(1)
<mask>
<mask> err := upgradeSchema1to2(&diskConf)
<mask> require.Nil(t, err)
<mask>
<mask> require.Equal(t, diskConf["schema_version"], 2)
<mask>
<mask> _, ok := diskConf["coredns"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove err := upgradeSchema2to3(&diskConf)
</s> add err := upgradeSchema2to3(diskConf) </s> remove err := upgradeSchema7to8(&oldConf)
</s> add err := upgradeSchema7to8(oldConf) </s> remove if _, ok := (*diskConfig)["dns"]; !ok {
(*diskConfig)["dns"] = (*diskConfig)["coredns"]
delete((*diskConfig), "coredns")
</s> add if _, ok := diskConf["dns"]; !ok {
diskConf["dns"] = diskConf["coredns"]
delete(diskConf, "coredns") </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) </s> remove diskConfig := yobj{}
</s> add diskConf := yobj{} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade_test.go |
err := upgradeSchema2to3(diskConf) | <mask>
<mask> func TestUpgradeSchema2to3(t *testing.T) {
<mask> diskConf := testDiskConf(2)
<mask>
<mask> err := upgradeSchema2to3(&diskConf)
<mask> require.Nil(t, err)
<mask>
<mask> require.Equal(t, diskConf["schema_version"], 3)
<mask>
<mask> dnsMap, ok := diskConf["dns"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove err := upgradeSchema1to2(&diskConf)
</s> add err := upgradeSchema1to2(diskConf) </s> remove err := upgradeSchema7to8(&oldConf)
</s> add err := upgradeSchema7to8(oldConf) </s> remove dnsVal, ok := (*diskConfig)["dns"]
</s> add dnsVal, ok := diskConf["dns"] </s> remove // Let's read dns configuration from diskConfig
dnsConfig, ok := (*diskConfig)["dns"]
</s> add // Let's read dns configuration from diskConf
dnsConfig, ok := diskConf["dns"] </s> remove log.Printf("Couldn't generate YAML file: %s", err)
return err
</s> add return fmt.Errorf("generating new config: %w", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade_test.go |
err := upgradeSchema7to8(oldConf) | <mask> },
<mask> "schema_version": 7,
<mask> }
<mask>
<mask> err := upgradeSchema7to8(&oldConf)
<mask> require.Nil(t, err)
<mask>
<mask> require.Equal(t, oldConf["schema_version"], 8)
<mask>
<mask> dnsVal, ok := oldConf["dns"]
</s> Pull request: home: fix migration, imp code
Updates #1401.
Updates #2646.
Squashed commit of the following:
commit 93b025a2184a72283e22748fecfc478fa549c922
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Mar 24 16:41:07 2021 +0300
home: fix migration, imp code </s> remove err := upgradeSchema1to2(&diskConf)
</s> add err := upgradeSchema1to2(diskConf) </s> remove err := upgradeSchema2to3(&diskConf)
</s> add err := upgradeSchema2to3(diskConf) </s> remove dnsVal, ok := (*diskConfig)["dns"]
</s> add dnsVal, ok := diskConf["dns"] </s> remove schemaVersionInterface, ok := diskConfig["schema_version"]
</s> add schemaVersionInterface, ok := diskConf["schema_version"] </s> remove configFile := config.getConfigFilename()
body, err := yaml.Marshal(diskConfig)
</s> add if n == 0 {
return fmt.Errorf("unknown configuration schema version %d", oldVersion)
}
body, err := yaml.Marshal(diskConf) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba3fc242ab8a0e52eeec6498c218ab84208531a6 | internal/home/upgrade_test.go |
"location": "Location",
"orgname": "Organisation name",
"netname": "Network name",
"descr": "Description", | <mask> "sign_in": "Sign in",
<mask> "sign_out": "Sign out",
<mask> "forgot_password": "Forgot password?",
<mask> "forgot_password_desc": "Please follow <0>these steps</0> to create a new password for your user account.",
<mask> "city": "<0>City:</0> {{value}}",
<mask> "country": "<0>Country:</0> {{value}}",
<mask> "orgname": "<0>OrgName:</0> {{value}}",
<mask> "whois": "Whois"
<mask> }
</s> + client: add icons to the whois info </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; </s> remove const { dashboard } = this.props;
</s> add const { dashboard, t } = this.props; </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove <span className="logs__text" title={value}>
{value}
</s> add <span className="logs__text">
<Fragment>
{nameContainer}
{whoisContainer}
</Fragment> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/__locales/en.json |
const clientCell = (clients, autoClients, t) => | <mask>
<mask> return <Cell value={value} percent={percent} color={percentColor} />;
<mask> };
<mask>
<mask> const clientCell = (clients, autoClients) =>
<mask> function cell(row) {
<mask> const { value } = row;
<mask>
<mask> return (
<mask> <div className="logs__row logs__row--overflow logs__row--column">
</s> + client: add icons to the whois info </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Dashboard/Clients.js |
{formatClientCell(value, clients, autoClients, t)} | <mask> const { value } = row;
<mask>
<mask> return (
<mask> <div className="logs__row logs__row--overflow logs__row--column">
<mask> {formatClientCell(value, clients, autoClients)}
<mask> </div>
<mask> );
<mask> };
<mask>
<mask> const Clients = ({
</s> + client: add icons to the whois info </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} </s> remove const clientCell = (clients, autoClients) =>
</s> add const clientCell = (clients, autoClients, t) => </s> remove const { dashboard } = this.props;
</s> add const { dashboard, t } = this.props; </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Dashboard/Clients.js |
Cell: clientCell(clients, autoClients, t), | <mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> sortMethod: (a, b) =>
<mask> parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
<mask> Cell: clientCell(clients, autoClients),
<mask> },
<mask> {
<mask> Header: <Trans>requests_count</Trans>,
<mask> accessor: 'count',
<mask> Cell: countCell(dnsQueries),
</s> + client: add icons to the whois info </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Dashboard/Clients.js |
minWidth: 180,
maxWidth: 200, | <mask> {
<mask> Header: <Trans>requests_count</Trans>,
<mask> accessor: 'count',
<mask> Cell: countCell(dnsQueries),
<mask> },
<mask> ]}
<mask> showPagination={false}
</s> + client: add icons to the whois info </s> remove Cell: clientCell(clients, autoClients),
</s> add Cell: clientCell(clients, autoClients, t), </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WhoisCell,
</s> add Cell: whoisCell(this.props.t), | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Dashboard/Clients.js |
const { dashboard, t } = this.props; | <mask> );
<mask> };
<mask>
<mask> getClientCell = ({ original, value }) => {
<mask> const { dashboard } = this.props;
<mask> const { clients, autoClients } = dashboard;
<mask> const { reason, domain } = original;
<mask> const isFiltered = this.checkFiltered(reason);
<mask> const isRewrite = this.checkRewrite(reason);
<mask>
</s> + client: add icons to the whois info </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove const clientCell = (clients, autoClients) =>
</s> add const clientCell = (clients, autoClients, t) => </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Logs/index.js |
{formatClientCell(value, clients, autoClients, t)} | <mask>
<mask> return (
<mask> <Fragment>
<mask> <div className="logs__row logs__row--overflow logs__row--column">
<mask> {formatClientCell(value, clients, autoClients)}
<mask> </div>
<mask> {isRewrite ? (
<mask> <div className="logs__action">
<mask> <Link to="/dns#rewrites" className="btn btn-sm btn-outline-primary">
<mask> <Trans>configure</Trans>
</s> + client: add icons to the whois info </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} </s> remove const clientCell = (clients, autoClients) =>
</s> add const clientCell = (clients, autoClients, t) => </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove <span className="logs__text" title={value}>
{value}
</s> add <span className="logs__text">
<Fragment>
{nameContainer}
{whoisContainer}
</Fragment> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Logs/index.js |
import whoisCell from './whoisCell';
import wrapCell from './wrapCell'; | <mask> import { withNamespaces } from 'react-i18next';
<mask> import ReactTable from 'react-table';
<mask>
<mask> import Card from '../../ui/Card';
<mask> import WhoisCell from './WhoisCell';
<mask> import WrapCell from './WrapCell';
<mask>
<mask> class AutoClients extends Component {
<mask> getStats = (ip, stats) => {
<mask> if (stats) {
<mask> const statsForCurrentIP = stats.find(item => item.name === ip);
</s> + client: add icons to the whois info </s> remove import WrapCell from './WrapCell';
import WhoisCell from './WhoisCell';
</s> add import wrapCell from './wrapCell';
import whoisCell from './whoisCell'; </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add </s> remove const { dashboard } = this.props;
</s> add const { dashboard, t } = this.props; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/AutoClients.js |
minWidth: 200,
Cell: wrapCell, | <mask> columns = [
<mask> {
<mask> Header: this.props.t('table_client'),
<mask> accessor: 'ip',
<mask> Cell: WrapCell,
<mask> },
<mask> {
<mask> Header: this.props.t('table_name'),
<mask> accessor: 'name',
<mask> Cell: WrapCell,
</s> + client: add icons to the whois info </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: clientCell(clients, autoClients),
</s> add Cell: clientCell(clients, autoClients, t), </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/AutoClients.js |
minWidth: 200,
Cell: wrapCell, | <mask> },
<mask> {
<mask> Header: this.props.t('table_name'),
<mask> accessor: 'name',
<mask> Cell: WrapCell,
<mask> },
<mask> {
<mask> Header: this.props.t('source_label'),
<mask> accessor: 'source',
<mask> Cell: WrapCell,
</s> + client: add icons to the whois info </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add Cell: wrapCell, </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), </s> remove Cell: WhoisCell,
</s> add Cell: whoisCell(this.props.t), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/AutoClients.js |
minWidth: 200,
Cell: wrapCell, | <mask> },
<mask> {
<mask> Header: this.props.t('source_label'),
<mask> accessor: 'source',
<mask> Cell: WrapCell,
<mask> },
<mask> {
<mask> Header: this.props.t('whois'),
<mask> accessor: 'whois_info',
<mask> Cell: WhoisCell,
</s> + client: add icons to the whois info </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), </s> remove Cell: WhoisCell,
</s> add Cell: whoisCell(this.props.t), </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add Cell: wrapCell, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/AutoClients.js |
minWidth: 200,
Cell: whoisCell(this.props.t), | <mask> },
<mask> {
<mask> Header: this.props.t('whois'),
<mask> accessor: 'whois_info',
<mask> Cell: WhoisCell,
<mask> },
<mask> {
<mask> Header: this.props.t('requests_count'),
<mask> accessor: 'statistics',
<mask> Cell: (row) => {
</s> + client: add icons to the whois info </s> remove Cell: WhoisCell,
</s> add Cell: whoisCell(this.props.t), </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add Cell: wrapCell, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/AutoClients.js |
minWidth: 200, | <mask> },
<mask> {
<mask> Header: this.props.t('requests_count'),
<mask> accessor: 'statistics',
<mask> Cell: (row) => {
<mask> const clientIP = row.original.ip;
<mask> const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
<mask>
</s> + client: add icons to the whois info </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), </s> remove Cell: WhoisCell,
</s> add Cell: whoisCell(this.props.t), </s> remove const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
</s> add const whois = Object.keys(whois_info).length > 0 ? whois_info : ''; </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/AutoClients.js |
import wrapCell from './wrapCell';
import whoisCell from './whoisCell'; | <mask>
<mask> import { MODAL_TYPE, CLIENT_ID } from '../../../helpers/constants';
<mask> import Card from '../../ui/Card';
<mask> import Modal from './Modal';
<mask> import WrapCell from './WrapCell';
<mask> import WhoisCell from './WhoisCell';
<mask>
<mask> class ClientsTable extends Component {
<mask> handleFormAdd = (values) => {
<mask> this.props.addClient(values);
<mask> };
</s> + client: add icons to the whois info </s> remove import WhoisCell from './WhoisCell';
import WrapCell from './WrapCell';
</s> add import whoisCell from './whoisCell';
import wrapCell from './wrapCell'; </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove const { dashboard } = this.props;
</s> add const { dashboard, t } = this.props; </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/ClientsTable.js |
Cell: wrapCell, | <mask> {
<mask> Header: this.props.t('table_name'),
<mask> accessor: 'name',
<mask> minWidth: 120,
<mask> Cell: WrapCell,
<mask> },
<mask> {
<mask> Header: this.props.t('settings'),
<mask> accessor: 'use_global_settings',
<mask> minWidth: 120,
</s> + client: add icons to the whois info </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WhoisCell,
</s> add Cell: whoisCell(this.props.t), </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/ClientsTable.js |
Cell: whoisCell(this.props.t), | <mask> {
<mask> Header: this.props.t('whois'),
<mask> accessor: 'whois_info',
<mask> minWidth: 200,
<mask> Cell: WhoisCell,
<mask> },
<mask> {
<mask> Header: this.props.t('requests_count'),
<mask> accessor: 'statistics',
<mask> minWidth: 120,
</s> + client: add icons to the whois info </s> remove Cell: WhoisCell,
</s> add minWidth: 200,
Cell: whoisCell(this.props.t), </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add Cell: wrapCell, </s> remove Cell: WrapCell,
</s> add minWidth: 200,
Cell: wrapCell, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/Settings/Clients/ClientsTable.js |
<symbol id="question" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2">
<circle cx="12" cy="12" r="10" /><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" /><line x1="12" y1="17" x2="12" y2="17" />
</symbol>
<symbol id="network" viewBox="0 0 50 50" fill="currentColor" strokeLinecap="round" strokeLinejoin="round">
<path d="M 25 7 C 15.941406 7 7.339844 10.472656 0.78125 16.773438 L 0.0625 17.464844 L 5.59375 23.230469 L 6.320313 22.539063 C 11.378906 17.679688 18.015625 15 25 15 C 31.984375 15 38.621094 17.679688 43.683594 22.539063 L 44.40625 23.230469 L 49.941406 17.464844 L 49.21875 16.769531 C 42.660156 10.46875 34.058594 7 25 7 Z M 25 19 C 19.046875 19 13.394531 21.28125 9.085938 25.421875 L 8.363281 26.113281 L 13.921875 31.90625 L 14.644531 31.210938 C 17.464844 28.496094 21.144531 27 25 27 C 28.855469 27 32.535156 28.496094 35.355469 31.210938 L 36.078125 31.90625 L 41.636719 26.113281 L 40.917969 25.421875 C 36.605469 21.28125 30.953125 19 25 19 Z M 25 31 C 22.15625 31 19.453125 32.089844 17.390625 34.074219 L 16.671875 34.765625 L 25 43.441406 L 33.328125 34.765625 L 32.609375 34.074219 C 30.546875 32.089844 27.84375 31 25 31 Z"/>
</symbol>
<symbol id="location" viewBox="0 0 24 24" fill="currentColor" strokeLinecap="round" strokeLinejoin="round">
<path d="M12,2C8.134,2,5,5.134,5,9c0,5,7,13,7,13s7-8,7-13C19,5.134,15.866,2,12,2z M12,11.5c-1.381,0-2.5-1.119-2.5-2.5 c0-1.381,1.119-2.5,2.5-2.5s2.5,1.119,2.5,2.5C14.5,10.381,13.381,11.5,12,11.5z"/>
</symbol> | <mask> <symbol id="question" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2">
<mask> <circle cx="12" cy="12" r="10" /><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" /><line x1="12" y1="17" x2="12" y2="17" />
<mask> </symbol>
<mask> </svg>
<mask> );
<mask>
<mask> export default Icons;
</s> + client: add icons to the whois info </s> remove const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
</s> add const whois = Object.keys(whois_info).length > 0 ? whois_info : ''; </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove <span className="logs__text" title={value}>
{value}
</s> add <span className="logs__text">
<Fragment>
{nameContainer}
{whoisContainer}
</Fragment> | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/components/ui/Icons.js |
import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; | <mask> import React, { Fragment } from 'react';
<mask> import { getClientInfo } from './helpers';
<mask>
<mask> export const formatClientCell = (value, clients, autoClients) => {
<mask> const clientInfo = getClientInfo(clients, value) || getClientInfo(autoClients, value);
<mask> const { name, whois } = clientInfo;
<mask>
</s> + client: add icons to the whois info </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove import WhoisCell from './WhoisCell';
import WrapCell from './WrapCell';
</s> add import whoisCell from './whoisCell';
import wrapCell from './wrapCell'; </s> remove import WrapCell from './WrapCell';
import WhoisCell from './WhoisCell';
</s> add import wrapCell from './wrapCell';
import whoisCell from './whoisCell'; | [
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/formatClientCell.js |
const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { | <mask> import React, { Fragment } from 'react';
<mask> import { getClientInfo } from './helpers';
<mask>
<mask> export const formatClientCell = (value, clients, autoClients) => {
<mask> const clientInfo = getClientInfo(clients, value) || getClientInfo(autoClients, value);
<mask> const { name, whois } = clientInfo;
<mask>
<mask> if (whois && name) {
<mask> return (
</s> + client: add icons to the whois info </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove import WhoisCell from './WhoisCell';
import WrapCell from './WrapCell';
</s> add import whoisCell from './whoisCell';
import wrapCell from './wrapCell'; </s> remove import WrapCell from './WrapCell';
import WhoisCell from './WhoisCell';
</s> add import wrapCell from './wrapCell';
import whoisCell from './whoisCell'; | [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/formatClientCell.js |
let whoisContainer = '';
let nameContainer = value; | <mask> export const formatClientCell = (value, clients, autoClients, t) => {
<mask> const clientInfo = getClientInfo(clients, value) || getClientInfo(autoClients, value);
<mask> const { name, whois } = clientInfo;
<mask>
<mask> if (name) {
<mask> nameContainer = (
<mask> <span className="logs__text logs__text--wrap" title={`${name} (${value})`}>
<mask> {name} <small>({value})</small>
<mask> </span>
</s> + client: add icons to the whois info </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; </s> remove const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
</s> add const whois = Object.keys(whois_info).length > 0 ? whois_info : ''; | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/formatClientCell.js |
if (name) {
nameContainer = ( | <mask> export const formatClientCell = (value, clients, autoClients) => {
<mask> const clientInfo = getClientInfo(clients, value) || getClientInfo(autoClients, value);
<mask> const { name, whois } = clientInfo;
<mask>
<mask> if (whois && name) {
<mask> return (
<mask> <Fragment>
<mask> <div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
<mask> {name} <small className="text-muted-dark">({value})</small>
<mask> </div>
<mask> <div className="logs__text logs__text--wrap" title={whois}>
<mask> <small className="text-muted">{whois}</small>
<mask> </div>
<mask> </Fragment>
<mask> );
<mask> } else if (name) {
<mask> return (
<mask> <span className="logs__text logs__text--wrap" title={`${name} (${value})`}>
<mask> {name} <small>({value})</small>
<mask> </span>
<mask> );
<mask> }
</s> + client: add icons to the whois info </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/formatClientCell.js |
if (whois) {
whoisContainer = (
<div className="logs__text logs__text--wrap mt-1">
{getFormattedWhois(whois, t)}
</div>
);
}
| <mask> </span>
<mask> );
<mask> }
<mask>
<mask> return (
<mask> <span className="logs__text">
<mask> <Fragment>
<mask> {nameContainer}
<mask> {whoisContainer}
</s> + client: add icons to the whois info </s> remove <span className="logs__text" title={value}>
{value}
</s> add <span className="logs__text">
<Fragment>
{nameContainer}
{whoisContainer}
</Fragment> </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/formatClientCell.js |
<span className="logs__text">
<Fragment>
{nameContainer}
{whoisContainer}
</Fragment> | <mask> );
<mask> }
<mask>
<mask> return (
<mask> <span className="logs__text" title={value}>
<mask> {value}
<mask> </span>
<mask> );
<mask> };
</s> + client: add icons to the whois info </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove {formatClientCell(value, clients, autoClients)}
</s> add {formatClientCell(value, clients, autoClients, t)} </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/formatClientCell.js |
<mask> };
<mask>
<mask> export const normalizeTextarea = text => text && text.replace(/[;, ]/g, '\n').split('\n').filter(n => n);
<mask>
<mask> const formatWhois = (whois) => {
<mask> if (!whois) {
<mask> return '';
<mask> }
<mask>
<mask> const keys = Object.keys(whois);
<mask> if (keys.length > 0) {
<mask> return (
<mask> keys.map(key => whois[key])
<mask> );
<mask> }
<mask>
<mask> return '';
<mask> };
<mask>
<mask> export const getClientInfo = (clients, ip) => {
<mask> const client = clients.find(item => ip === item.ip);
<mask>
<mask> if (!client) {
<mask> return '';
</s> + client: add icons to the whois info </s> remove const formattedWhois = formatWhois(whois_info);
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
</s> add const whois = Object.keys(whois_info).length > 0 ? whois_info : ''; </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove const clientCell = (clients, autoClients) =>
</s> add const clientCell = (clients, autoClients, t) => </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/helpers.js | |
const whois = Object.keys(whois_info).length > 0 ? whois_info : ''; | <mask> return '';
<mask> }
<mask>
<mask> const { name, whois_info } = client;
<mask> const formattedWhois = formatWhois(whois_info);
<mask> const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
<mask>
<mask> return { name, whois };
<mask> };
<mask>
<mask> export const sortClients = (clients) => {
</s> + client: add icons to the whois info </s> remove const formatWhois = (whois) => {
if (!whois) {
return '';
}
const keys = Object.keys(whois);
if (keys.length > 0) {
return (
keys.map(key => whois[key])
);
}
return '';
};
</s> add </s> remove export const formatClientCell = (value, clients, autoClients) => {
</s> add const getFormattedWhois = (whois, t) => {
const whoisInfo = normalizeWhois(whois);
return (
Object.keys(whoisInfo).map((key) => {
const icon = WHOIS_ICONS[key];
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
</Fragment>
)}{whoisInfo[key]}
</span>
);
})
);
};
export const formatClientCell = (value, clients, autoClients, t) => { </s> remove if (whois && name) {
return (
<Fragment>
<div className="logs__text logs__text--wrap" title={`${name} (${value})`}>
{name} <small className="text-muted-dark">({value})</small>
</div>
<div className="logs__text logs__text--wrap" title={whois}>
<small className="text-muted">{whois}</small>
</div>
</Fragment>
);
} else if (name) {
return (
</s> add if (name) {
nameContainer = ( </s> remove import { getClientInfo } from './helpers';
</s> add import { getClientInfo, normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants'; | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/ba62d42949db49fa049fdce41b16fcac629e0066 | client/src/helpers/helpers.js |
const coreDNSConfigTemplate = `.:{{.Port}} { | <mask> }
<mask> return nil
<mask> }
<mask>
<mask> const coreDNSConfigTemplate = `. {
<mask> {{if .ProtectionEnabled}}dnsfilter {{if .FilteringEnabled}}{{.FilterFile}}{{end}} {
<mask> {{if .SafeBrowsingEnabled}}safebrowsing{{end}}
<mask> {{if .ParentalEnabled}}parental {{.ParentalSensitivity}}{{end}}
<mask> {{if .SafeSearchEnabled}}safesearch{{end}}
<mask> {{if .QueryLogEnabled}}querylog{{end}}
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove var coreDNSCommand *exec.Cmd
</s> add </s> remove // not running -- cheap check
if coreDNSCommand == nil && coreDNSCommand.Process == nil {
return
}
// not running -- more expensive check
if !isRunning() {
return
}
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
return
}
err = process.Signal(syscall.SIGUSR1)
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
return
}
</s> add coredns_plugin.Reload <- true </s> remove func isRunning() bool {
if coreDNSCommand != nil && coreDNSCommand.Process != nil {
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
} else {
err := process.Signal(syscall.Signal(0))
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
}
if err == nil {
return true
}
}
}
return false
}
func startDNSServer() error {
if isRunning() {
return fmt.Errorf("Unable to start coreDNS: Already running")
}
err := writeCoreDNSConfig()
if err != nil {
errortext := fmt.Errorf("Unable to write coredns config: %s", err)
log.Println(errortext)
return errortext
}
err = writeFilterFile()
if err != nil {
errortext := fmt.Errorf("Couldn't write filter file: %s", err)
log.Println(errortext)
return errortext
}
binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port))
coreDNSCommand.Stdout = os.Stdout
coreDNSCommand.Stderr = os.Stderr
err = coreDNSCommand.Start()
if err != nil {
errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
log.Println(errortext)
return errortext
}
log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
go childwaiter()
return nil
}
func handleStart(w http.ResponseWriter, r *http.Request) {
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
return
}
err := startDNSServer()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func childwaiter() {
err := coreDNSCommand.Wait()
log.Printf("coredns unexpectedly died: %s\n", err)
coreDNSCommand.Process.Release()
log.Printf("restarting coredns")
err = startDNSServer()
if err != nil {
log.Printf("Couldn't restart DNS server: %s\n", err)
return
}
}
func handleStop(w http.ResponseWriter, r *http.Request) {
if coreDNSCommand == nil || coreDNSCommand.Process == nil {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
cmd := coreDNSCommand
// TODO: send SIGTERM first, then SIGKILL
err := cmd.Process.Kill()
if err != nil {
errortext := fmt.Sprintf("Unable to stop coreDNS:\nGot error %T\n%v\n%s", err, err, err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
exitstatus := cmd.Wait()
err = cmd.Process.Release()
if err != nil {
errortext := fmt.Sprintf("Unable to release process resources: %s", err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
_, err = fmt.Fprintf(w, "OK\n%s\n", exitstatus)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func handleRestart(w http.ResponseWriter, r *http.Request) {
handleStop(w, r)
handleStart(w, r)
}
</s> add </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | config.go |
<mask> "log"
<mask> "net"
<mask> "net/http"
<mask> "os"
<mask> "os/exec"
<mask> "path/filepath"
<mask> "regexp"
<mask> "strconv"
<mask> "strings"
<mask> "syscall"
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove "syscall"
</s> add </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add </s> remove http.HandleFunc("/control/start", optionalAuth(ensurePOST(handleStart)))
http.HandleFunc("/control/stop", optionalAuth(ensurePOST(handleStop)))
http.HandleFunc("/control/restart", optionalAuth(ensurePOST(handleRestart)))
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | control.go | |
<mask> "path/filepath"
<mask> "regexp"
<mask> "strconv"
<mask> "strings"
<mask> "syscall"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdguardDNS/dnsfilter"
<mask> "github.com/miekg/dns"
<mask> "gopkg.in/asaskevich/govalidator.v4"
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove "os/exec"
</s> add </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add </s> remove http.HandleFunc("/control/start", optionalAuth(ensurePOST(handleStart)))
http.HandleFunc("/control/stop", optionalAuth(ensurePOST(handleStop)))
http.HandleFunc("/control/restart", optionalAuth(ensurePOST(handleRestart)))
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | control.go | |
coredns_plugin "github.com/AdguardTeam/AdguardDNS/coredns_plugin" | <mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdguardDNS/dnsfilter"
<mask> "github.com/miekg/dns"
<mask> "gopkg.in/asaskevich/govalidator.v4"
<mask> )
<mask>
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove "syscall"
</s> add </s> remove var coreDNSCommand *exec.Cmd
</s> add </s> remove "os/exec"
</s> add </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | control.go |
<mask> )
<mask>
<mask> const updatePeriod = time.Minute * 30
<mask>
<mask> var coreDNSCommand *exec.Cmd
<mask>
<mask> var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`)
<mask>
<mask> // cached version.json to avoid hammering github.io for each page reload
<mask> var versionCheckJSON []byte
<mask> var versionCheckLastTime time.Time
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove func isRunning() bool {
if coreDNSCommand != nil && coreDNSCommand.Process != nil {
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
} else {
err := process.Signal(syscall.Signal(0))
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
}
if err == nil {
return true
}
}
}
return false
}
func startDNSServer() error {
if isRunning() {
return fmt.Errorf("Unable to start coreDNS: Already running")
}
err := writeCoreDNSConfig()
if err != nil {
errortext := fmt.Errorf("Unable to write coredns config: %s", err)
log.Println(errortext)
return errortext
}
err = writeFilterFile()
if err != nil {
errortext := fmt.Errorf("Couldn't write filter file: %s", err)
log.Println(errortext)
return errortext
}
binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port))
coreDNSCommand.Stdout = os.Stdout
coreDNSCommand.Stderr = os.Stderr
err = coreDNSCommand.Start()
if err != nil {
errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
log.Println(errortext)
return errortext
}
log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
go childwaiter()
return nil
}
func handleStart(w http.ResponseWriter, r *http.Request) {
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
return
}
err := startDNSServer()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func childwaiter() {
err := coreDNSCommand.Wait()
log.Printf("coredns unexpectedly died: %s\n", err)
coreDNSCommand.Process.Release()
log.Printf("restarting coredns")
err = startDNSServer()
if err != nil {
log.Printf("Couldn't restart DNS server: %s\n", err)
return
}
}
func handleStop(w http.ResponseWriter, r *http.Request) {
if coreDNSCommand == nil || coreDNSCommand.Process == nil {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
cmd := coreDNSCommand
// TODO: send SIGTERM first, then SIGKILL
err := cmd.Process.Kill()
if err != nil {
errortext := fmt.Sprintf("Unable to stop coreDNS:\nGot error %T\n%v\n%s", err, err, err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
exitstatus := cmd.Wait()
err = cmd.Process.Release()
if err != nil {
errortext := fmt.Sprintf("Unable to release process resources: %s", err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
_, err = fmt.Fprintf(w, "OK\n%s\n", exitstatus)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func handleRestart(w http.ResponseWriter, r *http.Request) {
handleStop(w, r)
handleStart(w, r)
}
</s> add </s> remove const coreDNSConfigTemplate = `. {
</s> add const coreDNSConfigTemplate = `.:{{.Port}} { </s> remove // not running -- cheap check
if coreDNSCommand == nil && coreDNSCommand.Process == nil {
return
}
// not running -- more expensive check
if !isRunning() {
return
}
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
return
}
err = process.Signal(syscall.SIGUSR1)
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
return
}
</s> add coredns_plugin.Reload <- true </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | control.go | |
coredns_plugin.Reload <- true | <mask> // -------------------
<mask> // coredns run control
<mask> // -------------------
<mask> func tellCoreDNSToReload() {
<mask> // not running -- cheap check
<mask> if coreDNSCommand == nil && coreDNSCommand.Process == nil {
<mask> return
<mask> }
<mask> // not running -- more expensive check
<mask> if !isRunning() {
<mask> return
<mask> }
<mask>
<mask> pid := coreDNSCommand.Process.Pid
<mask> process, err := os.FindProcess(pid)
<mask> if err != nil {
<mask> log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
<mask> return
<mask> }
<mask> err = process.Signal(syscall.SIGUSR1)
<mask> if err != nil {
<mask> log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> func writeAllConfigsAndReloadCoreDNS() error {
<mask> err := writeAllConfigs()
<mask> if err != nil {
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove func isRunning() bool {
if coreDNSCommand != nil && coreDNSCommand.Process != nil {
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
} else {
err := process.Signal(syscall.Signal(0))
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
}
if err == nil {
return true
}
}
}
return false
}
func startDNSServer() error {
if isRunning() {
return fmt.Errorf("Unable to start coreDNS: Already running")
}
err := writeCoreDNSConfig()
if err != nil {
errortext := fmt.Errorf("Unable to write coredns config: %s", err)
log.Println(errortext)
return errortext
}
err = writeFilterFile()
if err != nil {
errortext := fmt.Errorf("Couldn't write filter file: %s", err)
log.Println(errortext)
return errortext
}
binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port))
coreDNSCommand.Stdout = os.Stdout
coreDNSCommand.Stderr = os.Stderr
err = coreDNSCommand.Start()
if err != nil {
errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
log.Println(errortext)
return errortext
}
log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
go childwaiter()
return nil
}
func handleStart(w http.ResponseWriter, r *http.Request) {
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
return
}
err := startDNSServer()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func childwaiter() {
err := coreDNSCommand.Wait()
log.Printf("coredns unexpectedly died: %s\n", err)
coreDNSCommand.Process.Release()
log.Printf("restarting coredns")
err = startDNSServer()
if err != nil {
log.Printf("Couldn't restart DNS server: %s\n", err)
return
}
}
func handleStop(w http.ResponseWriter, r *http.Request) {
if coreDNSCommand == nil || coreDNSCommand.Process == nil {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
cmd := coreDNSCommand
// TODO: send SIGTERM first, then SIGKILL
err := cmd.Process.Kill()
if err != nil {
errortext := fmt.Sprintf("Unable to stop coreDNS:\nGot error %T\n%v\n%s", err, err, err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
exitstatus := cmd.Wait()
err = cmd.Process.Release()
if err != nil {
errortext := fmt.Sprintf("Unable to release process resources: %s", err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
_, err = fmt.Fprintf(w, "OK\n%s\n", exitstatus)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func handleRestart(w http.ResponseWriter, r *http.Request) {
handleStop(w, r)
handleStart(w, r)
}
</s> add </s> remove var coreDNSCommand *exec.Cmd
</s> add </s> remove const coreDNSConfigTemplate = `. {
</s> add const coreDNSConfigTemplate = `.:{{.Port}} { </s> remove http.HandleFunc("/control/start", optionalAuth(ensurePOST(handleStart)))
http.HandleFunc("/control/stop", optionalAuth(ensurePOST(handleStop)))
http.HandleFunc("/control/restart", optionalAuth(ensurePOST(handleRestart)))
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep"... | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | control.go |
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask> }
<mask>
<mask> func isRunning() bool {
<mask> if coreDNSCommand != nil && coreDNSCommand.Process != nil {
<mask> pid := coreDNSCommand.Process.Pid
<mask> process, err := os.FindProcess(pid)
<mask> if err != nil {
<mask> log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
<mask> } else {
<mask> err := process.Signal(syscall.Signal(0))
<mask> if err != nil {
<mask> log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
<mask> }
<mask> if err == nil {
<mask> return true
<mask> }
<mask> }
<mask> }
<mask> return false
<mask> }
<mask>
<mask> func startDNSServer() error {
<mask> if isRunning() {
<mask> return fmt.Errorf("Unable to start coreDNS: Already running")
<mask> }
<mask> err := writeCoreDNSConfig()
<mask> if err != nil {
<mask> errortext := fmt.Errorf("Unable to write coredns config: %s", err)
<mask> log.Println(errortext)
<mask> return errortext
<mask> }
<mask> err = writeFilterFile()
<mask> if err != nil {
<mask> errortext := fmt.Errorf("Couldn't write filter file: %s", err)
<mask> log.Println(errortext)
<mask> return errortext
<mask> }
<mask> binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
<mask> configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
<mask> coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port))
<mask> coreDNSCommand.Stdout = os.Stdout
<mask> coreDNSCommand.Stderr = os.Stderr
<mask> err = coreDNSCommand.Start()
<mask> if err != nil {
<mask> errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
<mask> log.Println(errortext)
<mask> return errortext
<mask> }
<mask> log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
<mask> go childwaiter()
<mask> return nil
<mask> }
<mask>
<mask> func handleStart(w http.ResponseWriter, r *http.Request) {
<mask> if isRunning() {
<mask> http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
<mask> return
<mask> }
<mask> err := startDNSServer()
<mask> if err != nil {
<mask> http.Error(w, err.Error(), http.StatusInternalServerError)
<mask> return
<mask> }
<mask>
<mask> _, err = fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
<mask> if err != nil {
<mask> log.Printf("Couldn't write body in %s(): %s", _Func(), err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> func childwaiter() {
<mask> err := coreDNSCommand.Wait()
<mask> log.Printf("coredns unexpectedly died: %s\n", err)
<mask> coreDNSCommand.Process.Release()
<mask> log.Printf("restarting coredns")
<mask> err = startDNSServer()
<mask> if err != nil {
<mask> log.Printf("Couldn't restart DNS server: %s\n", err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> func handleStop(w http.ResponseWriter, r *http.Request) {
<mask> if coreDNSCommand == nil || coreDNSCommand.Process == nil {
<mask> http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
<mask> return
<mask> }
<mask> if isRunning() {
<mask> http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
<mask> return
<mask> }
<mask> cmd := coreDNSCommand
<mask> // TODO: send SIGTERM first, then SIGKILL
<mask> err := cmd.Process.Kill()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Unable to stop coreDNS:\nGot error %T\n%v\n%s", err, err, err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, 500)
<mask> return
<mask> }
<mask> exitstatus := cmd.Wait()
<mask>
<mask> err = cmd.Process.Release()
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Unable to release process resources: %s", err)
<mask> log.Println(errortext)
<mask> http.Error(w, errortext, 500)
<mask> return
<mask> }
<mask> _, err = fmt.Fprintf(w, "OK\n%s\n", exitstatus)
<mask> if err != nil {
<mask> log.Printf("Couldn't write body in %s(): %s", _Func(), err)
<mask> return
<mask> }
<mask> }
<mask>
<mask> func handleRestart(w http.ResponseWriter, r *http.Request) {
<mask> handleStop(w, r)
<mask> handleStart(w, r)
<mask> }
<mask>
<mask> func handleStatus(w http.ResponseWriter, r *http.Request) {
<mask> data := map[string]interface{}{
<mask> "dns_address": config.BindHost,
<mask> "dns_port": config.CoreDNS.Port,
<mask> "protection_enabled": config.CoreDNS.ProtectionEnabled,
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove // not running -- cheap check
if coreDNSCommand == nil && coreDNSCommand.Process == nil {
return
}
// not running -- more expensive check
if !isRunning() {
return
}
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
return
}
err = process.Signal(syscall.SIGUSR1)
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
return
}
</s> add coredns_plugin.Reload <- true </s> remove var coreDNSCommand *exec.Cmd
</s> add </s> remove const coreDNSConfigTemplate = `. {
</s> add const coreDNSConfigTemplate = `.:{{.Port}} { </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | control.go | |
<mask> }
<mask> }
<mask>
<mask> func registerControlHandlers() {
<mask> http.HandleFunc("/control/start", optionalAuth(ensurePOST(handleStart)))
<mask> http.HandleFunc("/control/stop", optionalAuth(ensurePOST(handleStop)))
<mask> http.HandleFunc("/control/restart", optionalAuth(ensurePOST(handleRestart)))
<mask> http.HandleFunc("/control/status", optionalAuth(ensureGET(handleStatus)))
<mask> http.HandleFunc("/control/enable_protection", optionalAuth(ensurePOST(handleProtectionEnable)))
<mask> http.HandleFunc("/control/disable_protection", optionalAuth(ensurePOST(handleProtectionDisable)))
<mask> http.HandleFunc("/control/querylog", optionalAuth(ensureGET(handleQueryLog)))
<mask> http.HandleFunc("/control/querylog_enable", optionalAuth(ensurePOST(handleQueryLogEnable)))
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove // not running -- cheap check
if coreDNSCommand == nil && coreDNSCommand.Process == nil {
return
}
// not running -- more expensive check
if !isRunning() {
return
}
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
return
}
err = process.Signal(syscall.SIGUSR1)
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
return
}
</s> add coredns_plugin.Reload <- true </s> remove func isRunning() bool {
if coreDNSCommand != nil && coreDNSCommand.Process != nil {
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
} else {
err := process.Signal(syscall.Signal(0))
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
}
if err == nil {
return true
}
}
}
return false
}
func startDNSServer() error {
if isRunning() {
return fmt.Errorf("Unable to start coreDNS: Already running")
}
err := writeCoreDNSConfig()
if err != nil {
errortext := fmt.Errorf("Unable to write coredns config: %s", err)
log.Println(errortext)
return errortext
}
err = writeFilterFile()
if err != nil {
errortext := fmt.Errorf("Couldn't write filter file: %s", err)
log.Println(errortext)
return errortext
}
binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port))
coreDNSCommand.Stdout = os.Stdout
coreDNSCommand.Stderr = os.Stderr
err = coreDNSCommand.Start()
if err != nil {
errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
log.Println(errortext)
return errortext
}
log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
go childwaiter()
return nil
}
func handleStart(w http.ResponseWriter, r *http.Request) {
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
return
}
err := startDNSServer()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func childwaiter() {
err := coreDNSCommand.Wait()
log.Printf("coredns unexpectedly died: %s\n", err)
coreDNSCommand.Process.Release()
log.Printf("restarting coredns")
err = startDNSServer()
if err != nil {
log.Printf("Couldn't restart DNS server: %s\n", err)
return
}
}
func handleStop(w http.ResponseWriter, r *http.Request) {
if coreDNSCommand == nil || coreDNSCommand.Process == nil {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
cmd := coreDNSCommand
// TODO: send SIGTERM first, then SIGKILL
err := cmd.Process.Kill()
if err != nil {
errortext := fmt.Sprintf("Unable to stop coreDNS:\nGot error %T\n%v\n%s", err, err, err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
exitstatus := cmd.Wait()
err = cmd.Process.Release()
if err != nil {
errortext := fmt.Sprintf("Unable to release process resources: %s", err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
_, err = fmt.Fprintf(w, "OK\n%s\n", exitstatus)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func handleRestart(w http.ResponseWriter, r *http.Request) {
handleStop(w, r)
handleStart(w, r)
}
</s> add </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add </s> remove var coreDNSCommand *exec.Cmd
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | control.go | |
onceHook.Do(func() {
caddy.RegisterEventHook("dnsfilter-reload", hook)
})
| <mask> }
<mask>
<mask> p.upstream, err = upstream.New(nil)
<mask> if err != nil {
<mask> return nil, err
<mask> }
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove func isRunning() bool {
if coreDNSCommand != nil && coreDNSCommand.Process != nil {
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
} else {
err := process.Signal(syscall.Signal(0))
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
}
if err == nil {
return true
}
}
}
return false
}
func startDNSServer() error {
if isRunning() {
return fmt.Errorf("Unable to start coreDNS: Already running")
}
err := writeCoreDNSConfig()
if err != nil {
errortext := fmt.Errorf("Unable to write coredns config: %s", err)
log.Println(errortext)
return errortext
}
err = writeFilterFile()
if err != nil {
errortext := fmt.Errorf("Couldn't write filter file: %s", err)
log.Println(errortext)
return errortext
}
binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port))
coreDNSCommand.Stdout = os.Stdout
coreDNSCommand.Stderr = os.Stderr
err = coreDNSCommand.Start()
if err != nil {
errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
log.Println(errortext)
return errortext
}
log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
go childwaiter()
return nil
}
func handleStart(w http.ResponseWriter, r *http.Request) {
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
return
}
err := startDNSServer()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func childwaiter() {
err := coreDNSCommand.Wait()
log.Printf("coredns unexpectedly died: %s\n", err)
coreDNSCommand.Process.Release()
log.Printf("restarting coredns")
err = startDNSServer()
if err != nil {
log.Printf("Couldn't restart DNS server: %s\n", err)
return
}
}
func handleStop(w http.ResponseWriter, r *http.Request) {
if coreDNSCommand == nil || coreDNSCommand.Process == nil {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
cmd := coreDNSCommand
// TODO: send SIGTERM first, then SIGKILL
err := cmd.Process.Kill()
if err != nil {
errortext := fmt.Sprintf("Unable to stop coreDNS:\nGot error %T\n%v\n%s", err, err, err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
exitstatus := cmd.Wait()
err = cmd.Process.Release()
if err != nil {
errortext := fmt.Sprintf("Unable to release process resources: %s", err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
_, err = fmt.Fprintf(w, "OK\n%s\n", exitstatus)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func handleRestart(w http.ResponseWriter, r *http.Request) {
handleStop(w, r)
handleStart(w, r)
}
</s> add </s> remove // not running -- cheap check
if coreDNSCommand == nil && coreDNSCommand.Process == nil {
return
}
// not running -- more expensive check
if !isRunning() {
return
}
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
return
}
err = process.Signal(syscall.SIGUSR1)
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
return
}
</s> add coredns_plugin.Reload <- true </s> remove const coreDNSConfigTemplate = `. {
</s> add const coreDNSConfigTemplate = `.:{{.Port}} { </s> remove /start:
post:
tags:
- global
operationId: start
summary: 'Start DNS server'
responses:
200:
description: OK
/stop:
post:
tags:
- global
operationId: stop
summary: 'Stop DNS server'
responses:
200:
description: OK
/restart:
post:
tags:
- global
operationId: restart
summary: 'Restart DNS server'
responses:
200:
description: OK
</s> add </s> remove http.HandleFunc("/control/start", optionalAuth(ensurePOST(handleStart)))
http.HandleFunc("/control/stop", optionalAuth(ensurePOST(handleStop)))
http.HandleFunc("/control/restart", optionalAuth(ensurePOST(handleRestart)))
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | coredns_plugin/coredns_plugin.go |
<mask> -
<mask> name: safesearch
<mask> description: 'Enforce family-friendly results in search engines'
<mask> paths:
<mask> /start:
<mask> post:
<mask> tags:
<mask> - global
<mask> operationId: start
<mask> summary: 'Start DNS server'
<mask> responses:
<mask> 200:
<mask> description: OK
<mask> /stop:
<mask> post:
<mask> tags:
<mask> - global
<mask> operationId: stop
<mask> summary: 'Stop DNS server'
<mask> responses:
<mask> 200:
<mask> description: OK
<mask> /restart:
<mask> post:
<mask> tags:
<mask> - global
<mask> operationId: restart
<mask> summary: 'Restart DNS server'
<mask> responses:
<mask> 200:
<mask> description: OK
<mask> /status:
<mask> get:
<mask> tags:
<mask> - global
<mask> operationId: status
</s> WIP -- single binary -- works, replies to DNS, but need to check what got broken </s> remove func isRunning() bool {
if coreDNSCommand != nil && coreDNSCommand.Process != nil {
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
} else {
err := process.Signal(syscall.Signal(0))
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
}
if err == nil {
return true
}
}
}
return false
}
func startDNSServer() error {
if isRunning() {
return fmt.Errorf("Unable to start coreDNS: Already running")
}
err := writeCoreDNSConfig()
if err != nil {
errortext := fmt.Errorf("Unable to write coredns config: %s", err)
log.Println(errortext)
return errortext
}
err = writeFilterFile()
if err != nil {
errortext := fmt.Errorf("Couldn't write filter file: %s", err)
log.Println(errortext)
return errortext
}
binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port))
coreDNSCommand.Stdout = os.Stdout
coreDNSCommand.Stderr = os.Stderr
err = coreDNSCommand.Start()
if err != nil {
errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
log.Println(errortext)
return errortext
}
log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
go childwaiter()
return nil
}
func handleStart(w http.ResponseWriter, r *http.Request) {
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400)
return
}
err := startDNSServer()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func childwaiter() {
err := coreDNSCommand.Wait()
log.Printf("coredns unexpectedly died: %s\n", err)
coreDNSCommand.Process.Release()
log.Printf("restarting coredns")
err = startDNSServer()
if err != nil {
log.Printf("Couldn't restart DNS server: %s\n", err)
return
}
}
func handleStop(w http.ResponseWriter, r *http.Request) {
if coreDNSCommand == nil || coreDNSCommand.Process == nil {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
if isRunning() {
http.Error(w, fmt.Sprintf("Unable to start coreDNS: Not running"), 400)
return
}
cmd := coreDNSCommand
// TODO: send SIGTERM first, then SIGKILL
err := cmd.Process.Kill()
if err != nil {
errortext := fmt.Sprintf("Unable to stop coreDNS:\nGot error %T\n%v\n%s", err, err, err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
exitstatus := cmd.Wait()
err = cmd.Process.Release()
if err != nil {
errortext := fmt.Sprintf("Unable to release process resources: %s", err)
log.Println(errortext)
http.Error(w, errortext, 500)
return
}
_, err = fmt.Fprintf(w, "OK\n%s\n", exitstatus)
if err != nil {
log.Printf("Couldn't write body in %s(): %s", _Func(), err)
return
}
}
func handleRestart(w http.ResponseWriter, r *http.Request) {
handleStop(w, r)
handleStart(w, r)
}
</s> add </s> remove http.HandleFunc("/control/start", optionalAuth(ensurePOST(handleStart)))
http.HandleFunc("/control/stop", optionalAuth(ensurePOST(handleStop)))
http.HandleFunc("/control/restart", optionalAuth(ensurePOST(handleRestart)))
</s> add </s> remove // not running -- cheap check
if coreDNSCommand == nil && coreDNSCommand.Process == nil {
return
}
// not running -- more expensive check
if !isRunning() {
return
}
pid := coreDNSCommand.Process.Pid
process, err := os.FindProcess(pid)
if err != nil {
log.Printf("os.FindProcess(%d) returned err: %v\n", pid, err)
return
}
err = process.Signal(syscall.SIGUSR1)
if err != nil {
log.Printf("process.Signal on pid %d returned: %v\n", pid, err)
return
}
</s> add coredns_plugin.Reload <- true </s> remove var coreDNSCommand *exec.Cmd
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/bad88961e93bf81668ea3eafe58ff2be64d71342 | openapi.yaml | |
"table_statistics": "Statistics (last 24 hours)",
"clients_not_found": "No clients found" | <mask> "client_global_settings": "Use global settings",
<mask> "client_deleted": "Client \"{{key}}\" successfully deleted",
<mask> "client_added": "Client \"{{key}}\" successfully added",
<mask> "client_updated": "Client \"{{key}}\" successfully updated",
<mask> "table_statistics": "Statistics (last 24 hours)"
<mask> } </s> * client: fix no data text </s> remove noDataText={t('dhcp_leases_not_found')}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb34381a0d73a85b798122e940ae5c9fc1a255ff | client/src/__locales/en.json |
<mask> <Fragment>
<mask> <ReactTable
<mask> data={clients || []}
<mask> columns={this.columns}
<mask> noDataText={t('dhcp_leases_not_found')}
<mask> className="-striped -highlight card-table-overflow"
<mask> showPagination={true}
<mask> defaultPageSize={10}
<mask> minRows={5}
<mask> resizable={false}
</s> * client: fix no data text </s> remove "table_statistics": "Statistics (last 24 hours)"
</s> add "table_statistics": "Statistics (last 24 hours)",
"clients_not_found": "No clients found" | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb34381a0d73a85b798122e940ae5c9fc1a255ff | client/src/components/Settings/Clients/index.js | |
noDataText={t('clients_not_found')} | <mask> pageText={t('page_table_footer_text')}
<mask> ofText={t('of_table_footer_text')}
<mask> rowsText={t('rows_table_footer_text')}
<mask> />
<mask> <button
<mask> type="button"
<mask> className="btn btn-success btn-standard mt-3"
<mask> onClick={() => toggleClientModal(MODAL_TYPE.ADD)}
</s> * client: fix no data text </s> remove noDataText={t('dhcp_leases_not_found')}
</s> add </s> remove "table_statistics": "Statistics (last 24 hours)"
</s> add "table_statistics": "Statistics (last 24 hours)",
"clients_not_found": "No clients found" | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb34381a0d73a85b798122e940ae5c9fc1a255ff | client/src/components/Settings/Clients/index.js |
"updated_upstream_dns_toast": "Upstream-servere er gemt", | <mask> "example_upstream_doq": "krypteret <0>DNS-over-QUIC</0>",
<mask> "example_upstream_sdns": "du kan bruge <0>DNS Stamps</0> til <1>DNSCrypt</1> eller <2>DNS-over-HTTPS</2>-resolvers",
<mask> "example_upstream_tcp": "almindelig DNS (over TCP)",
<mask> "all_lists_up_to_date_toast": "Alle lister er allerede opdaterede",
<mask> "updated_upstream_dns_toast": "Opdaterede upstream DNS-serverene",
<mask> "dns_test_ok_toast": "Angivne DNS-servere fungerer korrekt",
<mask> "dns_test_not_ok_toast": "Server \"{{key}}\": Kunne ikke bruges. Tjek, at du har angivet den korrekt",
<mask> "unblock": "Afblokering",
<mask> "block": "Blokering",
<mask> "disallow_this_client": "Afvis denne klient",
</s> Pull request: client: upd i18n
Merge in DNS/adguard-home from upd-i18n to master
Squashed commit of the following:
commit 59dadec4fe47ffb752ba13d597ad0dba35a17d93
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:22:53 2021 +0300
client: fix ru locale
commit 38268c97dbf728c367ac280224ee6dcfef90c19a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:16:36 2021 +0300
client: upd i18n </s> remove "updated_upstream_dns_toast": "De upstream DNS-servers zijn bijgewerkt",
</s> add "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", </s> remove "experimental": "Experimenteel"
</s> add "experimental": "Experimenteel",
"use_saved_key": "De eerder opgeslagen sleutel gebruiken" </s> remove "updated_custom_filtering_toast": "Aangepaste filter regels zijn bijgewerkt",
</s> add "updated_custom_filtering_toast": "Aangepaste regels succesvol opgeslagen", </s> remove "updated_custom_filtering_toast": "Le regole dei filtri personalizzate sono state aggiornate",
</s> add "updated_custom_filtering_toast": "Le regole personalizzate sono state correttamente salvate", </s> remove "dhcp_form_range_title": "Range indirizzi IP",
"dhcp_form_range_start": "Inizio range",
"dhcp_form_range_end": "Fine range",
</s> add "dhcp_form_range_title": "Intervallo di indirizzi IP",
"dhcp_form_range_start": "Intervallo iniziale",
"dhcp_form_range_end": "Intervallo finale", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb4cd312c28954266b57487fb322c521dcea4f2b | client/src/__locales/da.json |
"dhcp_form_range_title": "Intervallo di indirizzi IP",
"dhcp_form_range_start": "Intervallo iniziale",
"dhcp_form_range_end": "Intervallo finale", | <mask> "form_error_negative": "Deve essere maggiore o uguale a 0 (zero)",
<mask> "range_end_error": "Deve essere maggiore dell'intervallo di inizio",
<mask> "dhcp_form_gateway_input": "IP Gateway",
<mask> "dhcp_form_subnet_input": "Maschera di sottorete",
<mask> "dhcp_form_range_title": "Range indirizzi IP",
<mask> "dhcp_form_range_start": "Inizio range",
<mask> "dhcp_form_range_end": "Fine range",
<mask> "dhcp_form_lease_title": "Tempo di lease DHCP (in secondi)",
<mask> "dhcp_form_lease_input": "Durata lease",
<mask> "dhcp_interface_select": "Seleziona l'interfaccia DHCP",
<mask> "dhcp_hardware_address": "Indirizzo hardware",
<mask> "dhcp_ip_addresses": "Indirizzi IP",
</s> Pull request: client: upd i18n
Merge in DNS/adguard-home from upd-i18n to master
Squashed commit of the following:
commit 59dadec4fe47ffb752ba13d597ad0dba35a17d93
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:22:53 2021 +0300
client: fix ru locale
commit 38268c97dbf728c367ac280224ee6dcfef90c19a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:16:36 2021 +0300
client: upd i18n </s> remove "updated_custom_filtering_toast": "Le regole dei filtri personalizzate sono state aggiornate",
</s> add "updated_custom_filtering_toast": "Le regole personalizzate sono state correttamente salvate", </s> remove "experimental": "Experimenteel"
</s> add "experimental": "Experimenteel",
"use_saved_key": "De eerder opgeslagen sleutel gebruiken" </s> remove "updated_custom_filtering_toast": "Aangepaste filter regels zijn bijgewerkt",
</s> add "updated_custom_filtering_toast": "Aangepaste regels succesvol opgeslagen", </s> remove "updated_upstream_dns_toast": "De upstream DNS-servers zijn bijgewerkt",
</s> add "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", </s> remove "updated_upstream_dns_toast": "Opdaterede upstream DNS-serverene",
</s> add "updated_upstream_dns_toast": "Upstream-servere er gemt", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb4cd312c28954266b57487fb322c521dcea4f2b | client/src/__locales/it.json |
"updated_custom_filtering_toast": "Le regole personalizzate sono state correttamente salvate", | <mask> "next_btn": "Successivo",
<mask> "loading_table_status": "Caricamento...",
<mask> "page_table_footer_text": "Pagina",
<mask> "rows_table_footer_text": "righe",
<mask> "updated_custom_filtering_toast": "Le regole dei filtri personalizzate sono state aggiornate",
<mask> "rule_removed_from_custom_filtering_toast": "Regola rimossa dalle regole dei filtri personalizzate: {{rule}}",
<mask> "rule_added_to_custom_filtering_toast": "Regola aggiunta alle regole dei filtri personalizzate: {{rule}}",
<mask> "query_log_response_status": "Stato: {{value}}",
<mask> "query_log_filtered": "Filtrato da {{filter}}",
<mask> "query_log_confirm_clear": "Sei sicuro di voler eliminare il registro richieste?",
</s> Pull request: client: upd i18n
Merge in DNS/adguard-home from upd-i18n to master
Squashed commit of the following:
commit 59dadec4fe47ffb752ba13d597ad0dba35a17d93
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:22:53 2021 +0300
client: fix ru locale
commit 38268c97dbf728c367ac280224ee6dcfef90c19a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:16:36 2021 +0300
client: upd i18n </s> remove "updated_custom_filtering_toast": "Aangepaste filter regels zijn bijgewerkt",
</s> add "updated_custom_filtering_toast": "Aangepaste regels succesvol opgeslagen", </s> remove "dhcp_form_range_title": "Range indirizzi IP",
"dhcp_form_range_start": "Inizio range",
"dhcp_form_range_end": "Fine range",
</s> add "dhcp_form_range_title": "Intervallo di indirizzi IP",
"dhcp_form_range_start": "Intervallo iniziale",
"dhcp_form_range_end": "Intervallo finale", </s> remove "experimental": "Experimenteel"
</s> add "experimental": "Experimenteel",
"use_saved_key": "De eerder opgeslagen sleutel gebruiken" </s> remove "updated_upstream_dns_toast": "De upstream DNS-servers zijn bijgewerkt",
</s> add "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", </s> remove "updated_upstream_dns_toast": "Opdaterede upstream DNS-serverene",
</s> add "updated_upstream_dns_toast": "Upstream-servere er gemt", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb4cd312c28954266b57487fb322c521dcea4f2b | client/src/__locales/it.json |
"updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", | <mask> "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>",
<mask> "example_upstream_sdns": "je kunt <0>DNS Stamps</0> voor <1>DNSCrypt</1> of <2>DNS-via-HTTPS</2> oplossingen gebruiken",
<mask> "example_upstream_tcp": "standaard DNS (over TCP)",
<mask> "all_lists_up_to_date_toast": "Alle lijsten zijn reeds up-to-date",
<mask> "updated_upstream_dns_toast": "De upstream DNS-servers zijn bijgewerkt",
<mask> "dns_test_ok_toast": "Opgegeven DNS-servers werken correct",
<mask> "dns_test_not_ok_toast": "Server \"{{key}}\": kon niet worden gebruikt, controleer of je het correct hebt geschreven",
<mask> "unblock": "Deblokkeren",
<mask> "block": "Blokkeren",
<mask> "disallow_this_client": "Toepassing/systeem niet toelaten",
</s> Pull request: client: upd i18n
Merge in DNS/adguard-home from upd-i18n to master
Squashed commit of the following:
commit 59dadec4fe47ffb752ba13d597ad0dba35a17d93
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:22:53 2021 +0300
client: fix ru locale
commit 38268c97dbf728c367ac280224ee6dcfef90c19a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:16:36 2021 +0300
client: upd i18n </s> remove "updated_upstream_dns_toast": "Opdaterede upstream DNS-serverene",
</s> add "updated_upstream_dns_toast": "Upstream-servere er gemt", </s> remove "experimental": "Experimenteel"
</s> add "experimental": "Experimenteel",
"use_saved_key": "De eerder opgeslagen sleutel gebruiken" </s> remove "updated_custom_filtering_toast": "Aangepaste filter regels zijn bijgewerkt",
</s> add "updated_custom_filtering_toast": "Aangepaste regels succesvol opgeslagen", </s> remove "updated_custom_filtering_toast": "Le regole dei filtri personalizzate sono state aggiornate",
</s> add "updated_custom_filtering_toast": "Le regole personalizzate sono state correttamente salvate", </s> remove "dhcp_form_range_title": "Range indirizzi IP",
"dhcp_form_range_start": "Inizio range",
"dhcp_form_range_end": "Fine range",
</s> add "dhcp_form_range_title": "Intervallo di indirizzi IP",
"dhcp_form_range_start": "Intervallo iniziale",
"dhcp_form_range_end": "Intervallo finale", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb4cd312c28954266b57487fb322c521dcea4f2b | client/src/__locales/nl.json |
"updated_custom_filtering_toast": "Aangepaste regels succesvol opgeslagen", | <mask> "next_btn": "Volgende",
<mask> "loading_table_status": "Laden...",
<mask> "page_table_footer_text": "Pagina",
<mask> "rows_table_footer_text": "rijen",
<mask> "updated_custom_filtering_toast": "Aangepaste filter regels zijn bijgewerkt",
<mask> "rule_removed_from_custom_filtering_toast": "Regel verwijderd uit de aangepaste filterregels: {{rule}}",
<mask> "rule_added_to_custom_filtering_toast": "Regel toegevoegd aan de aangepaste filterregels: {{rule}}",
<mask> "query_log_response_status": "Status: {{value}}",
<mask> "query_log_filtered": "Gefilterd door {{filter}}",
<mask> "query_log_confirm_clear": "Weet u zeker dat u het hele query logboek wilt legen?",
</s> Pull request: client: upd i18n
Merge in DNS/adguard-home from upd-i18n to master
Squashed commit of the following:
commit 59dadec4fe47ffb752ba13d597ad0dba35a17d93
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:22:53 2021 +0300
client: fix ru locale
commit 38268c97dbf728c367ac280224ee6dcfef90c19a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:16:36 2021 +0300
client: upd i18n </s> remove "updated_custom_filtering_toast": "Le regole dei filtri personalizzate sono state aggiornate",
</s> add "updated_custom_filtering_toast": "Le regole personalizzate sono state correttamente salvate", </s> remove "experimental": "Experimenteel"
</s> add "experimental": "Experimenteel",
"use_saved_key": "De eerder opgeslagen sleutel gebruiken" </s> remove "updated_upstream_dns_toast": "De upstream DNS-servers zijn bijgewerkt",
</s> add "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", </s> remove "dhcp_form_range_title": "Range indirizzi IP",
"dhcp_form_range_start": "Inizio range",
"dhcp_form_range_end": "Fine range",
</s> add "dhcp_form_range_title": "Intervallo di indirizzi IP",
"dhcp_form_range_start": "Intervallo iniziale",
"dhcp_form_range_end": "Intervallo finale", </s> remove "updated_upstream_dns_toast": "Opdaterede upstream DNS-serverene",
</s> add "updated_upstream_dns_toast": "Upstream-servere er gemt", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb4cd312c28954266b57487fb322c521dcea4f2b | client/src/__locales/nl.json |
"experimental": "Experimenteel",
"use_saved_key": "De eerder opgeslagen sleutel gebruiken" | <mask> "click_to_view_queries": "Klik om queries te bekijken",
<mask> "port_53_faq_link": "Poort 53 wordt vaak gebruikt door services als DNSStubListener- of de systeem DNS-resolver. Lees a.u.b. <0>deze instructie</0> hoe dit is op te lossen.",
<mask> "adg_will_drop_dns_queries": "AdGuard Home zal alle DNS verzoeken van deze toepassing/dit systeem negeren.",
<mask> "client_not_in_allowed_clients": "De toepassing is niet toegestaan omdat deze niet in de lijst \"Toegestane toepassingen\" voorkomt.",
<mask> "experimental": "Experimenteel"
<mask> }
</s> Pull request: client: upd i18n
Merge in DNS/adguard-home from upd-i18n to master
Squashed commit of the following:
commit 59dadec4fe47ffb752ba13d597ad0dba35a17d93
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:22:53 2021 +0300
client: fix ru locale
commit 38268c97dbf728c367ac280224ee6dcfef90c19a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Tue Aug 31 13:16:36 2021 +0300
client: upd i18n </s> remove "updated_upstream_dns_toast": "De upstream DNS-servers zijn bijgewerkt",
</s> add "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", </s> remove "updated_custom_filtering_toast": "Aangepaste filter regels zijn bijgewerkt",
</s> add "updated_custom_filtering_toast": "Aangepaste regels succesvol opgeslagen", </s> remove "updated_custom_filtering_toast": "Le regole dei filtri personalizzate sono state aggiornate",
</s> add "updated_custom_filtering_toast": "Le regole personalizzate sono state correttamente salvate", </s> remove "dhcp_form_range_title": "Range indirizzi IP",
"dhcp_form_range_start": "Inizio range",
"dhcp_form_range_end": "Fine range",
</s> add "dhcp_form_range_title": "Intervallo di indirizzi IP",
"dhcp_form_range_start": "Intervallo iniziale",
"dhcp_form_range_end": "Intervallo finale", </s> remove "updated_upstream_dns_toast": "Opdaterede upstream DNS-serverene",
</s> add "updated_upstream_dns_toast": "Upstream-servere er gemt", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb4cd312c28954266b57487fb322c521dcea4f2b | client/src/__locales/nl.json |
return fmt.Errorf("getting version info from %s: %w", vcu, err) | <mask>
<mask> if err != nil {
<mask> vcu := Context.updater.VersionCheckURL()
<mask>
<mask> return fmt.Errorf("getting version info from %s: %s", vcu, err)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", wd, u.backupDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", wd, u.backupDir, err) </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", u.updateDir, u.workDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", u.updateDir, u.workDir, err) </s> remove for _, v := range versionJSON {
</s> add for k, v := range versionJSON { </s> remove return val, true
</s> add keys := maps.Keys(versionObj)
slices.Sort(keys)
log.Error("updater: key %q not found; got keys %q", key, keys)
return "", key, false
}
// isMIPS returns true if arch is any MIPS architecture.
func isMIPS(arch string) (ok bool) {
switch arch {
case
"mips",
"mips64",
"mips64le",
"mipsle":
return true
default:
return false
} </s> remove val, ok = json[key]
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/home/controlupdate.go |
"github.com/AdguardTeam/golibs/log"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices" | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghalg"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> )
<mask>
<mask> // TODO(a.garipov): Make configurable.
<mask> const versionCheckPeriod = 8 * time.Hour
<mask>
<mask> // VersionInfo contains information about a new version.
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove const MaxPackageFileSize = 32 * 1024 * 1024
</s> add const MaxPackageFileSize = 32 * 10 * 1024 </s> remove // downloadURL returns the download URL for current build.
func (u *Updater) downloadURL(json map[string]string) (string, bool) {
var key string
</s> add // downloadURL returns the download URL for current build as well as its key in
// versionObj. If the key is not found, it additionally prints an informative
// log message.
func (u *Updater) downloadURL(versionObj map[string]string) (dlURL, key string, ok bool) { </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", u.updateDir, u.workDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", u.updateDir, u.workDir, err) </s> remove return val, true
</s> add keys := maps.Keys(versionObj)
slices.Sort(keys)
log.Error("updater: key %q not found; got keys %q", key, keys)
return "", key, false
}
// isMIPS returns true if arch is any MIPS architecture.
func isMIPS(arch string) (ok bool) {
switch arch {
case
"mips",
"mips64",
"mips64le",
"mipsle":
return true
default:
return false
} </s> remove packageURL, ok := u.downloadURL(versionJSON)
if !ok {
return info, fmt.Errorf("version.json: packageURL not found")
</s> add packageURL, key, found := u.downloadURL(versionJSON)
if !found {
return info, fmt.Errorf("version.json: no package URL: key %q not found in object", key) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
for k, v := range versionJSON { | <mask> if err != nil {
<mask> return info, fmt.Errorf("version.json: %w", err)
<mask> }
<mask>
<mask> for _, v := range versionJSON {
<mask> if v == "" {
<mask> return info, fmt.Errorf("version.json: invalid data")
<mask> }
<mask> }
<mask>
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove return info, fmt.Errorf("version.json: invalid data")
</s> add return info, fmt.Errorf("version.json: bad data: value for key %q is empty", k) </s> remove packageURL, ok := u.downloadURL(versionJSON)
if !ok {
return info, fmt.Errorf("version.json: packageURL not found")
</s> add packageURL, key, found := u.downloadURL(versionJSON)
if !found {
return info, fmt.Errorf("version.json: no package URL: key %q not found in object", key) </s> remove return fmt.Errorf("getting version info from %s: %s", vcu, err)
</s> add return fmt.Errorf("getting version info from %s: %w", vcu, err) </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", wd, u.backupDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", wd, u.backupDir, err) </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", u.updateDir, u.workDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", u.updateDir, u.workDir, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
return info, fmt.Errorf("version.json: bad data: value for key %q is empty", k) | <mask> }
<mask>
<mask> for _, v := range versionJSON {
<mask> if v == "" {
<mask> return info, fmt.Errorf("version.json: invalid data")
<mask> }
<mask> }
<mask>
<mask> info.NewVersion = versionJSON["version"]
<mask> info.Announcement = versionJSON["announcement"]
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove for _, v := range versionJSON {
</s> add for k, v := range versionJSON { </s> remove packageURL, ok := u.downloadURL(versionJSON)
if !ok {
return info, fmt.Errorf("version.json: packageURL not found")
</s> add packageURL, key, found := u.downloadURL(versionJSON)
if !found {
return info, fmt.Errorf("version.json: no package URL: key %q not found in object", key) </s> remove }
val, ok := json[key]
if !ok {
</s> add } else { </s> remove } else if u.goarch == "mips" && u.gomips != "" {
</s> add } else if isMIPS(u.goarch) && u.gomips != "" { </s> remove // downloadURL returns the download URL for current build.
func (u *Updater) downloadURL(json map[string]string) (string, bool) {
var key string
</s> add // downloadURL returns the download URL for current build as well as its key in
// versionObj. If the key is not found, it additionally prints an informative
// log message.
func (u *Updater) downloadURL(versionObj map[string]string) (dlURL, key string, ok bool) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
packageURL, key, found := u.downloadURL(versionJSON)
if !found {
return info, fmt.Errorf("version.json: no package URL: key %q not found in object", key) | <mask> info.NewVersion = versionJSON["version"]
<mask> info.Announcement = versionJSON["announcement"]
<mask> info.AnnouncementURL = versionJSON["announcement_url"]
<mask>
<mask> packageURL, ok := u.downloadURL(versionJSON)
<mask> if !ok {
<mask> return info, fmt.Errorf("version.json: packageURL not found")
<mask> }
<mask>
<mask> info.CanAutoUpdate = aghalg.BoolToNullBool(info.NewVersion != u.version)
<mask>
<mask> u.newVersion = info.NewVersion
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove return info, fmt.Errorf("version.json: invalid data")
</s> add return info, fmt.Errorf("version.json: bad data: value for key %q is empty", k) </s> remove val, ok = json[key]
</s> add </s> remove }
val, ok := json[key]
if !ok {
</s> add } else { </s> remove if !ok {
return "", false
</s> add dlURL, ok = versionObj[key]
if ok {
return dlURL, key, true </s> remove for _, v := range versionJSON {
</s> add for k, v := range versionJSON { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
// downloadURL returns the download URL for current build as well as its key in
// versionObj. If the key is not found, it additionally prints an informative
// log message.
func (u *Updater) downloadURL(versionObj map[string]string) (dlURL, key string, ok bool) { | <mask>
<mask> return info, nil
<mask> }
<mask>
<mask> // downloadURL returns the download URL for current build.
<mask> func (u *Updater) downloadURL(json map[string]string) (string, bool) {
<mask> var key string
<mask>
<mask> if u.goarch == "arm" && u.goarm != "" {
<mask> key = fmt.Sprintf("download_%s_%sv%s", u.goos, u.goarch, u.goarm)
<mask> } else if u.goarch == "mips" && u.gomips != "" {
<mask> key = fmt.Sprintf("download_%s_%s_%s", u.goos, u.goarch, u.gomips)
<mask> }
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove } else if u.goarch == "mips" && u.gomips != "" {
</s> add } else if isMIPS(u.goarch) && u.gomips != "" { </s> remove }
val, ok := json[key]
if !ok {
</s> add } else { </s> remove return info, fmt.Errorf("version.json: invalid data")
</s> add return info, fmt.Errorf("version.json: bad data: value for key %q is empty", k) </s> remove for _, v := range versionJSON {
</s> add for k, v := range versionJSON { </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", u.updateDir, u.workDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", u.updateDir, u.workDir, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
} else if isMIPS(u.goarch) && u.gomips != "" { | <mask> var key string
<mask>
<mask> if u.goarch == "arm" && u.goarm != "" {
<mask> key = fmt.Sprintf("download_%s_%sv%s", u.goos, u.goarch, u.goarm)
<mask> } else if u.goarch == "mips" && u.gomips != "" {
<mask> key = fmt.Sprintf("download_%s_%s_%s", u.goos, u.goarch, u.gomips)
<mask> }
<mask>
<mask> val, ok := json[key]
<mask> if !ok {
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove }
val, ok := json[key]
if !ok {
</s> add } else { </s> remove // downloadURL returns the download URL for current build.
func (u *Updater) downloadURL(json map[string]string) (string, bool) {
var key string
</s> add // downloadURL returns the download URL for current build as well as its key in
// versionObj. If the key is not found, it additionally prints an informative
// log message.
func (u *Updater) downloadURL(versionObj map[string]string) (dlURL, key string, ok bool) { </s> remove val, ok = json[key]
</s> add </s> remove if !ok {
return "", false
</s> add dlURL, ok = versionObj[key]
if ok {
return dlURL, key, true </s> remove return info, fmt.Errorf("version.json: invalid data")
</s> add return info, fmt.Errorf("version.json: bad data: value for key %q is empty", k) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
} else { | <mask> if u.goarch == "arm" && u.goarm != "" {
<mask> key = fmt.Sprintf("download_%s_%sv%s", u.goos, u.goarch, u.goarm)
<mask> } else if u.goarch == "mips" && u.gomips != "" {
<mask> key = fmt.Sprintf("download_%s_%s_%s", u.goos, u.goarch, u.gomips)
<mask> }
<mask>
<mask> val, ok := json[key]
<mask> if !ok {
<mask> key = fmt.Sprintf("download_%s_%s", u.goos, u.goarch)
<mask> val, ok = json[key]
<mask> }
<mask>
<mask> if !ok {
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove } else if u.goarch == "mips" && u.gomips != "" {
</s> add } else if isMIPS(u.goarch) && u.gomips != "" { </s> remove // downloadURL returns the download URL for current build.
func (u *Updater) downloadURL(json map[string]string) (string, bool) {
var key string
</s> add // downloadURL returns the download URL for current build as well as its key in
// versionObj. If the key is not found, it additionally prints an informative
// log message.
func (u *Updater) downloadURL(versionObj map[string]string) (dlURL, key string, ok bool) { </s> remove val, ok = json[key]
</s> add </s> remove if !ok {
return "", false
</s> add dlURL, ok = versionObj[key]
if ok {
return dlURL, key, true </s> remove return info, fmt.Errorf("version.json: invalid data")
</s> add return info, fmt.Errorf("version.json: bad data: value for key %q is empty", k) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
<mask>
<mask> val, ok := json[key]
<mask> if !ok {
<mask> key = fmt.Sprintf("download_%s_%s", u.goos, u.goarch)
<mask> val, ok = json[key]
<mask> }
<mask>
<mask> if !ok {
<mask> return "", false
<mask> }
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove if !ok {
return "", false
</s> add dlURL, ok = versionObj[key]
if ok {
return dlURL, key, true </s> remove }
val, ok := json[key]
if !ok {
</s> add } else { </s> remove } else if u.goarch == "mips" && u.gomips != "" {
</s> add } else if isMIPS(u.goarch) && u.gomips != "" { </s> remove return val, true
</s> add keys := maps.Keys(versionObj)
slices.Sort(keys)
log.Error("updater: key %q not found; got keys %q", key, keys)
return "", key, false
}
// isMIPS returns true if arch is any MIPS architecture.
func isMIPS(arch string) (ok bool) {
switch arch {
case
"mips",
"mips64",
"mips64le",
"mipsle":
return true
default:
return false
} </s> remove packageURL, ok := u.downloadURL(versionJSON)
if !ok {
return info, fmt.Errorf("version.json: packageURL not found")
</s> add packageURL, key, found := u.downloadURL(versionJSON)
if !found {
return info, fmt.Errorf("version.json: no package URL: key %q not found in object", key) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go | |
dlURL, ok = versionObj[key]
if ok {
return dlURL, key, true | <mask> key = fmt.Sprintf("download_%s_%s", u.goos, u.goarch)
<mask> val, ok = json[key]
<mask> }
<mask>
<mask> if !ok {
<mask> return "", false
<mask> }
<mask>
<mask> return val, true
<mask> }
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove val, ok = json[key]
</s> add </s> remove return val, true
</s> add keys := maps.Keys(versionObj)
slices.Sort(keys)
log.Error("updater: key %q not found; got keys %q", key, keys)
return "", key, false
}
// isMIPS returns true if arch is any MIPS architecture.
func isMIPS(arch string) (ok bool) {
switch arch {
case
"mips",
"mips64",
"mips64le",
"mipsle":
return true
default:
return false
} </s> remove }
val, ok := json[key]
if !ok {
</s> add } else { </s> remove } else if u.goarch == "mips" && u.gomips != "" {
</s> add } else if isMIPS(u.goarch) && u.gomips != "" { </s> remove return info, fmt.Errorf("version.json: invalid data")
</s> add return info, fmt.Errorf("version.json: bad data: value for key %q is empty", k) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
keys := maps.Keys(versionObj)
slices.Sort(keys)
log.Error("updater: key %q not found; got keys %q", key, keys)
return "", key, false
}
// isMIPS returns true if arch is any MIPS architecture.
func isMIPS(arch string) (ok bool) {
switch arch {
case
"mips",
"mips64",
"mips64le",
"mipsle":
return true
default:
return false
} | <mask> if !ok {
<mask> return "", false
<mask> }
<mask>
<mask> return val, true
<mask> }
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove if !ok {
return "", false
</s> add dlURL, ok = versionObj[key]
if ok {
return dlURL, key, true </s> remove val, ok = json[key]
</s> add </s> remove for _, v := range versionJSON {
</s> add for k, v := range versionJSON { </s> remove }
val, ok := json[key]
if !ok {
</s> add } else { </s> remove return fmt.Errorf("getting version info from %s: %s", vcu, err)
</s> add return fmt.Errorf("getting version info from %s: %w", vcu, err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/check.go |
return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", wd, u.backupDir, err) | <mask>
<mask> wd := u.workDir
<mask> err = copySupportingFiles(u.unpackedFiles, wd, u.backupDir)
<mask> if err != nil {
<mask> return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", wd, u.backupDir, err)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", u.updateDir, u.workDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", u.updateDir, u.workDir, err) </s> remove return fmt.Errorf("getting version info from %s: %s", vcu, err)
</s> add return fmt.Errorf("getting version info from %s: %w", vcu, err) </s> remove for _, v := range versionJSON {
</s> add for k, v := range versionJSON { </s> remove val, ok = json[key]
</s> add </s> remove if !ok {
return "", false
</s> add dlURL, ok = versionObj[key]
if ok {
return dlURL, key, true | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/updater.go |
return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", u.updateDir, u.workDir, err) | <mask> // supporting files.
<mask> func (u *Updater) replace() error {
<mask> err := copySupportingFiles(u.unpackedFiles, u.updateDir, u.workDir)
<mask> if err != nil {
<mask> return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", u.updateDir, u.workDir, err)
<mask> }
<mask>
<mask> log.Debug("updater: renaming: %s to %s", u.currentExeName, u.backupExeName)
<mask> err = os.Rename(u.currentExeName, u.backupExeName)
<mask> if err != nil {
</s> Pull request 1752: 5373-mips-autoupdate
Updates #5270.
Updates #5373.
Squashed commit of the following:
commit ad4654fa63beac13c4fbb38aa8fd06eaec25cb5e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 17:00:28 2023 +0300
updater: imp docs
commit c3482766df6b831eae529e209ea7fa0a87f1b417
Merge: 1cbee78b 386add03
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 16:59:13 2023 +0300
Merge branch 'master' into 5373-mips-autoupdate
commit 1cbee78b94914c7d72c837cd2fad96a50ac2c30a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Mon Feb 27 11:57:28 2023 +0300
all: fix autoupdate on mips* </s> remove return fmt.Errorf("copySupportingFiles(%s, %s) failed: %s", wd, u.backupDir, err)
</s> add return fmt.Errorf("copySupportingFiles(%s, %s) failed: %w", wd, u.backupDir, err) </s> remove return fmt.Errorf("getting version info from %s: %s", vcu, err)
</s> add return fmt.Errorf("getting version info from %s: %w", vcu, err) </s> remove for _, v := range versionJSON {
</s> add for k, v := range versionJSON { </s> remove // downloadURL returns the download URL for current build.
func (u *Updater) downloadURL(json map[string]string) (string, bool) {
var key string
</s> add // downloadURL returns the download URL for current build as well as its key in
// versionObj. If the key is not found, it additionally prints an informative
// log message.
func (u *Updater) downloadURL(versionObj map[string]string) (dlURL, key string, ok bool) { </s> remove const MaxPackageFileSize = 32 * 1024 * 1024
</s> add const MaxPackageFileSize = 32 * 10 * 1024 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/bb80a7c2159c25189ec9940f20c4436a86e81968 | internal/updater/updater.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.