fix(sigweb): intentar HTTPS :47290 antes de HTTP :47289 para páginas HTTPS
Chrome bloquea scripts HTTP desde páginas HTTPS; SigWeb >=1.6.4 expone el SDK en https://localhost:47290 para este caso. Fallback a http://47289 para instalaciones antiguas. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
49a622e05f
commit
f9619db8ef
@@ -3046,34 +3046,31 @@ function mostrarToast(msg, type = 'info', duration = 2500) {
|
||||
<script src="<?= defined('APP_URL') ? rtrim(APP_URL,'/') : '' ?>/assets/js/lab-sidebar.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
var URL = 'http://localhost:47289/SigWeb/SigWebTablet.js';
|
||||
var t0 = Date.now();
|
||||
// SigWeb >=1.6.4 sirve HTTPS en :47290 (necesario cuando la app es HTTPS).
|
||||
// Intentar HTTPS primero; si falla, fallback a HTTP :47289.
|
||||
var URLS = [
|
||||
'https://localhost:47290/SigWeb/SigWebTablet.js',
|
||||
'http://localhost:47289/SigWeb/SigWebTablet.js'
|
||||
];
|
||||
var t0 = Date.now();
|
||||
console.group('[SigWeb] Detección de pad biométrico');
|
||||
console.log('→ Apuntando a:', URL);
|
||||
console.log('→ Intento iniciado:', new Date().toLocaleTimeString());
|
||||
var s = document.createElement('script');
|
||||
s.src = URL;
|
||||
s.onload = function() {
|
||||
|
||||
function sigwebOnLoad(urlUsada) {
|
||||
var ms = Date.now() - t0;
|
||||
console.log('✅ Script cargado en ' + ms + 'ms');
|
||||
console.log(' SigWebTablet (clase):', typeof SigWebTablet);
|
||||
// Intentar instanciar y leer estado del pad
|
||||
console.log('✅ Script cargado desde', urlUsada, 'en ' + ms + 'ms');
|
||||
try {
|
||||
var ctx = new SigWebTablet();
|
||||
var state = ctx.GetTabletState();
|
||||
console.log(' GetTabletState():', state, state === 0 ? '← pad NO detectado/conectado' : '← pad activo');
|
||||
console.log(' GetTabletState():', state, state === 0 ? '← pad NO detectado' : '← pad activo');
|
||||
if (state === 0) {
|
||||
console.warn(' ⚠ SigWeb corre pero el pad físico no está conectado o no lo reconoce.');
|
||||
console.warn(' Revisa: cable USB, drivers T-LBK460, y que el pad esté encendido.');
|
||||
console.warn(' ⚠ SigWeb corre pero el pad físico no responde. Revisa USB y drivers.');
|
||||
} else {
|
||||
console.log(' Modelo detectado — SetImageXSize prueba:');
|
||||
ctx.SetImageXSize(500);
|
||||
console.log(' ✅ Pad respondiendo correctamente');
|
||||
}
|
||||
} catch(e) {
|
||||
console.warn(' ⚠ Error al instanciar SigWebTablet:', e.message);
|
||||
console.warn(' El script cargó pero el pad no responde. Puede ser SigPlus en vez de SigWeb.');
|
||||
console.warn(' Verifica la versión del SDK en: http://localhost:47289/SigWeb/');
|
||||
}
|
||||
console.groupEnd();
|
||||
var b = document.getElementById('sigweb-badge');
|
||||
@@ -3082,18 +3079,31 @@ function mostrarToast(msg, type = 'info', duration = 2500) {
|
||||
if (b) b.style.color = '#16a34a';
|
||||
if (d) { d.style.background = '#22c55e'; d.style.boxShadow = '0 0 4px #22c55e'; }
|
||||
if (l) l.textContent = 'Topaz en línea';
|
||||
};
|
||||
s.onerror = function() {
|
||||
var ms = Date.now() - t0;
|
||||
console.warn('❌ Sin respuesta después de ' + ms + 'ms — SigWeb no está corriendo.');
|
||||
console.warn(' URL intentada:', URL);
|
||||
console.warn(' Pasos para verificar:');
|
||||
console.warn(' 1. Abre en este navegador: http://localhost:47289/SigWeb/');
|
||||
console.warn(' 2. Si no carga: instala o inicia el servicio Topaz SigWeb');
|
||||
console.warn(' 3. Si carga pero el pad no funciona: revisa drivers del T-LBK460');
|
||||
console.groupEnd();
|
||||
};
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
|
||||
function intentar(idx) {
|
||||
if (idx >= URLS.length) {
|
||||
var ms = Date.now() - t0;
|
||||
console.warn('❌ SigWeb no respondió en ningún puerto después de ' + ms + 'ms.');
|
||||
console.warn(' Si usas Chrome/HTTPS, abre primero: https://localhost:47290/SigWeb/');
|
||||
console.warn(' y acepta el certificado auto-firmado de Topaz.');
|
||||
console.warn(' Si el problema persiste: instala/inicia el servicio Topaz SigWeb.');
|
||||
console.groupEnd();
|
||||
return;
|
||||
}
|
||||
var url = URLS[idx];
|
||||
console.log('→ Intentando:', url);
|
||||
var s = document.createElement('script');
|
||||
s.src = url;
|
||||
s.onload = function() { sigwebOnLoad(url); };
|
||||
s.onerror = function() {
|
||||
console.warn(' ✗ Falló:', url);
|
||||
intentar(idx + 1);
|
||||
};
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
|
||||
intentar(0);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user