mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Merge pull request #1270 from safing/fix/default-query-db
Do not query the history database by default
This commit is contained in:
commit
4a6eea4a7f
3 changed files with 4 additions and 7 deletions
|
@ -2,8 +2,6 @@ package netquery
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
|
||||||
"encoding/hex"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
@ -268,7 +266,5 @@ func convertConnection(conn *network.Connection) (*Conn, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func genConnID(conn *network.Connection) string {
|
func genConnID(conn *network.Connection) string {
|
||||||
data := conn.ID + "-" + conn.Process().GetID()
|
return conn.ID + "-" + conn.Process().GetID()
|
||||||
hash := sha256.Sum256([]byte(data))
|
|
||||||
return hex.EncodeToString(hash[:])
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,8 @@ func (m *module) prepare() error {
|
||||||
if err := api.RegisterEndpoint(api.Endpoint{
|
if err := api.RegisterEndpoint(api.Endpoint{
|
||||||
Path: "netquery/history/clear",
|
Path: "netquery/history/clear",
|
||||||
MimeType: "application/json",
|
MimeType: "application/json",
|
||||||
Read: api.PermitUser,
|
|
||||||
Write: api.PermitUser,
|
Write: api.PermitUser,
|
||||||
|
Read: api.PermitUser,
|
||||||
BelongsTo: m.Module,
|
BelongsTo: m.Module,
|
||||||
HandlerFunc: func(w http.ResponseWriter, r *http.Request) {
|
HandlerFunc: func(w http.ResponseWriter, r *http.Request) {
|
||||||
var body struct {
|
var body struct {
|
||||||
|
|
|
@ -189,8 +189,9 @@ func (req *QueryRequestPayload) generateSQL(ctx context.Context, schema *orm.Tab
|
||||||
whereClause = "WHERE " + whereClause
|
whereClause = "WHERE " + whereClause
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if no database is specified we default to LiveDatabase only.
|
||||||
if len(req.Databases) == 0 {
|
if len(req.Databases) == 0 {
|
||||||
req.Databases = []DatabaseName{LiveDatabase, HistoryDatabase}
|
req.Databases = []DatabaseName{LiveDatabase}
|
||||||
}
|
}
|
||||||
|
|
||||||
sources := make([]string, len(req.Databases))
|
sources := make([]string, len(req.Databases))
|
||||||
|
|
Loading…
Add table
Reference in a new issue