fix: 待连接池后端过滤离线设备——list_pending 只返回当前在线设备(离线候选不可确认),不依赖前端 JS 缓存版本,任何客户端都拿不到离线条目

This commit is contained in:
2026-09-04 08:08:52 +08:00
parent 1a74372ad9
commit 7276cfe585
+6 -4
View File
@@ -301,14 +301,16 @@ def get_status():
def list_pending():
"""待连接列表(含当前在线状态:本机 adb 一次解析)。"""
"""待连接列表:只返回当前在线的设备(离线候选不可确认,不展示)。
后端直接过滤(2026-09-04):不依赖前端 JS 版本,任何客户端都拿不到
离线条目;设备恢复在线后扫描自动更新 last_seen 并重新出现在列表。
"""
online = _parse_adb_devices(_adb("devices"))
with _ctx():
rows = [p.to_dict() for p in PendingDevice.query.order_by(
PendingDevice.first_seen.desc()).all()]
for r in rows:
r["online"] = r["serial"] in online
return rows
return [dict(r, online=True) for r in rows if r["serial"] in online]
def confirm_pending(serial, name=""):