fix(acs): fallback lookup perangkat via data pelanggan
All checks were successful
CI / test (push) Successful in 1m37s

- cari lewat pppoe/genieacs_tag/mac/phone bila tag/ID tidak cocok
- mengurangi lookup gagal & dashboard timeout
- versi 0.6.10
This commit is contained in:
oxpoe
2026-11-06 11:02:12 +07:00
parent de120f08a9
commit f66c3e2b7f
5 changed files with 36 additions and 3 deletions

View File

@@ -2,6 +2,11 @@
Format mengikuti [Keep a Changelog](https://keepachangelog.com/) dan [Semantic Versioning](https://semver.org/).
## [0.6.10] — 2026-11-06 — "acs-lookup"
### Diperbaiki
- Lookup perangkat GenieACS kini punya fallback lewat data pelanggan (ID, nomor HP, PPPoE, tag ACS, MAC), sehingga perangkat lebih cepat ditemukan dan dashboard tidak menggantung saat tag/ID tidak cocok.
## [0.6.9] — 2026-11-06 — "acs-wifi-rx"
### Diperbaiki

View File

@@ -11,7 +11,7 @@
<p align="center">
<img src="https://img.shields.io/badge/lisensi-ISC-ADFF2F" alt="Lisensi: ISC">
<img src="https://img.shields.io/badge/versi-0.6.9_acs--wifi-ADFF2F" alt="Versi 0.6.9 (acs-wifi-rx)">
<img src="https://img.shields.io/badge/versi-0.6.10_acs--lookup-ADFF2F" alt="Versi 0.6.10 (acs-lookup)">
<img src="https://img.shields.io/badge/Node.js-%E2%89%A520-339933" alt="Node.js >= 20">
<img src="https://img.shields.io/badge/docker-ready-2496ED?logo=docker&logoColor=white" alt="Docker">
<a href="https://demo-openisp.oxpoe.xyz"><img src="https://img.shields.io/badge/demo-live-ADFF2F?logo=googlechrome&logoColor=black" alt="Demo"></a>

View File

@@ -1,6 +1,6 @@
{
"name": "open-isp",
"version": "0.6.9",
"version": "0.6.10",
"description": "OPEN-ISP \u2014 sistem billing & manajemen ISP open-source (PWA pelanggan, multi-OLT, RADIUS, WhatsApp, QRIS)",
"main": "app-customer.js",
"scripts": {

View File

@@ -112,6 +112,34 @@ async function resolveDeviceToken(input) {
const found = await findDeviceWithTagVariants(token);
if (found && found.device && found.device._id) return found.device;
// Fallback: cari lewat data pelanggan (ID, HP, PPPoE, tag ACS, atau MAC).
try {
const db = require('../config/database');
const cust = db.prepare(`
SELECT pppoe_username, genieacs_tag, mac_address, phone
FROM customers
WHERE phone = ? OR id = ? OR pppoe_username = ? OR genieacs_tag = ? OR mac_address = ?
LIMIT 1
`).get(token, token, token, token, token);
if (cust) {
const candidates = Array.from(new Set([
cust.pppoe_username, cust.genieacs_tag, cust.mac_address, cust.phone
].map(v => String(v || '').trim()).filter(v => v && v !== token)));
for (const cand of candidates) {
const byPppoe = await findDeviceByPppoe(cand);
if (byPppoe && byPppoe._id) return byPppoe;
const byTag = await findDeviceByTag(cand);
if (byTag && byTag._id) return byTag;
const variant = await findDeviceWithTagVariants(cand);
if (variant && variant.device && variant.device._id) return variant.device;
}
}
} catch (e) {
logger.debug(`[resolveDeviceToken] Customer DB fallback error: ${e.message}`);
}
return null;
}

View File

@@ -1 +1 @@
0.6.9
0.6.10