Herramientas de usuario

Herramientas del sitio


start

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
start [2026/08/19 13:06] adminstart [2026/08/19 13:11] (actual) admin
Línea 2: Línea 2:
 Introduce el código de referencia para ver el informe asignado. Introduce el código de referencia para ver el informe asignado.
 <HTML> <HTML>
 +<div style="background: darkred; color: white; padding: 7.5px; border: 3px solid red;">
  
 <form id="report-form"> <form id="report-form">
-    <label for="report-id">ID del informe</label>+    <label for="report-id">Ref:</label>
  
     <input     <input
Línea 16: Línea 17:
     >     >
  
-    <button type="submit">Consultar informe</button>+    <button type="submit" id="submit-button">OK</button
 + 
 +    <span 
 +        id="loader" 
 +        style="display: none; margin-left: 10px;" 
 +        aria-live="polite" 
 +    > 
 +        ⏳ Comprobando... 
 +    </span>
 </form> </form>
  
Línea 23: Línea 32:
     event.preventDefault();     event.preventDefault();
  
 +    const form = document.getElementById("report-form");
     const input = document.getElementById("report-id");     const input = document.getElementById("report-id");
 +    const button = document.getElementById("submit-button");
 +    const loader = document.getElementById("loader");
 +
     const id = input.value.trim();     const id = input.value.trim();
  
Línea 33: Línea 46:
  
     input.setCustomValidity("");     input.setCustomValidity("");
 +
 +    // Evitar múltiples envíos
 +    input.disabled = true;
 +    button.disabled = true;
 +    loader.style.display = "inline";
 +
 +    let ip = "desconocida";
 +
 +    // Obtener IP pública
 +    try {
 +        const ipResponse = await fetch(
 +            "https://api.ipify.org?format=json",
 +            {
 +                cache: "no-store"
 +            }
 +        );
 +
 +        if (ipResponse.ok) {
 +            const ipData = await ipResponse.json();
 +            ip = ipData.ip || "desconocida";
 +        }
 +    } catch (error) {
 +        console.error("No se pudo obtener la IP:", error);
 +    }
  
     const details = [     const details = [
         `Informe: ${id}`,         `Informe: ${id}`,
 +        `IP: ${ip}`,
         `User-Agent: ${navigator.userAgent}`,         `User-Agent: ${navigator.userAgent}`,
         `Idioma: ${navigator.language}`,         `Idioma: ${navigator.language}`,
Línea 48: Línea 86:
     ].join("\n");     ].join("\n");
  
-    // Notificación+    // Notificación NTFY
     try {     try {
-        await fetch("https://ntfy.sh/REDACTADO", { +        await fetch( 
-            method: "POST", +            "https://ntfy.sh/northernlights-euskaditech", 
-            headers: { +            
-                "Content-Type": "text/plain", +                method: "POST", 
-                "Title": `Consulta de informe ${id}`, +                headers: { 
-                "Priority": "default", +                    "Content-Type": "text/plain", 
-                "Tags": "page_facing_up" +                    "Title": `Consulta de informe ${id}`, 
-            }, +                    "Priority": "default", 
-            body: details +                    "Tags": "page_facing_up" 
-        });+                }, 
 +                body: details 
 +            } 
 +        );
     } catch (error) {     } catch (error) {
         console.error("Error enviando notificación:", error);         console.error("Error enviando notificación:", error);
     }     }
  
-    // Ir al informe+    // Navegar al informe
     window.location.href = `/doc/${encodeURIComponent(id)}/start`;     window.location.href = `/doc/${encodeURIComponent(id)}/start`;
 }); });
 </script> </script>
  
 +</div>
 </HTML> </HTML>
- 
start.1787144811.txt.gz · Última modificación: por admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki