mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-10-26 11:27:18 +00:00
Squashed commit of the following: commit 8ce89d6dab8031dadac7698e71a489edfffe29f8 Merge:7b0052d69b76d10040Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Oct 16 16:58:28 2025 +0300 Merge branch 'master' into ADG-10852-rewrites-enabled commit7b0052d695Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 15 18:09:34 2025 +0300 client: fix i18n commit6ac47b30bbAuthor: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Wed Oct 15 07:56:16 2025 +0300 fix eslint commit5e38412748Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Mon Oct 13 18:20:08 2025 +0300 add notify commitb7018efe07Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Mon Oct 13 18:06:35 2025 +0300 update ux commit89fa121be1Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Mon Oct 13 15:39:49 2025 +0300 update ux for rewrites page commit2ed3a128f2Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Fri Oct 10 16:11:06 2025 +0300 update frontend commitbb279f6b2eMerge:8ddc0a7af497441d59Author: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Fri Oct 10 14:01:57 2025 +0300 merge commit8ddc0a7afbAuthor: Eugene Miroshkin <e.miroshkin@adguard.com> Date: Fri Oct 10 14:01:37 2025 +0300 add rewrites toggle commit497441d595Merge:50a76760d2f810068aAuthor: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Oct 9 18:44:18 2025 +0300 Merge branch 'master' into ADG-10852-rewrites-enabled commit50a76760dbAuthor: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Oct 9 18:25:52 2025 +0300 filtering: fix config write commitf1bf45aa42Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Oct 3 14:21:53 2025 +0300 all: rewrites enabled
44 lines
775 B
Go
44 lines
775 B
Go
package configmigrate
|
|
|
|
import "context"
|
|
|
|
// migrateTo31 performs the following changes:
|
|
//
|
|
// # BEFORE:
|
|
// 'filtering':
|
|
// 'rewrites':
|
|
// - 'domain': test.example
|
|
// 'answer': 192.0.2.0
|
|
// # …
|
|
// # …
|
|
//
|
|
// # AFTER:
|
|
// 'filtering':
|
|
// 'rewrites':
|
|
// - 'domain': test.example
|
|
// 'answer': 192.0.2.0
|
|
// 'enabled': true
|
|
// # …
|
|
// # …
|
|
func (m *Migrator) migrateTo31(_ context.Context, diskConf yobj) (err error) {
|
|
diskConf["schema_version"] = 31
|
|
|
|
fltConf, ok, err := fieldVal[yobj](diskConf, "filtering")
|
|
if !ok {
|
|
return err
|
|
}
|
|
|
|
rewrites, ok, err := fieldVal[yarr](fltConf, "rewrites")
|
|
if !ok {
|
|
return err
|
|
}
|
|
|
|
for i := range rewrites {
|
|
if r, isYobj := rewrites[i].(yobj); isYobj {
|
|
r["enabled"] = true
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|