e97780ad38
Prevent accidental deletes with y/n confirmation dialog. Validate all numeric form inputs (interval, port, timeout, threshold, retries) with range checks instead of silently defaulting to zero. Escape user-supplied data in status page JavaScript to close XSS via monitor names. Persist check history to new check_history table so sparklines and uptime percentages survive restarts.
65 lines
1.2 KiB
Go
65 lines
1.2 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Site struct {
|
|
ID int
|
|
Name string
|
|
URL string
|
|
Type string // "http", "push", "ping", "port", "dns", "group"
|
|
Token string
|
|
Interval int
|
|
AlertID int
|
|
CheckSSL bool
|
|
ExpiryThreshold int
|
|
MaxRetries int
|
|
|
|
Hostname string
|
|
Port int
|
|
Timeout int
|
|
Method string
|
|
Description string
|
|
ParentID int
|
|
AcceptedCodes string
|
|
DNSResolveType string
|
|
DNSServer string
|
|
IgnoreTLS bool
|
|
Paused bool
|
|
|
|
FailureCount int
|
|
Status string
|
|
StatusCode int
|
|
Latency time.Duration
|
|
CertExpiry time.Time
|
|
HasSSL bool
|
|
LastCheck time.Time
|
|
SentSSLWarning bool
|
|
}
|
|
|
|
type AlertConfig struct {
|
|
ID int
|
|
Name string
|
|
Type string
|
|
Settings map[string]string
|
|
}
|
|
|
|
type User struct {
|
|
ID int
|
|
Username string
|
|
PublicKey string
|
|
Role string
|
|
}
|
|
|
|
type CheckRecord struct {
|
|
SiteID int
|
|
LatencyNs int64
|
|
IsUp bool
|
|
CheckedAt time.Time
|
|
}
|
|
|
|
type Backup struct {
|
|
Sites []Site `json:"sites"`
|
|
Alerts []AlertConfig `json:"alerts"`
|
|
Users []User `json:"users"`
|
|
}
|