Commit Graph

676 Commits

Author SHA1 Message Date
Adam Shiervani bc1992ea13 refactor: fix infinite useEffect 2025-11-10 09:43:10 +01:00
Alex P d1824c5727 fix: improve microphone handling and cleanup
- Use mono audio instead of stereo for microphone input
- Add cleanup to stop audio track on component unmount
- Explicitly set AudioTrack to nil when creation fails
2025-11-09 13:39:38 +02:00
Alex P 41345b0527 refactor: use atomic.Pointer for thread-safe inputSource access
- Replace mutex-protected inputSource with atomic.Pointer for lock-free reads
- Eliminate ~100 mutex operations per second in audio packet hot path
- Add defer pattern for safer mutex unlock in enable/disable functions
- Add error logging for audio write failures
- Consolidate Makefile lint commands for brevity
2025-11-08 00:43:09 +02:00
Alex P 6078cdab66 fix: improve microphone reliability and auto-enable behavior
- Prevent concurrent getUserMedia requests to fix toggle flakiness
- Add automatic track recovery when microphone track ends unexpectedly
- Fix auto-enable to only trigger on session start, not when toggling setting
- Ensure backend RPC is sent when auto-enable triggers
- Properly clean up old tracks before requesting new ones
2025-11-07 14:20:59 +02:00
Alex P 336a75812f feat: add visual feedback for auto-enable microphone toggle
Added success notifications when toggling auto-enable microphone setting.
Includes translations for all supported languages.
2025-11-04 11:17:29 +02:00
Alex P ce4ea10551 fix: handle audio track recreation to prevent microphone failures
When browsers recreate audio tracks during long sessions, the backend
now properly handles the new track instead of ignoring it. Old track
handlers detect when they've been superseded and exit cleanly to
prevent goroutine leaks.
2025-11-04 10:40:35 +02:00
Alex P 3448663afa feat: persist audio preferences to backend config
- Add AudioInputAutoEnable and AudioOutputEnabled fields to backend config
- Implement RPC methods for get/set audio input auto-enable preference
- Load audio output enabled state from config on startup
- Make manual microphone toggle call backend to enable audio pipeline
- Auto-enable preference now persists across incognito sessions
- Reset microphone state to off when reaching login pages
- Fix issue where manual mic toggle required auto-enable to be on
2025-11-04 08:52:27 +02:00
Alex P 925b14da1e feat: add microphone auto-enable setting with session-based opt-in
Implement session-based microphone control with optional auto-enable:
- Microphone disabled by default, only requests permission when enabled
- Added persistent "Auto-enable Microphone" setting in audio settings
- Setting syncs to backend and works across browsers/devices
- Auto-enable respects secure context (HTTPS/localhost only)
- Refactored secure context check into reusable utility function
- Removed unused audioInputEnabled store properties
2025-11-03 22:09:39 +02:00
Adam Shiervani d0e6bb1ac6 feat: enhance audio settings UI and localization
Added new audio-related UI components and improved localization for multiple languages. The SettingsItem component now supports badge links and variants, enhancing the user experience. Updated the AudioPopover to include quick audio controls for speakers and microphone, with descriptions and HTTPS-only warnings where applicable.
2025-11-03 13:55:57 +01:00
Adam Shiervani 645b178d0d feat: add audio dependencies to Docker build context
Included the installation script for audio dependencies in the Docker build context preparation. This ensures that the necessary audio components are available during the build process.
2025-11-03 13:54:11 +01:00
Alex P 14b741c3dd temp: disable audio source selection while HDMI audio issues are diagnosed
Temporarily remove the ability to switch between HDMI and USB audio
output sources. The application now uses USB audio (hw:1,0) exclusively
until HDMI audio capture issues are resolved.

Changes:
- Remove AudioOutputSource config field
- Remove audio source switching logic and UI
- Hardcode USB audio output device
- Remove related RPC methods
2025-11-03 10:49:35 +02:00
Alex P de74ae1a12 fix: update default EDID to enable audio support
The previous default EDID did not advertise audio capabilities,
preventing HDMI audio capture from working. This update ensures
the JetKVM properly identifies itself to source devices and
enables audio capture out of the box.

