Skip to content

Commit 2964b1d

Browse files
añadido hash del dispositivo al gestor
y mejorado bloqueo de dispositivos general
1 parent a45e045 commit 2964b1d

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

frontend/home/styles/ajustes.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,35 @@
10481048
background: rgba(6, 182, 212, 0.18);
10491049
}
10501050

1051+
.gestion-dp-hash-linea {
1052+
display: flex;
1053+
align-items: center;
1054+
gap: 6px;
1055+
margin: 4px 0 2px;
1056+
}
1057+
1058+
.gestion-dp-hash-label {
1059+
font-size: 11px;
1060+
color: #475569;
1061+
}
1062+
1063+
.gestion-dp-bt-copiar-hash {
1064+
flex-shrink: 0;
1065+
background: none;
1066+
border: none;
1067+
padding: 2px 4px;
1068+
cursor: pointer;
1069+
color: #475569;
1070+
border-radius: 4px;
1071+
display: flex;
1072+
align-items: center;
1073+
transition: color 0.15s;
1074+
}
1075+
1076+
.gestion-dp-bt-copiar-hash:hover {
1077+
color: #94a3b8;
1078+
}
1079+
10511080
.gestion-dp-seccion-titulo {
10521081
font-size: 11px;
10531082
font-weight: 600;

frontend/home/ui/ajustes.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,13 @@ function _renderizar_gestion_dispositivos({ sesiones, confianzas, bloqueados = [
10381038
? `<div class="gestion-dp-nombre">${escapeHTML(d.os)} ${badgeEste}</div>`
10391039
: `<div class="gestion-dp-nombre gestion-dp-desconocido">Sistema desconocido ${badgeEste}</div>`;
10401040
const hwLine = d.nombre ? `<div class="gestion-dp-hw">${escapeHTML(d.nombre)}</div>` : '';
1041+
const hashLine = d.esteDispositivo ? `
1042+
<div class="gestion-dp-hash-linea">
1043+
<span class="gestion-dp-hash-label">Hash dispositivo</span>
1044+
<button class="gestion-dp-bt-copiar-hash" data-hash="${d.id_dp_hash}" title="Copiar hash al portapapeles">
1045+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
1046+
</button>
1047+
</div>` : '';
10411048

10421049
const partesFecha = [];
10431050
if (d.tieneSesion) partesFecha.push(`Sesión desde ${fmt(d.creadoEn)}`);
@@ -1057,7 +1064,7 @@ function _renderizar_gestion_dispositivos({ sesiones, confianzas, bloqueados = [
10571064
html += `
10581065
<div class="${claseItem}" data-hash="${d.id_dp_hash}">
10591066
<div class="gestion-dp-info">
1060-
${osLine}${hwLine}${fechaLine}
1067+
${osLine}${hwLine}${hashLine}${fechaLine}
10611068
</div>
10621069
<div class="gestion-dp-acciones">${btSesion}${btConfianza}${btBloquear}</div>
10631070
</div>`;
@@ -1090,6 +1097,16 @@ function _renderizar_gestion_dispositivos({ sesiones, confianzas, bloqueados = [
10901097

10911098
contenedor.innerHTML = html;
10921099

1100+
contenedor.querySelectorAll('.gestion-dp-bt-copiar-hash').forEach(btn => {
1101+
btn.addEventListener('click', async () => {
1102+
await navigator.clipboard.writeText(btn.dataset.hash);
1103+
const svg = btn.innerHTML;
1104+
btn.textContent = '✓';
1105+
btn.style.color = '#4ade80';
1106+
setTimeout(() => { btn.innerHTML = svg; btn.style.color = ''; }, 1500);
1107+
});
1108+
});
1109+
10931110
contenedor.querySelectorAll('.gestion-dp-bt').forEach(btn => {
10941111
btn.addEventListener('click', async () => {
10951112
const tipo = btn.dataset.tipo;

0 commit comments

Comments
 (0)