mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-23 05:25:35 +03:00
+ querylog: preserve searching compatibility with the previous version
This commit is contained in:
parent
6ae0a0eb0b
commit
12f4ebc6a5
1 changed files with 38 additions and 1 deletions
|
@ -406,8 +406,26 @@ func (r *Reader) applySearch(str string) bool {
|
|||
}
|
||||
}
|
||||
|
||||
mq := dns.Msg{}
|
||||
|
||||
if len(r.search.Domain) != 0 {
|
||||
val := readJSONValue(str, "QH")
|
||||
if len(val) == 0 {
|
||||
// pre-v0.99.3 compatibility
|
||||
val = readJSONValue(str, "Question")
|
||||
if len(val) == 0 {
|
||||
return false
|
||||
}
|
||||
bval, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
err = mq.Unpack(bval)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
val = strings.TrimSuffix(mq.Question[0].Name, ".")
|
||||
}
|
||||
if len(val) == 0 {
|
||||
return false
|
||||
}
|
||||
|
@ -420,9 +438,28 @@ func (r *Reader) applySearch(str string) bool {
|
|||
|
||||
if len(r.search.QuestionType) != 0 {
|
||||
val := readJSONValue(str, "QT")
|
||||
if len(val) == 0 {
|
||||
// pre-v0.99.3 compatibility
|
||||
if len(mq.Question) == 0 {
|
||||
val = readJSONValue(str, "Question")
|
||||
if len(val) == 0 {
|
||||
return false
|
||||
}
|
||||
bval, err := base64.StdEncoding.DecodeString(val)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
err = mq.Unpack(bval)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
ok := false
|
||||
val, ok = dns.TypeToString[mq.Question[0].Qtype]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if val != r.search.QuestionType {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue