fix(gowa): status device array, auto-save device id, QR hide saat terhubung
All checks were successful
CI / test (push) Successful in 1m53s

- status route normalisasi results array + auto isi gowa_device_id
- UI poll status 3s, sembunyikan QR saat open
- resolveDeviceId utamakan device connected
- versi 0.5.17
This commit is contained in:
oxpoe
2026-11-06 03:38:00 +07:00
parent 8a312485a7
commit fadbf0084b
7 changed files with 62 additions and 8 deletions

View File

@@ -44,7 +44,11 @@ async function resolveDeviceId(force) {
try { list = await listDevices(); } catch (e) { list = []; }
const has = function (id) { return list.some(function (d) { return String(d.id) === id; }); };
let chosen;
const connected = list.find(function (d) {
return d && (d.state === 'connected' || d.is_connected || d.is_logged_in || d.connected);
});
if (configured && has(configured)) chosen = configured; // device id diset & ada -> pakai itu
else if (connected) chosen = String(connected.id); // utamakan device yang benar-benar terhubung
else if (list.length === 1) chosen = String(list[0].id); // cuma 1 device -> otomatis
else if (list.length > 1) chosen = configured || String(list[0].id); // >1 device -> pakai yg diset / pertama
else chosen = configured; // GOWA tak beri list -> serahkan ke GOWA