turnero: fallback a puerto 8080 si SigWeb no responde en 47289

Intenta localhost:47289 primero; si falla prueba localhost:8080.
Funciona para instalaciones con puerto no estándar sin cambiar Oracle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-21 11:21:18 -05:00
co-authored by Claude Sonnet 4.6
parent dd1e377df7
commit 3d035d3699
+13 -6
View File
@@ -2528,9 +2528,11 @@ document.querySelectorAll('.turnero-firma-item').forEach(function(widget) {
<script>
// ── Topaz SigWeb ────────────────────────────────────────────────────
const topaz = (() => {
const SIGWEB_URL = 'http://localhost:47289/SigWeb/SigWebTablet.js';
const SIGWEB_URLS = [
'http://localhost:47289/SigWeb/SigWebTablet.js',
'http://localhost:8080/SigWeb/SigWebTablet.js',
];
let _loaded = false, _ctx = null, _target = null, _poll = null;
// _target: { type: 'turnero'|'pro', canvas: CanvasElement, onAccept: fn }
function _call(fn, ...args) {
if (_ctx && typeof _ctx[fn] === 'function') return _ctx[fn](...args);
@@ -2539,17 +2541,22 @@ const topaz = (() => {
throw new Error('SigWeb: ' + fn + ' no encontrado');
}
function _loadScript() {
if (_loaded) return Promise.resolve(true);
function _tryLoad(urls) {
if (!urls.length) return Promise.resolve(false);
return new Promise(res => {
const s = document.createElement('script');
s.src = SIGWEB_URL;
s.src = urls[0];
s.onload = () => { _loaded = true; res(true); };
s.onerror = () => res(false);
s.onerror = () => _tryLoad(urls.slice(1)).then(res);
document.head.appendChild(s);
});
}
function _loadScript() {
if (_loaded) return Promise.resolve(true);
return _tryLoad(SIGWEB_URLS);
}
// Detectar disponibilidad al cargar; ocultar botones si no hay pad
_loadScript().then(ok => {
if (!ok) document.querySelectorAll('.btn-topaz').forEach(b => b.style.display = 'none');