From 307829f6f058080c75194c88735ea2c0126ba857 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Mon, 11 May 2026 22:19:01 -0500 Subject: [PATCH] Update cloudflare.html --- resources/views/cloudflare.html | 110 +++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/resources/views/cloudflare.html b/resources/views/cloudflare.html index 118582c..16ce6b3 100644 --- a/resources/views/cloudflare.html +++ b/resources/views/cloudflare.html @@ -13,6 +13,15 @@

Cloudflare API

Conexión con tu cuenta de Cloudflare para visualizar zonas, DNS, SSL y reglas de firewall.

+
+ +
@@ -202,6 +212,86 @@ + +
+
+
+

Diagnóstico del Token

+ +
+
+ +
+ + + + + Consultando Cloudflare API… +
+ + + +
+
+
+ + +
+
+
+
@@ -267,6 +357,10 @@ document.addEventListener('alpine:init', () => { fwRules: [], selectedZoneId: '', configModal: false, + diagnosModal: false, + diagnosLoading: false, + diagnosData: null, + diagnosError: '', cfgForm: { id: 0, api_token: '', account_id: '', nota: '' }, toast: { show: false, msg: '', type: 'ok' }, @@ -336,7 +430,7 @@ document.addEventListener('alpine:init', () => { this.loading = true; try { const res = await axios.get('/app/cloudflare/verify'); - const status = res.data?.data?.status || 'active'; + const status = res.data?.data?.status || res.data?.token_status || 'active'; this.showToast('Token válido — estado: ' + status); } catch (e) { this.showToast(e.response?.data?.error || 'Token inválido o sin permisos', 'error'); @@ -344,6 +438,20 @@ document.addEventListener('alpine:init', () => { this.loading = false; }, + async diagnosToken() { + this.diagnosLoading = true; + this.diagnosData = null; + this.diagnosError = ''; + try { + const res = await axios.get('/app/cloudflare/verify'); + this.diagnosData = res.data; + } catch (e) { + this.diagnosError = e.response?.data?.error || e.message || 'Error al consultar'; + this.diagnosData = e.response?.data || null; + } + this.diagnosLoading = false; + }, + showToast(msg, type = 'ok') { this.toast = { show: true, msg, type }; setTimeout(() => this.toast.show = false, 3500);