Changes:
- Display identifies as "JetKVM HDMI" (manufacturer ID: JTK)
- Includes full audio support (2/6/8-channel LPCM, up to 192 kHz)
- Advertises all TC358743XBG capabilities (1080p60, YCbCr, Deep Color)

This allows HDMI audio to work by default without manual EDID
configuration.
2025-10-30 22:33:04 +02:00
Alex 2ea65c7a96
Merge branch 'dev' into feat/audio-support 2025-10-30 22:27:30 +02:00
Marc Brooks 4b049c4b7c
Add iputils-ping to install dependencies script (#917)
The new dev_deploy.sh uses ping to check if we can see the JetKVM, but mcr.microsoft.com/devcontainers/go:1.25-trixie does not have ping installed.
2025-10-30 09:53:32 +01:00
Alex P 516a953f41 Merge branch 'dev' into feat/audio-support 2025-10-30 02:14:30 +02:00
Marc Brooks 7955ee9d35
Improves OTA update reporting and process (#838) 2025-10-29 23:10:23 +01:00
Adam Shiervani 1ce63664c0
fix: video quality (#913) 2025-10-29 16:11:07 +01:00
Adam Shiervani 4b6e796a0e
fix: ensure proper redirection and page reload (#909) 2025-10-29 02:04:58 +01:00
Alex P eeacceb667 fix: wait for audio relay goroutine to exit before disconnecting source 2025-10-29 00:44:02 +02:00
Alex P 802166ba23 fix: use atomic.Bool for audio source to prevent mutex contention during switching 2025-10-29 00:26:48 +02:00
Alex P 4bc60c3f1b Updates: revert VERSION to 0.4.8 2025-10-28 22:36:52 +02:00
Alex P e7e6d7cb9d Updates: bump Makefile VERSION to 0.4.9 2025-10-28 22:32:18 +02:00
Alex P 65bbcf85ad fix: prevent race condition in audio output source switching by reading from in-memory state with proper synchronization 2025-10-28 22:11:11 +02:00
Adam Shiervani 79098d3546
feat: Enhance DHCP client timeout and retry logic (#908) 2025-10-28 18:50:29 +01:00
Adam Shiervani 50fc88aae1
bug: fix null pointer in wakeDisplay (#907) 2025-10-28 18:48:30 +01:00
Alex P cd7a098f76 fix: track audio autoplay status separately to handle Safari blocking audio while allowing video 2025-10-28 15:47:36 +02:00
Alex P ef86af8afc fix: enable audio playback via manual start stream button
Browser autoplay policy blocks audio without user interaction.
Store audio elements in ref and trigger playback when user clicks
the existing 'Manually start stream' button.
2025-10-28 14:28:30 +02:00
Adam Shiervani 204909b49a
feat: Add connectivity checks, ensure killing of jetkvm process, and disable SSH host key verification (#905) 2025-10-28 07:11:16 +01:00
Alex P b2a57a64e9 Merge branch 'dev' into feat/audio-support 2025-10-27 19:22:45 +02:00
Alex P be2bb518ed Merge branch 'dev' into feat/audio-support 2025-10-27 19:19:41 +02:00
Marc Brooks b1c788cc5e
chore/Automatically sort language files after machine-translate run (#902)
This should ensure that newly added strings are kept in their correct location so later changes yield clean GIT diffs.
Also bumped a couple minor dependencies
2025-10-27 16:34:07 +01:00
Adam Shiervani 71fe95bf57
More UI translations (#899)
* Enhance localization for reboot messages in multiple languages, including descriptions for device rebooting, IP address changes, and reconnection prompts in Danish, German, English, Spanish, French, Italian, Norwegian, Swedish, and Chinese.

* Update Swedish localization strings

* Update German localization strings

* Update Spanish localization strings

* Update Danish localization strings

* Update French localization strings

* Update Italian localization strings

* Update Norwegian localization strings

* Update Chinese localization strings

* sort translation keys

---------

Co-authored-by: Adam Shiervani <adamshiervani@fastmail.com>
2025-10-27 16:33:58 +01:00
Alex P 0f43a84551 fix: remove continuous sleep mode check to prevent audio interference
The continuous ensure_sleep_mode_disabled() call in the format detection
loop caused repeated I2C transactions to the TC358743, disrupting HDMI
audio capture. Sleep mode is already disabled once during video_init(),
which is sufficient.
2025-10-27 17:28:14 +02:00
Adam Shiervani ce9f95b8c8
refactor: ota redirecting (#898)
* refactor: improve URL handling in RebootingOverlay component

* refactor: enhance redirect URL handling in TryUpdate function

* refactor: disable old ota rebooting method in new version

* refactor: streamline version retrieval logic and enhance error handling in useVersion hook

* refactor: rename to RedirectTo

* fix: force page reload when redirecting from reboot actions

* refactor: consolidate sleep utility and update usages across components

* refactor: update JsonRpcCallOptions to use maxAttempts and attemptTimeoutMs, implement exponential backoff for retries

---------

Co-authored-by: Adam Shiervani <adamshiervani@fastmail.com>
2025-10-27 16:21:11 +01:00
Alex P 557b3bf3e6 Fix: app not loading via HTTP 2025-10-27 11:21:49 +02:00
Alex P 450836daba chore: revert golangci-lint config and remove audio stub
- Revert .golangci.yml to dev branch state (removed custom build-tags)
- Remove internal/audio/cgo_source_stub.go (not needed with proper cross-compilation)
- Fix import ordering in ui/src/utils.ts

Use 'make lint-go' for proper ARM cross-compilation environment.
2025-10-24 01:31:06 +03:00
Alex P 68b1bc54ce fix: add stub implementation for CGO audio on non-ARM platforms
Provides no-op AudioSource implementations for platforms that don't
support ARM CGO audio (x86_64, darwin, etc.). This allows golangci-lint
to run successfully on any platform without requiring ARM cross-compilation
toolchain.

The stub implementations return errors when called, ensuring that if
they're accidentally used at runtime on non-ARM platforms, it will fail
gracefully with a clear error message rather than undefined symbols.

Build constraints ensure the real CGO implementation is used on linux/arm
and linux/arm64, while stubs are used everywhere else.
2025-10-24 00:04:05 +03:00
Alex P 54cbd98781 fix: verify audio source change and show accurate feedback
After setting audio output source, fetch the actual value from backend
to verify the change was applied successfully. This prevents the UI
from showing incorrect state when the backend fails to apply the change.

The optimistic update provides immediate feedback, but we now verify
the actual result and show error if backend returned a different value
than expected.
2025-10-23 23:59:02 +03:00
Alex P 47782856f3 feat: add translations and fix audio settings page
Added comprehensive translations for audio settings page:
- Page title and description
- Audio output/input settings
- Audio source selector (HDMI/USB labels)
- Success/error messages for all operations
- Translations added for all 9 languages

Updated devices.$id.settings.audio.tsx:
- Import and use translation keys (m.audio_settings_*)
- Use existing audio_output_* and audio_input_* keys for notifications
- Fix dropdown not updating: update UI optimistically, revert on error
- This prevents the dropdown from appearing stuck after source change

The optimistic update pattern improves UX by immediately reflecting
the user's choice while the backend processes the change.
2025-10-23 23:56:15 +03:00
Alex P f75f5eb58d docs: document JetKVM ARMv7 architecture and lint requirements
Added documentation to .golangci.yml explaining:
- JetKVM uses ARMv7 (Rockchip RK3308, Cortex-A7) not ARM64
- golangci-lint should be run via 'make lint-go' not directly
- Audio CGO code requires cross-compilation environment from Makefile

The build-tags are explicitly listed to match the actual build configuration
used in the Makefile (netgo, timetzdata, nomsgpack).

Running 'make lint' or 'make lint-go' works correctly as it sets up
the full ARM cross-compilation environment with audio library dependencies.
2025-10-23 23:36:23 +03:00
Alex P c96c3e215a fix: use translation key for audio button in ActionBar
Changed hardcoded 'Audio' string to use m.action_bar_audio()
translation key for proper internationalization.
2025-10-23 23:26:23 +03:00
Alex P a20c13d7f3 fix: add AudioOutputSource field to Config struct
The audio.go file references config.AudioOutputSource but the field
was missing from the Config struct definition, causing type errors.

Added AudioOutputSource string field with json tag 'audio_output_source'
to support configuration of audio output source ('hdmi' or 'usb').
2025-10-23 23:24:44 +03:00
Alex P 9a82df662f feat: add proper translations for audio features across all languages
Added comprehensive translations for audio-related UI strings:
- Action bar audio button
- Audio popover (title, output/input settings)
- Enable/Disable button labels
- Success/error notification messages
- USB device audio preset labels

Translations added for all 9 supported languages:
- English (en)
- Danish (da)
- German (de)
- Spanish (es)
- French (fr)
- Italian (it)
- Norwegian Bokmål (nb)
- Swedish (sv)
- Chinese Simplified (zh)

Updated AudioPopover.tsx to use translation keys instead of
hardcoded English strings for all UI elements.

Total of 19 new translation keys per language:
- action_bar_audio
- audio_disable/enable
- audio_input_* (title, description, enabled/disabled, failed)
- audio_output_* (title, description, enabled/disabled, failed)
- audio_popover_title
- usb_device_enable_audio_* (title, description)
- usb_device_keyboard_mouse_mass_storage_and_audio
2025-10-23 23:22:38 +03:00
Alex P 55f40cb729 fix: move ipcMsgTypeOpus constant to source.go for cross-platform builds 2025-10-23 23:13:23 +03:00
Alex P 50b938d13e Merge dev into feat/audio-support
- Resolved conflicts in .gitignore, ActionBar, UsbDeviceSetting, and devices.$id.tsx
- Added audio-related translations to all language files:
  - action_bar_audio
  - usb_device_enable_audio_title
  - usb_device_enable_audio_description
  - usb_device_keyboard_mouse_mass_storage_and_audio
- Updated UI components to use localization messages
- Added separate USB preset for keyboard/mouse/storage without audio
- Kept OPUS_STEREO_PARAMS import from audio branch
- Preserved AudioPopover component from audio branch
2025-10-23 23:11:17 +03:00
Marc Brooks 9a4d061034
Localize the client/browser UI with inlang paraglide-js (#864) 2025-10-23 14:27:29 +02:00
Marc Brooks 374fc310d3
Merge branch 'dev' into feat/audio-support 2025-10-22 16:35:00 -05:00
Aveline 2444817455
chore: disable sleep mode when detecting video format (#887)
Co-authored-by: Adam Shiervani <adam.shiervani@gmail.com>
Co-authored-by: Adam Shiervani <adamshiervani@fastmail.com>
2025-10-17 17:51:02 +02:00
Alex P a81544070b Merge branch 'dev' into feat/audio-support
This merge integrates the latest dev branch changes while preserving all
audio support functionality. Key changes include:

- Network stack refactoring: migrated from internal/network to pkg/nmlite
- New NetworkManager architecture with jetdhcpc client
- Function-based config pattern to avoid shared pointer bugs
- Updated UI components for network settings
- GitHub workflow and PR templates

- config.go: Retained AudioOutputSource field in Config struct
- config.go: Kept Audio: true in defaultUsbDevices
- config.go: Set AudioOutputSource: "usb" as default
- config.go: Adopted dev's types.NetworkConfig import path
- config.go: Adopted dev's function-based getDefaultConfig() pattern

1. config.go Config struct: Combined audio fields with dev's network refactoring
2. config.go default config: Adopted dev's function-based pattern while preserving audio defaults
3. ui/src/utils/jsonrpc.ts: Fixed unused error variable in catch block

All linters pass with 0 errors and 0 warnings.
2025-10-17 00:33:32 +03:00
Adam Shiervani 74e64f69a7
Add stale issues and PRs workflow (#890) 2025-10-16 16:21:37 +02:00