5 Commits

Author SHA1 Message Date
Alex Howells 5cd265ae52 feat(network): add custom NTP/HTTP time sync configuration UI (#1289)
* feat(network): add custom NTP/HTTP time sync configuration UI

Closes #516, #645, #59

The backend supports custom NTP servers, HTTP URLs, source ordering,
parallel queries, and fallback control for time synchronization, but the
frontend only exposes three presets (NTP only, NTP and HTTP, HTTP only).
Users who need to specify their own NTP server — the core ask in all
three linked issues — have no way to do so through the UI.

Add a "Custom" option to the time sync dropdown. When selected, a card
appears with input fields for NTP servers and HTTP URLs, following the
same list-with-add/remove pattern used by the static IPv4 DNS fields.

This is a simplified alternative to #1102 which exposed every backend
field (source ordering, parallel queries, disable fallback) as direct
UI controls. That PR stalled for 3 months due to complexity concerns
and UX debate. This PR ships the functionality users actually requested
— custom NTP servers — with a minimal UI surface:

  #1102: 753 additions, 15 files, new Combobox modifications
  This:  ~120 additions, 18 files (13 are localization)

The advanced fields (TimeSyncOrdering, TimeSyncParallel,
TimeSyncDisableFallback) retain their backend defaults and can be
surfaced in a follow-up if there is demand.

Backend changes:

  confparser.go — add hostname_or_ipv4_or_ipv6 validation type so NTP
  server fields accept hostnames like pool.ntp.org, not just raw IPs.

  config.go — change TimeSyncNTPServers validation from ipv4_or_ipv6
  to hostname_or_ipv4_or_ipv6.

Frontend changes:

  CustomTimeSyncCard.tsx — new component with NTP server list and HTTP
  URL list, field validation, add/remove controls.

  stores.ts — add optional time_sync_ordering, time_sync_ntp_servers,
  time_sync_http_urls, time_sync_disable_fallback, time_sync_parallel
  to NetworkSettings interface.

  network settings page — uncomment Custom option, render card when
  time_sync_mode is custom.

Translations added for all 13 supported languages.

* fix(timesync): address review feedback on custom NTP UI

1. filterNTPServers: pass hostnames through instead of dropping
   them. net.ParseIP() returns nil for hostnames like
   pool.ntp.org, causing them to be silently skipped. The NTP
   library handles DNS resolution itself, so hostnames are valid
   entries.

2. getSyncMode: when TimeSyncMode is "custom", default the
   ordering to [ntp_user_provided, http_user_provided, ntp_dhcp,
   ntp, http] so user-provided servers are actually queried. The
   previous hardcoded default never included *_user_provided
   entries, rendering custom servers unreachable.

3. Stale config pointer: add SetNetworkConfig() on TimeSync and
   call it from rpcSetNetworkSettings after config.NetworkConfig
   is replaced. Without this, TimeSync holds a stale pointer and
   ignores runtime config changes until restart.

4. DNS vacuous truth: guard .every() calls on ipv4/ipv6 DNS
   dirty arrays with .length > 0 checks. [].every() returns true
   in JS, causing empty DNS arrays to falsely appear in the
   confirmation dialog.

Signed-off-by: Alex Howells <alex@howells.me>

* fix(timesync): ensure custom mode uses user-provided servers and re-syncs on settings change

Move TimeSyncOrdering override before the mode switch so "custom" mode
always sets the correct ordering with ntp_user_provided first, preventing
stale ordering values from overriding it. Trigger an immediate time sync
when network settings are saved so users don't have to wait for the
hourly cycle or reboot.

---------

Signed-off-by: Alex Howells <alex@howells.me>
Co-authored-by: Adam Shiervani <adam@jetkvm.com>
2026-03-29 12:16:52 +02:00
Aveline c775979ccb feat: refactoring network stack (#878)
Co-authored-by: Adam Shiervani <adam.shiervani@gmail.com>
2025-10-15 18:32:58 +02:00
Marc Brooks 3ec243255b Add ability to track modifier state on the device (#725)
Remove LED sync source option and add keypress reporting while still working with devices that haven't been upgraded
We return the modifiers as the valid bitmask so that the VirtualKeyboard and InfoBar can represent the correct keys as down. This is important when we have strokes like Left-Control + Right-Control + Keypad-1 (used in switching KVMs and such).
Fix handling of modifier keys in client and also removed the extraneous resetKeyboardState.
Manage state to eliminate rerenders by judicious use of useMemo.
Centralized keyboard layout and localized display maps
Move keyboardOptions to useKeyboardLayouts
Added translations for display maps.
Add documentation on the legacy support.

Return the KeysDownState from keyboardReport
Clear out the hidErrorRollOver once sent to reset the keyboard to nothing down.
Handles the returned KeysDownState from keyboardReport
Now passes all logic through handleKeyPress.
If we get a state back from a keyboardReport, use it and also enable keypressReport because we now know it's an upgraded device.
Added exposition on isoCode management

Fix de-DE chars to reflect German E2 keyboard.
https://kbdlayout.info/kbdgre2/overview+virtualkeys

Ran go modernize
Morphs Interface{} to any
Ranges over SplitSeq and FieldSeq for iterating splits
Used min for end calculation remote_mount.Read
Used range 16 in wol.createMagicPacket
DID NOT apply the Omitempty cleanup.

Strong typed in the typescript realm.
Cleanup react state management to enable upgrading Zustand
2025-08-26 17:09:35 +02:00
Daniel Collins ef95643a86 Implement HTTP proxy option (#515). (#521)
This commit adds a "Proxy" field to the network settings screen, which
can be used to specify a HTTP proxy for any outgoing requests from the
device.
2025-07-11 17:43:22 +02:00
Aveline 189b84380b network enhanecment / refactor (#361)
* chore(network): improve connectivity check

* refactor(network): rewrite network and timesync component

* feat(display): show cloud connection status

* chore: change logging verbosity

* chore(websecure): update log message

* fix(ota): validate root certificate when downloading update

* feat(ui): add network settings tab

* fix(display): cloud connecting animation

* fix: golintci issues

* feat: add network settings tab

* feat(timesync): query servers in parallel

* refactor(network): move to internal/network package

* feat(timesync): add metrics

* refactor(log): move log to internal/logging package

* refactor(mdms): move mdns to internal/mdns package

* feat(developer): add pprof endpoint

* feat(logging): add a simple logging streaming endpoint

* fix(mdns): do not start mdns until network is up

* feat(network): allow users to update network settings from ui

* fix(network): handle errors when net.IPAddr is nil

* fix(mdns): scopedLogger SIGSEGV

* fix(dhcp): watch directory instead of file to catch fsnotify.Create event

* refactor(nbd): move platform-specific code to different files

* refactor(native): move platform-specific code to different files

* chore: fix linter issues

* chore(dev_deploy): allow to override PION_LOG_TRACE
2025-04-16 01:39:23 +02:00