Devices: fixes from review round 5

- A switch publishes the new headset at once, so the page clears the old one's
  panels and the lists behind them (games, store, Android apps, screenshots).
- The page names the headset its changes are for (X-Frame-Device); the server
  refuses one meant for a headset it has switched away from (409).
- A rejected address edit changes nothing.
- Test now goes to the IPv4 address that answered, like the connection.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-28 22:14:25 +10:00
1 parent 9dd57cde4e
commit 41ac28248a
6 files changed
+62 -19

No files matched your search

+8 -3
View File
@@ -562,15 +562,20 @@ class Registry:
with self.lock:
d = self._find(device_id)
a = self._addr(d, host)
if new_host is not None and new_host != host:
# Check everything first: a rejected edit changes nothing.
moved = new_host is not None and new_host != host
if moved:
new_host = check_host(new_host)
if any(x["host"] == new_host for x in d["addresses"]):
raise DeviceError(f"{new_host} is already on the list")
kind = None if kind is None else check_kind(kind)
label = None if label is None else check_text(label, "label")
if moved:
a.update(host=new_host, networks=[], last_ok=None, last_rtt_ms=None) # a new place: learn again
if kind is not None:
a["kind"] = check_kind(kind)
a["kind"] = kind
if label is not None:
a["label"] = check_text(label, "label")
a["label"] = label
self.save()
return copy.deepcopy(a)