Files
Beszel/internal/migrations/3_enhance_domain_features.go
T
Tomas Dvorak fe5c7eaa95
Build Docker images / Hub (push) Failing after 1m35s
feat(hub,site): enhance domain intelligence and monitor performance
Implement comprehensive domain data collection including provider detection (DNS, hosting, email, CA), HTTP headers, TLS certificate chains, and SEO metadata. Added PageSpeed Insights integration for monitors to track Core Web Vitals.

- **hub**:
  - Add provider detection logic for DNS, email, and hosting.
  - Expand `Domain` entity to include SEO, headers, certificates, and enhanced registration details.
  - Implement automated collection of TLD, WHOIS raw data, and host country codes.
  - Update scheduler to track changes in providers and security settings (privacy/transfer lock).
  - Add PageSpeed check endpoint to monitor API.
- **site**:
  - Update domain table and detail views to display new intelligence (providers, headers, SEO).
  - Implement PageSpeed metrics visualization with Core Web Vitals status indicators.
  - Add display options for provider information in the domain list.
- **db**:
  - Add migration for new domain collection fields.
2026-05-14 13:33:03 +02:00

66 lines
1.6 KiB
Go

package migrations
import (
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
)
func init() {
m.Register(func(app core.App) error {
if err := enhanceDomainCollection(app); err != nil {
return err
}
return nil
}, func(app core.App) error {
return nil
})
}
func enhanceDomainCollection(app core.App) error {
collection, err := app.FindCollectionByNameOrId("domains")
if err != nil {
return err
}
// Provider detection fields
addTextField3(collection, "dns_provider")
addTextField3(collection, "hosting_provider")
addTextField3(collection, "email_provider")
addTextField3(collection, "ca_provider")
// JSON fields for complex data
addJSONField3(collection, "headers")
addJSONField3(collection, "certificates")
addJSONField3(collection, "seo_meta")
addJSONField3(collection, "domain_statuses")
// WHOIS and registration fields
addTextField3(collection, "whois_raw")
addBoolField3(collection, "privacy_enabled")
addBoolField3(collection, "transfer_lock")
addTextField3(collection, "tld")
// Enhanced geo
addTextField3(collection, "host_country_code")
return app.Save(collection)
}
func addTextField3(collection *core.Collection, name string) {
if collection.Fields.GetByName(name) == nil {
collection.Fields.Add(&core.TextField{Name: name})
}
}
func addBoolField3(collection *core.Collection, name string) {
if collection.Fields.GetByName(name) == nil {
collection.Fields.Add(&core.BoolField{Name: name})
}
}
func addJSONField3(collection *core.Collection, name string) {
if collection.Fields.GetByName(name) == nil {
collection.Fields.Add(&core.JSONField{Name: name})
}
}