update security
This commit is contained in:
@@ -100,6 +100,7 @@ type pageData struct {
|
||||
AuditEventTypes []string
|
||||
Packages []packageRecord
|
||||
Actions []actionRecord
|
||||
FleetHosts []fleetHostRecord
|
||||
NewCode string
|
||||
DefaultHostLimit int
|
||||
DefaultDuration string
|
||||
@@ -175,6 +176,11 @@ func parseTemplates(displayTimeZone *time.Location) (*template.Template, error)
|
||||
"isActive": func(record authorizationRecord) bool {
|
||||
return !record.RevokedAt.Valid && time.Now().Before(record.ExpiresAt)
|
||||
},
|
||||
"isStale": func(value time.Time) bool {
|
||||
return value.Before(time.Now().Add(-30 * 24 * time.Hour))
|
||||
},
|
||||
"shortInstallationID": shortInstallationID,
|
||||
"shortCommit": shortCommit,
|
||||
}).ParseFS(webFiles, "templates/*.html")
|
||||
}
|
||||
|
||||
@@ -192,11 +198,14 @@ func (s *Server) Routes() http.Handler {
|
||||
mux.HandleFunc("GET /portal", s.requireTechnician(s.handlePortal))
|
||||
mux.HandleFunc("GET /portal/packages", s.requireTechnician(s.handlePackagesPortal))
|
||||
mux.HandleFunc("GET /portal/audit", s.requireTechnician(s.handleAuditPortal))
|
||||
mux.HandleFunc("GET /portal/hosts", s.requireTechnician(s.handleFleetPortal))
|
||||
mux.HandleFunc("POST /portal/authorizations", s.requireTechnician(s.handleCreateAuthorization))
|
||||
mux.HandleFunc("POST /portal/authorizations/{id}/revoke", s.requireTechnician(s.handleRevokeAuthorization))
|
||||
mux.HandleFunc("POST /portal/packages", s.requireTechnician(s.handleUpsertPackage))
|
||||
mux.HandleFunc("POST /portal/packages/upload", s.requireTechnician(s.handleUploadPackage))
|
||||
mux.HandleFunc("POST /api/v1/exchange", s.handleExchange)
|
||||
mux.HandleFunc("POST /api/v1/hosts/register", s.handleFleetRegister)
|
||||
mux.HandleFunc("POST /api/v1/hosts/events", s.handleFleetEvent)
|
||||
mux.HandleFunc("GET /api/v1/packages/{slug}", s.handlePackageDownload)
|
||||
mux.HandleFunc("GET /", s.handleHome)
|
||||
mux.Handle("GET /static/", http.FileServerFS(webFiles))
|
||||
|
||||
Reference in New Issue
Block a user