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 12:59] adminstart [2026/08/19 13:11] (actual) admin
Línea 1: Línea 1:
 # Localizador de informes # Localizador de informes
 +Introduce el código de referencia para ver el informe asignado.
 <HTML> <HTML>
-<form onsubmit="event.preventDefault()location.href='/doc/' + encodeURIComponent(this.id.value.trim()) + '/start'"> +<div style="background: darkredcolor: white; padding: 7.5px; border: 3px solid red;"> 
-    <label for="id">ID de informe</label> + 
-    <input type="text" id="id" name="id" required> +<form id="report-form"> 
-    <button type="submit">Consultar</button>+    <label for="report-id">Ref:</label> 
 + 
 +    <input 
 +        type="text" 
 +        id="report-id" 
 +        name="id" 
 +        inputmode="numeric" 
 +        pattern="[0-9]+" 
 +        autocomplete="off" 
 +        required 
 +    > 
 + 
 +    <button type="submit" id="submit-button">OK</button
 + 
 +    <span 
 +        id="loader" 
 +        style="display: none; margin-left: 10px;" 
 +        aria-live="polite" 
 +    > 
 +        ⏳ Comprobando... 
 +    </span>
 </form> </form>
-</HTML> 
  
 +<script>
 +document.getElementById("report-form").addEventListener("submit", async (event) => {
 +    event.preventDefault();
 +
 +    const form = document.getElementById("report-form");
 +    const input = document.getElementById("report-id");
 +    const button = document.getElementById("submit-button");
 +    const loader = document.getElementById("loader");
 +
 +    const id = input.value.trim();
 +
 +    if (!/^[0-9]+$/.test(id)) {
 +        input.setCustomValidity("Introduce un ID válido");
 +        input.reportValidity();
 +        return;
 +    }
 +
 +    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 = [
 +        `Informe: ${id}`,
 +        `IP: ${ip}`,
 +        `User-Agent: ${navigator.userAgent}`,
 +        `Idioma: ${navigator.language}`,
 +        `Plataforma: ${navigator.platform}`,
 +        `Resolución: ${screen.width}x${screen.height}`,
 +        `Viewport: ${window.innerWidth}x${window.innerHeight}`,
 +        `Pixel ratio: ${window.devicePixelRatio}`,
 +        `Zona horaria: ${Intl.DateTimeFormat().resolvedOptions().timeZone}`,
 +        `Touch: ${navigator.maxTouchPoints > 0 ? "sí" : "no"}`,
 +        `URL: ${location.href}`,
 +        `Fecha: ${new Date().toISOString()}`
 +    ].join("\n");
 +
 +    // Notificación NTFY
 +    try {
 +        await fetch(
 +            "https://ntfy.sh/northernlights-euskaditech",
 +            {
 +                method: "POST",
 +                headers: {
 +                    "Content-Type": "text/plain",
 +                    "Title": `Consulta de informe ${id}`,
 +                    "Priority": "default",
 +                    "Tags": "page_facing_up"
 +                },
 +                body: details
 +            }
 +        );
 +    } catch (error) {
 +        console.error("Error enviando notificación:", error);
 +    }
 +
 +    // Navegar al informe
 +    window.location.href = `/doc/${encodeURIComponent(id)}/start`;
 +});
 +</script>
 +
 +</div>
 +</HTML>
start.1787144387.txt.gz · Última modificación: por admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki