From 848cb1fcf59b52f982ab7bbfe9473c141fe905e7 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 12 May 2026 11:11:45 -0500 Subject: [PATCH] up --- pkg/services/cloudflare_service.go | 35 ++++- resources/views/cloudflare.html | 181 +++++++++++++++++++++- rest/controllers/cloudflare_controller.go | 32 +++- 3 files changed, 231 insertions(+), 17 deletions(-) diff --git a/pkg/services/cloudflare_service.go b/pkg/services/cloudflare_service.go index ac07768..feb6808 100644 --- a/pkg/services/cloudflare_service.go +++ b/pkg/services/cloudflare_service.go @@ -180,14 +180,21 @@ type CFDNSRecord struct { TagsModifiedOn string `json:"tags_modified_on,omitempty"` } -// CFSSLStatus representa el estado SSL de una zona. +// CFSSLStatus representa un certificate pack de una zona. type CFSSLStatus struct { - ID string `json:"id"` - Type string `json:"type"` - Status string `json:"status"` - Hosts []string `json:"hosts"` - PrimaryCert string `json:"primary_certificate"` - ExpiresOn string `json:"expires_on"` + ID string `json:"id"` + Type string `json:"type"` // universal, advanced, custom, sni_custom + Hosts []string `json:"hosts"` + Status string `json:"status"` // active, pending_validation, deleted + ValidationMethod string `json:"validation_method,omitempty"` + ValidityDays int `json:"validity_days,omitempty"` + CertificateAuthority string `json:"certificate_authority,omitempty"` + Wildcard bool `json:"wildcard,omitempty"` +} + +// CFUniversalSSL representa la configuración de Universal SSL de una zona. +type CFUniversalSSL struct { + Enabled bool `json:"enabled"` } // CFFirewallRule representa una regla de firewall (Access Rules). @@ -375,15 +382,27 @@ func (c *CloudflareClient) GetDNSRecords(zoneID string) ([]CFDNSRecord, error) { } // GetSSLCertificates devuelve los certificate packs de una zona. +// Incluye ?status=all para ver packs en cualquier estado (requerido en planes Free). func (c *CloudflareClient) GetSSLCertificates(zoneID string) ([]CFSSLStatus, error) { var certs []CFSSLStatus - path := fmt.Sprintf("/zones/%s/ssl/certificate_packs", zoneID) + path := fmt.Sprintf("/zones/%s/ssl/certificate_packs?status=all", zoneID) if err := c.get(path, &certs); err != nil { return nil, err } return certs, nil } +// GetUniversalSSLSettings devuelve si el Universal SSL está activo en la zona. +// Funciona en todos los planes. Útil como fallback cuando certificate_packs no está disponible. +func (c *CloudflareClient) GetUniversalSSLSettings(zoneID string) (*CFUniversalSSL, error) { + var result CFUniversalSSL + path := fmt.Sprintf("/zones/%s/ssl/universal/settings", zoneID) + if err := c.get(path, &result); err != nil { + return nil, err + } + return &result, nil +} + // GetFirewallRules devuelve las reglas de acceso IP de una zona. func (c *CloudflareClient) GetFirewallRules(zoneID string) ([]CFFirewallRule, error) { var rules []CFFirewallRule diff --git a/resources/views/cloudflare.html b/resources/views/cloudflare.html index 8f6c778..6c35553 100644 --- a/resources/views/cloudflare.html +++ b/resources/views/cloudflare.html @@ -124,6 +124,19 @@
+ +
+ + +
Selecciona una zona y haz clic en "Cargar".
@@ -134,10 +147,11 @@ + -
Contenido Proxy TTLAcciones