1 parent
8c4d463f1e
commit
de13d851a8
75 files changed
+4656
-442
No files matched your search
+55
-42
@@ -6,13 +6,13 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.linuxiarz.pl/gru/EasyDNS-Web/internal/config"
|
||||
"git.linuxiarz.pl/gru/EasyDNS-Web/internal/easydns"
|
||||
"git.linuxiarz.pl/gru/EasyDNS-Web/internal/multiserver"
|
||||
"git.linuxiarz.pl/gru/EasyDNS-Web/internal/telemetry"
|
||||
)
|
||||
|
||||
@@ -20,53 +20,73 @@ import (
|
||||
var assets embed.FS
|
||||
|
||||
type PageData struct {
|
||||
Status easydns.Status
|
||||
Health easydns.Health
|
||||
Stats easydns.Stats
|
||||
Cache easydns.Cache
|
||||
Zone easydns.Zone
|
||||
Zones []easydns.Zone
|
||||
Records []easydns.Record
|
||||
Record easydns.Record
|
||||
Pagination easydns.Pagination
|
||||
Transfers []easydns.Transfer
|
||||
Upstreams []easydns.UpstreamGroup
|
||||
Policies easydns.Policies
|
||||
Blocklists easydns.Blocklists
|
||||
Audit []easydns.AuditItem
|
||||
Query *easydns.QueryResult
|
||||
Form map[string]string
|
||||
Filter map[string]string
|
||||
ETag string
|
||||
ZoneURL string
|
||||
IsPrimary bool
|
||||
Error string
|
||||
Success string
|
||||
Action string
|
||||
Tab string
|
||||
FieldErrors map[string]string
|
||||
SamplingCount int
|
||||
SamplingTime time.Time
|
||||
SamplingError string
|
||||
LastRate string
|
||||
Status easydns.Status
|
||||
Health easydns.Health
|
||||
Stats easydns.Stats
|
||||
Cache easydns.Cache
|
||||
Zone easydns.Zone
|
||||
Zones []easydns.Zone
|
||||
Records []easydns.Record
|
||||
Record easydns.Record
|
||||
Pagination easydns.Pagination
|
||||
Transfers []easydns.Transfer
|
||||
Upstreams []easydns.UpstreamGroup
|
||||
Policies easydns.Policies
|
||||
Blocklists easydns.Blocklists
|
||||
Audit []easydns.AuditItem
|
||||
Query *easydns.QueryResult
|
||||
Form map[string]string
|
||||
Filter map[string]string
|
||||
ETag string
|
||||
ZoneURL string
|
||||
IsPrimary bool
|
||||
Error string
|
||||
Success string
|
||||
Action string
|
||||
Tab string
|
||||
FieldErrors map[string]string
|
||||
SamplingCount int
|
||||
SamplingTime time.Time
|
||||
SamplingError string
|
||||
LastRate string
|
||||
ServerProbes []multiserver.Probe
|
||||
Comparisons []multiserver.Comparison
|
||||
ManagedNode multiserver.Node
|
||||
CompareZone string
|
||||
PrimarySerial string
|
||||
ServerHealthy int
|
||||
MetricsMode string
|
||||
MetricNodes []FleetMetricsNode
|
||||
MetricTotals easydns.Stats
|
||||
MetricOnline int
|
||||
MetricTotal int
|
||||
MetricHasCache bool
|
||||
}
|
||||
type PageView struct {
|
||||
Title, Subtitle, Page, Active, Breadcrumb, User, CSRF, Message, MessageType string
|
||||
Data PageData
|
||||
Body template.HTML
|
||||
BuildVersion string
|
||||
MultiServer bool
|
||||
CanEditMultiServer, LocalRoleConfigured bool
|
||||
Nodes []multiserver.Node
|
||||
SelectedNode multiserver.Node
|
||||
CurrentPath string
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
cfg config.Config
|
||||
api *easydns.Client
|
||||
telemetry *telemetry.History
|
||||
auth *auth
|
||||
templates map[string]*template.Template
|
||||
cfg config.Config
|
||||
api *easydns.Client
|
||||
telemetry *telemetry.History
|
||||
auth *auth
|
||||
templates map[string]*template.Template
|
||||
nodes *multiserver.Registry
|
||||
selectedNode multiserver.Node
|
||||
}
|
||||
|
||||
func funcs() template.FuncMap {
|
||||
return template.FuncMap{
|
||||
"asset": assetURL,
|
||||
"recordTypes": func() []string {
|
||||
return []string{"A", "AAAA", "CNAME", "MX", "TXT", "NS", "PTR", "SRV", "CAA", "DS", "DNSKEY", "TLSA", "SSHFP", "NAPTR"}
|
||||
},
|
||||
@@ -197,10 +217,3 @@ func loadTemplates() (map[string]*template.Template, error) {
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
func staticHandler() http.Handler {
|
||||
sub, err := fs.Sub(assets, "web/static")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return http.FileServer(http.FS(sub))
|
||||
}
|
||||
Reference in new issue
Block a user