diff --git a/api.php b/api.php
index bfcd4c2..d8ffb81 100644
--- a/api.php
+++ b/api.php
@@ -212,6 +212,7 @@ try {
$results[] = [
'ip' => $ip,
'port_open' => $portOpen,
+ 'discovered' => true,
'name' => $name,
'last_seen' => gmdate('c'),
'last_connected' => $k['last_connected'] ?? null,
@@ -232,6 +233,7 @@ try {
$results[] = [
'ip' => $ip,
'port_open' => false,
+ 'discovered' => false,
'name' => $k['name'] ?? '',
'last_seen' => $k['last_seen'] ?? null,
'last_connected' => $k['last_connected'] ?? null,
@@ -306,6 +308,23 @@ try {
]);
}
+ case 'delete_device': {
+ $ip = normalize_ip((string) ($input['ip'] ?? ''));
+ if ($ip === null) {
+ json_out(['ok' => false, 'error' => 'Invalid IP.'], 400);
+ }
+ $devices = load_devices();
+ $before = count($devices);
+ $devices = array_values(array_filter($devices, fn($d) => ($d['ip'] ?? '') !== $ip));
+ if (count($devices) === $before) {
+ json_out(['ok' => false, 'error' => 'Device not found.'], 404);
+ }
+ if (!save_devices($devices)) {
+ json_out(['ok' => false, 'error' => 'Failed to save devices.'], 500);
+ }
+ json_out(['ok' => true, 'ip' => $ip, 'known_devices' => $devices]);
+ }
+
case 'command': {
$ip = normalize_ip((string) ($input['ip'] ?? ''));
if ($ip === null) {
diff --git a/assets/app.css b/assets/app.css
index a6b62af..a65cc79 100644
--- a/assets/app.css
+++ b/assets/app.css
@@ -93,6 +93,8 @@
border: 1px solid var(--line);
border-radius: var(--radius);
background: transparent;
+ color: inherit;
+ font: inherit;
cursor: pointer;
text-align: left;
width: 100%;
@@ -157,6 +159,36 @@
color: var(--accent);
border-color: rgba(79, 163, 255, .45);
}
+.badge.is-missing {
+ color: #ff6b6b;
+ border-color: rgba(139, 0, 0, .7);
+ background: rgba(139, 0, 0, .15);
+}
+
+.device-remove {
+ flex-shrink: 0;
+ width: 24px;
+ height: 24px;
+ min-height: 24px;
+ padding: 0;
+ border: 1px solid transparent;
+ border-radius: 6px;
+ background: transparent;
+ color: var(--muted);
+ font-size: 1rem;
+ line-height: 1;
+ cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ transition: color .15s ease, border-color .15s ease, background .15s ease;
+}
+.device-remove:hover,
+.device-remove:focus-visible {
+ color: #ff6b6b;
+ border-color: rgba(139, 0, 0, .6);
+ background: rgba(139, 0, 0, .12);
+}
.remote-section { margin-top: 16px; }
.remote-section .section-title { margin-bottom: 8px; }
diff --git a/assets/app.js b/assets/app.js
index 4806ebe..105f774 100644
--- a/assets/app.js
+++ b/assets/app.js
@@ -195,12 +195,18 @@
const html = devices.map((d, i) => {
const selected = d.ip === state.selectedIp ? ' is-selected' : '';
- const offline = d.port_open ? '' : ' is-offline';
+ const discovered = d.discovered !== false; // default true for backcompat
+ const offline = (!d.port_open && !d.adb_state) ? ' is-offline' : '';
const name = d.name ? escapeHtml(d.name) : 'Unknown device';
const ip = escapeHtml(d.ip);
- const portBadge = d.port_open
- ? 'Port 5555 open'
- : 'Not found on scan';
+ let portBadge = '';
+ if (d.port_open) {
+ portBadge = 'Port 5555 open';
+ } else if (!discovered) {
+ portBadge = 'Not found on scan';
+ } else {
+ portBadge = 'Port 5555 closed';
+ }
const adbState = d.adb_state || (isAdbConnected(d.ip) ? 'device' : '');
const adbBadge = adbState
? `ADB: ${escapeHtml(adbState)}`
@@ -208,24 +214,58 @@
const seen = d.last_seen ? `Seen: ${escapeHtml(fmtTime(d.last_seen))}` : 'Never seen';
const delay = Math.min(i * 30, 300);
return `
-