diff --git a/server/api.go b/server/api.go index 446e6c4..21af9c1 100644 --- a/server/api.go +++ b/server/api.go @@ -27,6 +27,8 @@ type AccessReport struct { UserAgent string `redis:"UserAgent" json:"user_agent"` DeployTime string `redis:"DeployTime" json:"deploy_time"` Target string `redis:"Target" json:"target"` + Time int `redis:"Time" json:"time"` + Confirmed int `redis:"Confirmed" json:"confirmed"` } func Wrap(h func(w http.ResponseWriter, r *http.Request) (int, error)) http.HandlerFunc { diff --git a/server/api_v1.go b/server/api_v1.go index 4d6a38c..83c3a3f 100644 --- a/server/api_v1.go +++ b/server/api_v1.go @@ -25,6 +25,8 @@ func V1GetApi(e *ApiEnv) map[string]http.HandlerFunc { userAgent = wrap.String("user_agent", "") deployTime = wrap.StringRequired("deploy_time") target = wrap.StringRequired("target") + time = wrap.Int("time", 0) + confirmed = wrap.Int("confirmed", 0) ) err = wrap.Parse() if err != nil { @@ -42,6 +44,8 @@ func V1GetApi(e *ApiEnv) map[string]http.HandlerFunc { UserAgent: *userAgent, DeployTime: *deployTime, Target: *target, + Time: *time, + Confirmed: *confirmed, }) if err != nil { return http.StatusInternalServerError, err diff --git a/server/db.go b/server/db.go index 5d80326..12bfccf 100644 --- a/server/db.go +++ b/server/db.go @@ -92,7 +92,7 @@ func (db *Database) CountAll(ctx context.Context, userAgentFilter []string) erro break } } - if isFiltered { + if report.Confirmed == 0 || isFiltered { continue }