* only bulk-mark devices offline on client disconnect when lazy ping is enabled
the OnRealtimeConnectRequest hook re-stamped every shutdown-capable
device as offline whenever the last realtime client disconnected, even
with lazy ping disabled where the ping cron keeps statuses fresh. this
overwrote the records' updated autodate, which the UI surfaces as the
'offline since' time, so a dashboard close looked like every device had
just powered off. the saves were also silent, so the unified /logs page
gave no hint.
- skip the offline transition entirely when lazy ping is disabled
- leave already-offline devices untouched so their offline-since
timestamp keeps its real meaning
- log an info event when the sweep actually marks devices offline
Fixes#1768
* fix group wake/shutdown for devices in multiple groups
the group handlers filter with groups.id = {:grpId}, which on a
multi-relation field requires every group to match. devices in more
than one group therefore never matched and were skipped by the group
wake and shutdown buttons. use ?= to match on any group.
Fixes#1770
* feature: Support use of FQDN resolution with DNS and mDNS
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
* - fixed `cronjobs.go` call to `port.Set()`
- refactored lots of the new code and fixed errors
- added validation functions into `validate.go` to handle unicode FQDN and punycode
- fixed memory leak from not closing avahi server connection by establishing permanent connection
- updated regex used in on device form and PB validation pattern to accept international unicode FQDN or IPv4 addresses
- updated regex used for netmask validation on form
- timeout mDNS queries after 2 seconds
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
* fix: remove unintentional change
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
* perform FQDN/IP validation in Svelte instead of HTML form
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
* disable IP tracking if field value does not match regex for IPv4
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
* fix: port state not always saved, don't resolve deviceIP for every port
* send wol packets also to broadcast
* fix: handle lowercase string comparision
---------
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
Co-authored-by: Maxi Quoß <maxi@quoss.org>
* feat: optional per-device ip address tracking via periodic arp scan
Adds a per-device "Track IP address" toggle (disabled by default) and a
global cron interval setting. When enabled, upsnap periodically arp-scans
the local subnets of opted-in devices with nmap and updates a device's ip
address whenever its mac address is found at a different one. Subnets are
skipped unless directly attached to the host, so routed devices are never
scanned. Uses the same nmap + CAP_NET_RAW requirements as the existing
network scan feature; no new privileges needed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: cover ip tracking subnet helpers and nmap xml parsing
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor: extract ip tracking into its own package and expand test coverage
Move the arp scan sweep out of cronjobs into a new iptracking package with
two entry points: TrackAllSubnets (the cron sweep) and TrackOneSubnet (a
single validated scan). Device lookup is now by mac address across all
tracked devices, with updates constrained to the device's own subnet.
The scannability check becomes networking.ValidateScannableSubnet, which
reports why a subnet can't be scanned and accepts any subnet overlapping a
directly attached network, so sub-blocks of an attached prefix are now
scannable. The mac-to-ip mapping moves to networking as Nmaprun.MacToIP.
Cover the subnet guard, mac normalization, skip paths, and sweep
orchestration with tests against a stubbed scanner and a real migrated
schema.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat: pause tracking sweeps while nobody is connected
With lazy_ping turned on, the periodic tracking sweep now skips its tick
while no realtime clients are connected, just like the ping cron, and owes
a catch-up sweep to the next client that connects: the realtime connect
hook runs one sweep only when a tick was actually skipped (or none has run
since boot), so page reloads during active use trigger nothing. This
extends lazy_ping's meaning from "pause pings when idle" to "pause
periodic network activity when idle"; the setting's description is updated
accordingly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* ui: move lazy ping section below ip tracking in settings
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* disable toggle when tracking is disabled
* fix: load private store
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Maxi Quoß <maxi@quoss.org>