From 6973838a59a68131472bc5aa7d5b48871ab85844 Mon Sep 17 00:00:00 2001 From: pikaro Date: Thu, 22 Oct 2026 12:55:53 +0200 Subject: [PATCH] v1.36.0: los enlaces de Mempool van a la web de Mempool, y copiar en todos los txids y direcciones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Los enlaces ↗ ya no se montan sobre el sitio del dashboard (:4083): se derivan al 4081/4080 del mismo nodo, o a la «Web de Mempool» de Ajustes. - Botón de copiar en los txids y direcciones abreviados de Auditoría, Red, Explorar, rastro y peritaje. - tests/test25.js. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01L5npnUYgSPkAaHkdaeUqBr --- CHANGELOG.md | 13 ++++++++++++ src/02-almacen.js | 2 +- src/21-interfaz-comun.jsx | 37 ++++++++++++++++++++++++++++++-- src/31-pestana-red.jsx | 2 +- src/32-explorador.jsx | 4 ++-- src/43-rastro-pantalla.jsx | 4 ++-- src/44-peritaje-pantalla.jsx | 6 +++--- src/50-pestana-auditoria.jsx | 13 ++++++------ src/51-pestana-peritaje.jsx | 16 +++++++------- src/60-ajustes.jsx | 14 +++++++++++- src/90-app.jsx | 3 ++- tests/README.md | 1 + tests/test25.js | 41 ++++++++++++++++++++++++++++++++++++ 13 files changed, 129 insertions(+), 27 deletions(-) create mode 100644 tests/test25.js diff --git a/CHANGELOG.md b/CHANGELOG.md index d33196e..9adf774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,19 @@ y el versionado sigue [Versionado Semántico](https://semver.org/lang/es/): - **MENOR** — características nuevas que no rompen lo anterior - **PARCHE** — arreglos de errores +--- +## [1.36.0] — 2026-10-22 + +### Corregido +- **Los enlaces «Ver en Mempool» / «↗» abrían una página en blanco.** Desde que el dashboard tiene su propio sitio (:4083), los enlaces se construían sobre esa dirección (`…:4083/tx/`), que no es Mempool. Ahora, si la dirección del nodo es la del :4083, los enlaces van al Mempool del mismo nodo (4081 con https, 4080 con http). + +### Añadido +- **«Web de Mempool» en Ajustes (opcional).** Si Mempool no está en esos puertos, o quieres que los enlaces vayan a otra web, se escribe ahí y manda sobre la derivada. Solo se admiten direcciones http(s). +- **Botón de copiar (⧉) en todos los txids y direcciones abreviados**: historial de la wallet y avisos de Auditoría, transacciones de un bloque en Red, UTXOs de Explorar, columnas del rastro y del peritaje, y los hallazgos del peritaje. Copia el valor entero aunque en pantalla salga cortado. + +### Pruebas +- `tests/test25.js`: derivación de la web de Mempool y prioridad del ajuste (11 casos). + --- ## [1.35.2] — 2026-10-22 diff --git a/src/02-almacen.js b/src/02-almacen.js index 2a89e21..425d982 100644 --- a/src/02-almacen.js +++ b/src/02-almacen.js @@ -21,7 +21,7 @@ const objetoPlano = v => !!v && typeof v === "object" && !Array.isArray(v); const cabe = (v, max) => { try { return JSON.stringify(v).length <= max; } catch { return false; } }; const ALMACEN_ESQUEMA = { - "config": v => objetoPlano(v) && typeof v.url === "string" && /^https?:\/\/[^\s]{1,200}$/.test(v.url) && (v.name == null || (typeof v.name === "string" && v.name.length <= 100)) || "una dirección de nodo http(s) y un nombre", + "config": v => objetoPlano(v) && typeof v.url === "string" && /^https?:\/\/[^\s]{1,200}$/.test(v.url) && (v.name == null || (typeof v.name === "string" && v.name.length <= 100)) && (v.web == null || v.web === "" || (typeof v.web === "string" && /^https?:\/\/[^\s]{1,200}$/.test(v.web))) || "una dirección de nodo http(s), un nombre y, si se quiere, la web de Mempool", "tema": v => (typeof v === "string" && /^[a-z]{1,30}$/.test(v)) || "el nombre de un tema", "rastro-mesa": v => (objetoPlano(v) && cabe(v, 2e6)) || "un objeto con las marcas (máx. 2 MB)", "peritaje-mesa": v => (objetoPlano(v) && cabe(v, 2e6)) || "un objeto con las marcas (máx. 2 MB)", diff --git a/src/21-interfaz-comun.jsx b/src/21-interfaz-comun.jsx index 100719c..ebcfd82 100644 --- a/src/21-interfaz-comun.jsx +++ b/src/21-interfaz-comun.jsx @@ -26,6 +26,28 @@ return
{icon&&{icon}}

{children}

; }; const Tag = ({label,value,color}) =>
{label}{value!=null?value:"-"}
; + // ── ¿Dónde está la web de Mempool? ───────────────────────────────── + // La «dirección del nodo» de Ajustes es la de la API. Desde el 20-oct el + // dashboard tiene su propio sitio (:4083), que no es la web de Mempool: un + // enlace /tx/ montado sobre él devolvía el dashboard (página en + // blanco). La web de Mempool está en el 4081 (https) o el 4080 (http) del + // mismo nodo. Si en Ajustes se ha escrito una «Web de Mempool», manda esa. + const WEB_MEMPOOL = { web: "" }; + function derivarWebMempool(base) { + const b = String(base || "").trim().replace(/\/$/, ""); + if (!b) return null; + try { + const u = new URL(b); + if (u.port === "4083") { u.port = u.protocol === "https:" ? "4081" : "4080"; return u.origin; } + } catch {} + return b; + } + function webMempool(base) { + const w = String(WEB_MEMPOOL.web || "").trim().replace(/\/$/, ""); + if (/^https?:\/\/[^\s]{1,200}$/.test(w)) return w; + return derivarWebMempool(base); + } + // ── Enlace a TU instancia de Mempool ──────────────────────────────── // Se construye siempre desde la URL que has configurado, nunca desde una // constante. Enlazar a mempool.space público sería regalar exactamente lo @@ -37,7 +59,7 @@ const rutas = { tx:"tx", direccion:"address", bloque:"block" }; const ruta = rutas[tipo]; if (!ruta) return null; - const url = `${String(base).replace(/\/$/,"")}/${ruta}/${id}`; + const url = `${webMempool(base)}/${ruta}/${id}`; return ( { if (!id) return null; const rutas = { tx:"tx", direccion:"address" }; - const url = base && rutas[tipo] ? `${String(base).replace(/\/$/,"")}/${rutas[tipo]}/${id}` : null; + const url = base && rutas[tipo] ? `${webMempool(base)}/${rutas[tipo]}/${id}` : null; const estilo = {fontSize:"0.68rem",fontFamily:C.mono,color:color||C.blue,textDecoration:"none",wordBreak:"break-all"}; return ( @@ -83,6 +105,17 @@ ); }; + // Un identificador abreviado con su botón de copiar entero (sin enlace: + // para filas donde pulsar ya hace otra cosa). v1.36.0 + const IdCopiable = ({id, n, texto, tipo, color}) => { + if (!id) return null; + return ( + + {texto || (n && id.length>n ? id.slice(0,n)+"…" : id)} + + + ); + }; const Pulse = ({color}) => ; const Spinner = () =>
◌ cargando
; // El aviso de demo ya no va pestaña a pestaña: lo da EstadoNodoBanner, diff --git a/src/31-pestana-red.jsx b/src/31-pestana-red.jsx index 50a590c..ea4741e 100644 --- a/src/31-pestana-red.jsx +++ b/src/31-pestana-red.jsx @@ -171,7 +171,7 @@ {!blockTxs&&} {blockTxs&&blockTxs.slice(0,5).map((tx,i)=>(
- {fmt.hash(tx.txid)} +
{tx.fee} sat{tx.size}B
))} diff --git a/src/32-explorador.jsx b/src/32-explorador.jsx index 5193371..6598449 100644 --- a/src/32-explorador.jsx +++ b/src/32-explorador.jsx @@ -141,7 +141,7 @@ {result&&(
- {fmt.hash(result.tx.txid)} + {statusLabel}
@@ -397,7 +397,7 @@
- {fmt.hash(u.txid)} · salida {u.vout+1} (vout {u.vout}) + · salida {u.vout+1} (vout {u.vout})
{typeof priv.score==="number"?`${priv.score}/100`:"—"} diff --git a/src/43-rastro-pantalla.jsx b/src/43-rastro-pantalla.jsx index e4b0d34..f1ad851 100644 --- a/src/43-rastro-pantalla.jsx +++ b/src/43-rastro-pantalla.jsx @@ -70,7 +70,7 @@
{btcTxt(v.prevout?.value)} - Entrada {i+1} · {v.prevout?.scriptpubkey_address?abrevDir(v.prevout.scriptpubkey_address):etiquetaSinDir(v.prevout)} +
Entrada {i+1} · {v.prevout?.scriptpubkey_address?abrevDir(v.prevout.scriptpubkey_address):etiquetaSinDir(v.prevout)}{v.prevout?.scriptpubkey_address&&}
{sePuede&&{isMobile?"seguir ›":"›"}}
@@ -103,7 +103,7 @@
{k===0?"Origen":<>Salto {k}}{esActual?" · aquí estás":""}
-
{abrevTxid(h.txid)}
+
{abrevTxid(h.txid)}
{fechaCorta(t.status?.block_time)}{t.status?.block_height!=null&&` · bloque ${fmt.num(t.status.block_height)}`}{seguido>0&&` · importe seguido: ${btcTxt(seguido)}`}
diff --git a/src/44-peritaje-pantalla.jsx b/src/44-peritaje-pantalla.jsx index 827003a..0d10751 100644 --- a/src/44-peritaje-pantalla.jsx +++ b/src/44-peritaje-pantalla.jsx @@ -42,7 +42,7 @@
{btcTxt(o.value)} - Salida {i+1} (vout {i}) · {o.scriptpubkey_address?abrevDir(o.scriptpubkey_address):etiquetaSinDir(o)} +
Salida {i+1} (vout {i}) · {o.scriptpubkey_address?abrevDir(o.scriptpubkey_address):etiquetaSinDir(o)}{o.scriptpubkey_address&&}
{seguible&&{isMobile?"seguir ›":"›"}}
@@ -84,7 +84,7 @@
{esOrigen?"Origen · el robo":<>Salto {k}}{esActual?" · aquí estás":""}
-
{abrevTxid(tx.txid)}
+
{abrevTxid(tx.txid)}
{fechaHora(tx.status?.block_time)}{tx.status?.block_height!=null&&` · bloque ${fmt.num(tx.status.block_height)}`}{seguido>0&&` · importe seguido: ${btcTxt(seguido)}`}
{!esOrigen&&t&&
⏱ {t}
}
@@ -191,7 +191,7 @@ : <> {vig.map(v=>{ const last=v.checks?.[v.checks.length-1]; const res=resultadosVig[v.clave]; return (
-
{btcTxt(v.sats)} · {abrevDir(v.address)}
+
{btcTxt(v.sats)} · {abrevDir(v.address)}{v.address&&!/\s/.test(v.address)&&<> }
Última comprobación: {last?fechaHora(last.fecha):"—"} · {last?.estado==="gastada"?"gastada":last?.estado==="no_localizada"?"gastada, sin localizar":last?.estado==="error"?"falló":"sin gastar"}
{res&&
{res.texto}
}
); })} diff --git a/src/50-pestana-auditoria.jsx b/src/50-pestana-auditoria.jsx index a9e6936..f4171ea 100644 --- a/src/50-pestana-auditoria.jsx +++ b/src/50-pestana-auditoria.jsx @@ -430,7 +430,7 @@
{walletReport.polvoSinGastar.slice(0,6).map((p,i)=>(
- {fmt.num(p.value)} sat · {p.address} · {p.txid.slice(0,16)}…:{p.vout} + {fmt.num(p.value)} sat · · :{p.vout} {p.tecnico&& · por debajo del mínimo económico}
))} @@ -460,7 +460,7 @@
{a.vinculadas} direcciones atadas {" · "}{a.time ? new Date(a.time*1000).toLocaleDateString("es-ES") : "sin confirmar"} - {" · "} + {" · "}{" "}
))} {walletReport.autoenviosDaninos.length>6&&
…y {walletReport.autoenviosDaninos.length-6} más
} @@ -525,7 +525,7 @@ {cluster.slice(0,4).map((a,j)=>(
{labels?.get(a)&&🏷 {labels.get(a)}} - {a.slice(0,14)}…{a.slice(-8)} +
))} {cluster.length>4&&
+{cluster.length-4} más
} @@ -566,7 +566,8 @@ {/* El clic en la fila abre el análisis interno; este enlace lleva al explorador, y por eso corta la propagación: son dos destinos distintos. */} - e.stopPropagation()} style={{flexShrink:0}}> + e.stopPropagation()} style={{flexShrink:0,display:"inline-flex",alignItems:"center",gap:6}}> +
@@ -598,7 +599,7 @@
{[...labels.entries()].map(([ref,lbl])=>(
- {ref.length>20?ref.slice(0,10)+"…"+ref.slice(-8):ref} + {ref.length>20?:ref} {lbl}
))} @@ -685,7 +686,7 @@ {mine==="cambio"?"↺ cambio":"↓ recepción"} {fmt.sats(o.value)} {lbl&&· {lbl}} - {o.scriptpubkey_address?.slice(0,12)}… + {o.scriptpubkey_address&&}
); })} diff --git a/src/51-pestana-peritaje.jsx b/src/51-pestana-peritaje.jsx index 0bb2b83..bd38b9c 100644 --- a/src/51-pestana-peritaje.jsx +++ b/src/51-pestana-peritaje.jsx @@ -260,7 +260,7 @@
salto {c.hop} - {c.txid.slice(0,20)}… + {c.band.value}
@@ -293,7 +293,7 @@
{a.fundamentos.map((f,j)=>(
- [{f.certainty}] {f.basis}{f.refTxid?` — tx ${f.refTxid.slice(0,16)}…`:""} + [{f.certainty}] {f.basis}{f.refTxid?<> — tx :""}
))}
@@ -315,7 +315,7 @@ {d.address}
-
{d.basis} — tx {d.txid.slice(0,16)}…
+
{d.basis} — tx
))}
@@ -330,7 +330,7 @@
{report.pendingBranches.map((b,i)=>(
- {b.address} · salida {b.vout+1} de {b.txid.slice(0,16)}… · {btcTxt(b.amount)} · de lo seguido {btcTxt(b.seguido)} (proporcional) · {b.estado} + {b.address} · salida {b.vout+1} de · {btcTxt(b.amount)} · de lo seguido {btcTxt(b.seguido)} (proporcional) · {b.estado}
))}
@@ -341,7 +341,7 @@
{report.sinDeterminar.map((d,i)=>(
- {d.address} — {d.basis} · tx {d.txid.slice(0,16)}… + {d.address} — {d.basis} · tx
))}
@@ -362,7 +362,7 @@ {u.address}
-
{btcTxt(u.amount)} · tx {u.txid.slice(0,12)}…, salida {u.vout+1} (vout {u.vout})
+
{btcTxt(u.amount)} · tx , salida {u.vout+1} (vout {u.vout})
))}
@@ -380,7 +380,7 @@
{report.failedBranches.map((f,i)=>(
- {f.address} · {btcTxt(f.amount)} · tx {f.txid.slice(0,16)}…, salida {f.vout+1} (vout {f.vout}) + {f.address} · {btcTxt(f.amount)} · tx , salida {f.vout+1} (vout {f.vout})
))}
@@ -429,7 +429,7 @@ {((report.mesa||[]).length>0||(report.vigiladas||[]).length>0)&&(
MESA DE TRABAJO
- {(report.mesa||[]).map((m,i)=>(
★ {m.txid.slice(0,16)}…{m.nota?` — ${m.nota}`:""}
))} + {(report.mesa||[]).map((m,i)=>(
★ {m.nota?` — ${m.nota}`:""}
))} {(report.vigiladas||[]).map((v,i)=>(
◉ {abrevDir(v.address)} · {btcTxt(v.sats)} · última comprobación {v.ultima?fechaHora(v.ultima.fecha):"—"}
))}
)} diff --git a/src/60-ajustes.jsx b/src/60-ajustes.jsx index 39e785e..5ba019c 100644 --- a/src/60-ajustes.jsx +++ b/src/60-ajustes.jsx @@ -131,6 +131,9 @@ const [url,setUrl]=useState(config.url||origen||""); const choqueProtocolo = paginaHttps && /^http:\/\//i.test(url.trim()); const [name,setName]=useState(config.name||""); + const [web,setWeb]=useState(config.web||""); + const webOk = !web.trim() || /^https?:\/\/[^\s]{1,200}$/.test(web.trim()); + const webPropuesta = derivarWebMempool(url) || ""; const [remember,setRemember]=useState(()=>ALMACEN.get("config", null)!=null); const [testing,setTesting]=useState(false); const [testResult,setTestResult]=useState(null); @@ -142,6 +145,7 @@ }; const handleSave=()=>{ const cfg={url:url.replace(/\/$/,""),name:name||"Mi nodo"}; + if(web.trim()) cfg.web=web.trim().replace(/\/$/,""); if(remember){ ALMACEN.set("config", cfg); } else { ALMACEN.del("config"); } onSave(cfg); @@ -165,6 +169,14 @@ ? <>Si has abierto el dashboard desde tu nodo, es la misma dirección que la de esta página: {origen}{url.trim().replace(/\/$/,"")!==origen&&} : <>IP Tailscale del nodo con el puerto de Mempool. Con https: https://100.x.x.x:4081 · con http: http://100.x.x.x:4080}
+
Web de Mempool (para los enlaces ↗) · opcional
+ setWeb(e.target.value)} placeholder={webPropuesta||"https://100.x.x.x:4081"} + style={{width:"100%",background:C.bg,border:`1px solid ${webOk?C.borderBright:C.red}`,borderRadius:6,padding:"10px 12px",color:C.t1,fontFamily:C.mono,fontSize:"0.8rem",outline:"none",boxSizing:"border-box",marginBottom:8}}/> +
+ {webOk + ? <>Es la página de Mempool que se abre al pulsar un txid o una dirección. Vacío: se usa {webPropuesta||"la dirección de arriba"}{/:4083\b/.test(url)?" (el dashboard tiene su propio puerto, 4083; Mempool está en el 4081/4080)":""}. + : "Debe empezar por http:// o https://."} +
{/* Tema: antes eran cuatro puntos de color en la cabecera que parecían luces de estado. */}
Tema de color
@@ -192,7 +204,7 @@ {testResult&&
{testResult.msg}
}
- +
{ try { window.__txokoReiniciar && window.__txokoReiniciar(); } catch {} }}/> diff --git a/src/90-app.jsx b/src/90-app.jsx index 930085e..ad91a74 100644 --- a/src/90-app.jsx +++ b/src/90-app.jsx @@ -24,6 +24,7 @@ // Sync C global on every render setTheme(themeId); + WEB_MEMPOOL.web = config.web || ""; // Exponer setTab globalmente para que LAB pueda navegar a AUDITORÍA useEffect(()=>{ @@ -84,7 +85,7 @@
₿ txoko - · tu nodo, tus reglas · v1.35.2 + · tu nodo, tus reglas · v1.36.0
{showConfig&&{setConfig(cfg);setShowConfig(false);}} onClose={()=>setShowConfig(false)}/>}
diff --git a/tests/README.md b/tests/README.md index 825cf6c..4b72b74 100644 --- a/tests/README.md +++ b/tests/README.md @@ -35,6 +35,7 @@ node tests/test21.js # dirección con saldo pero sin historial (Fulcrum): no es node tests/test22.js # leer QR: qué es lo leído, si encaja y que nunca pase una semilla node tests/test23.js # QR animados (UR, BBQr, Specter), xpub de SeedSigner y lo firmado frente a lo auditado node tests/test24.js # total recibido y enviado sumando el historial cuando el nodo no los da +node tests/test25.js # a qué web de Mempool apuntan los enlaces ↗ (derivada del :4083 o la de Ajustes) ``` Las de criptografía también se extraen solas. `test7` lo hace por su cuenta, y diff --git a/tests/test25.js b/tests/test25.js new file mode 100644 index 0000000..610ed6f --- /dev/null +++ b/tests/test25.js @@ -0,0 +1,41 @@ +// v1.36.0 — a qué web de Mempool apuntan los enlaces ↗. +// Desde el 20-oct la «dirección del nodo» es la del sitio propio del dashboard +// (:4083), que no es Mempool: /tx/ sobre él devolvía una página en blanco. +// +// Uso: node tests/test25.js + +const lines = require("./fuente.js")().split("\n"); +const fn = (cabecera) => { + const s = lines.findIndex(l => l.startsWith(cabecera)); + if (s === -1) { console.error(`No se localiza ${cabecera}`); process.exit(1); } + const e = lines.findIndex((l, i) => i > s && l === " }"); + return lines.slice(s, e + 1).join("\n"); +}; +const linea = (inicio) => { const l = lines.find(x => x.startsWith(inicio)); if (!l) { console.error(`No se localiza ${inicio}`); process.exit(1); } return l; }; +const Q = new Function(`${linea(" const WEB_MEMPOOL =")}\n${fn(" function derivarWebMempool(")}\n${fn(" function webMempool(")}\nreturn { WEB_MEMPOOL, derivarWebMempool, webMempool };`)(); + +let pass = 0, fail = 0; +const ok = (n, c, x) => { console.log(` ${c ? "✓" : "✗"} ${n}`); if (!c && x !== undefined) console.log(" " + x); c ? pass++ : fail++; }; + +console.log("=== Derivar la web de Mempool desde la dirección del nodo ===\n"); +Q.WEB_MEMPOOL.web = ""; +ok("https://100.116.19.86:4083 → https://100.116.19.86:4081", Q.webMempool("https://100.116.19.86:4083") === "https://100.116.19.86:4081", Q.webMempool("https://100.116.19.86:4083")); +ok("http://100.116.19.86:4083 → http://…:4080", Q.webMempool("http://100.116.19.86:4083") === "http://100.116.19.86:4080"); +ok("con barra final también", Q.webMempool("https://100.116.19.86:4083/") === "https://100.116.19.86:4081"); +ok("una dirección que ya es Mempool (4081) se queda como está", Q.webMempool("https://100.116.19.86:4081") === "https://100.116.19.86:4081"); +ok("un host con nombre y sin puerto 4083 no se toca", Q.webMempool("https://nodo.ejemplo.org/") === "https://nodo.ejemplo.org"); +ok("sin nodo → null (no hay enlace)", Q.webMempool("") === null && Q.webMempool(null) === null); +ok("basura → se devuelve tal cual, sin lanzar", Q.webMempool("no es una url") === "no es una url"); + +console.log("\n=== La «Web de Mempool» de Ajustes manda ===\n"); +Q.WEB_MEMPOOL.web = "https://100.116.19.86:4081/"; +ok("la de Ajustes gana a la derivada (y sin barra final)", Q.webMempool("https://100.116.19.86:4083") === "https://100.116.19.86:4081"); +Q.WEB_MEMPOOL.web = "https://mempool.space/signet"; +ok("puede ser otra web (modo signet público, más adelante)", Q.webMempool("https://100.116.19.86:4083") === "https://mempool.space/signet"); +Q.WEB_MEMPOOL.web = "javascript:alert(1)"; +ok("un valor que no es http(s) se ignora (nunca javascript:)", Q.webMempool("https://100.116.19.86:4083") === "https://100.116.19.86:4081"); +Q.WEB_MEMPOOL.web = "https://a b"; +ok("con espacios se ignora", Q.webMempool("https://100.116.19.86:4083") === "https://100.116.19.86:4081"); + +console.log(`\n ${pass} correctas, ${fail} fallidas`); +process.exit(fail ? 1 : 0);