06-sep: [videoclub] flujo unificado torrents/bajar en novedades+pelicula+serie, sin URLs, /limpiar borra todo el chat (IDD+OpenCode), parental CAROLINA con fallback MAC en vivo
This commit is contained in:
@@ -106,12 +106,39 @@ def parental_status():
|
||||
return json.dumps(data, ensure_ascii=False, indent=2, default=str)
|
||||
|
||||
|
||||
def _mac_en_vivo(pistas):
|
||||
"""Busca en los leases DHCP actuales un dispositivo cuyo hostname
|
||||
contenga alguna pista. Devuelve (ip, mac, hostname) o None.
|
||||
Sirve para tablets con MAC privada aleatoria (la MAC guardada rota)."""
|
||||
try:
|
||||
from router_control import _inventario
|
||||
except Exception:
|
||||
return None
|
||||
try:
|
||||
devices, _by_mac = _inventario()
|
||||
except Exception:
|
||||
return None
|
||||
for ip, mac, nombre in devices:
|
||||
n = normalizar_nombre(nombre)
|
||||
for p in pistas:
|
||||
if p and (p in n or n in p):
|
||||
return ip, mac, nombre
|
||||
return None
|
||||
|
||||
|
||||
def cambiar_bloqueo(nombre, blocked):
|
||||
device = resolver_dispositivo(nombre)
|
||||
if not device:
|
||||
raise ValueError(f"Dispositivo no reconocido: {nombre}")
|
||||
asyncio.run(_set_block(device["mac"], device["name"], blocked))
|
||||
return f"{'Bloqueado' if blocked else 'Activado'}: {device['name']}"
|
||||
mac = device["mac"]
|
||||
etiqueta = device["name"]
|
||||
vivo = _mac_en_vivo((normalizar_nombre(nombre),
|
||||
normalizar_nombre(etiqueta)))
|
||||
if vivo and vivo[1].upper() != mac.upper():
|
||||
mac = vivo[1]
|
||||
etiqueta = f"{etiqueta} [{vivo[2]} {vivo[0]}]"
|
||||
asyncio.run(_set_block(mac, device["name"], blocked))
|
||||
return f"{'Bloqueado' if blocked else 'Activado'}: {etiqueta} ({mac})"
|
||||
|
||||
|
||||
async def _aimesh_data():
|
||||
|
||||
Reference in New Issue
Block a user