Commit Graph

62 Commits

Author SHA1 Message Date
Adam Shiervani c8da5966a8 Bump version to 0.5.9 2026-05-04 11:19:56 +02:00
Adam Shiervani 4536a88b08 feat(release): upload app binary per SKU to R2 (#1432)
The cloud-api releases endpoint now resolves OTA artifacts under
app/<version>/skus/<sku>/, so each known SKU needs its own folder. Add
an APP_SKUS list (jetkvm-v2, jetkvm-v2-sdmmc) and have both dev_release
and release upload the same jetkvm_app binary (plus .sha256, plus .sig
for production) into every SKU folder. Keep APP_SKUS in sync with
KNOWN_SKUS in cloud-api/scripts/sync-releases.ts.

Show the planned R2 destination paths and SHA256 in the final pre-upload
prompt so the operator can verify destinations before pushing, mirroring
the rv1106-system release_r2.sh pattern. Also relax the existence
pre-flight (rclone lsf | grep -q .) so it catches the new skus/
subfolder layout.
2026-04-28 23:30:18 +02:00
Adam Shiervani d54309cfff Bump version to 0.5.8 2026-04-27 12:13:50 +02:00
Adam Shiervani 38bb8c0107 Bump version to 0.5.7 2026-04-09 11:49:31 +02:00
Adam Shiervani 8d4c29321f Bump version to 0.5.6 2026-03-31 11:25:38 +02:00
Adam Shiervani 238ab07d43 fix(test): add ota-upgrade-to-signed project to dev_release target (#1384) 2026-03-31 10:09:55 +02:00
Adam Shiervani a5bb97eb7b test(ota): add e2e test for upgrading to a signed release (#1373)
Validates that the locally-built binary can accept a GPG-signed OTA
update. Deploys the dev build, then serves the latest production binary
and its real signature via a mock update server. Runs in the regular
test_e2e lane — no signing key required.
2026-03-29 20:36:54 +02:00
Adam Shiervani eee6d728cd feat(e2e): add OTA upgrade-from-stable test (#1324)
Add a new E2E test that downloads the latest stable production binary
from api.jetkvm.com, deploys it to the device, then OTA-upgrades to
the locally-built binary with a config reset. This catches cross-version
upgrade regressions (config migrations, schema changes) that the
existing mock-only OTA tests cannot detect.
2026-03-24 16:02:02 +01:00
Adam Shiervani 1c1f7c32b2 fix(make): require JETKVM_REMOTE_HOST for release targets and clean up test commands (#1299)
- Require JETKVM_REMOTE_HOST in release, test_production_release, and
  dev_release so remote-agent hardware validation runs in all lanes.
- Always list --project=remote-agent explicitly (tests self-skip when
  env var is absent, keeping test_e2e usable without a remote host).
- Remove redundant npm ci in dev_release (already run by frontend target).
- Use $(BIN_DIR) consistently in _build_release_inner.

Made-with: Cursor
2026-03-16 15:21:37 +01:00
Adam Shiervani f0d3d76f93 fix(make): fix dev_release e2e test env vars and coverage (#1298)
The dev_release Playwright invocation had several bugs:
- BASELINE_BINARY_PATH pointed to the release binary instead of the baseline
- RELEASE_BINARY_PATH and TEST_UPDATE_VERSION were missing, causing OTA
  tests to throw immediately
- ota-specific-version project was not included

Switch to the OTA_ENV macro (matching test_e2e), require JETKVM_REMOTE_HOST
so remote-agent tests always run, and add ota-specific-version to cover all
non-signed e2e projects.

Made-with: Cursor
2026-03-16 14:59:46 +01:00
Adam Shiervani 15dc380062 fix: auto-recover USB gadget when host power-cycles (#1297)
* fix: auto-recover USB gadget when host reconnects (#128)

When the USB host reboots or disconnects, the UDC state becomes
"not attached" and never recovers. Add automatic recovery that detects
this state and rebinds the USB gadget, with rate limiting to avoid
thrashing. Also refactor keyboard HID file handling to support
force-reopen after rebind.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: move USB recovery logic to internal/usbgadget package

Extract ShouldAttemptUSBRecovery and its retry interval constant into
the internal/usbgadget package so the logic is testable without
importing the top-level kvm package. Reset the recovery timer in
updateUsbRelatedConfig to prevent auto-recovery from interfering
during the host's USB re-enumeration window after a deliberate
config change.

Made-with: Cursor

* feat(e2e): add JSON-RPC data channel support to test hooks

Expose the WebRTC RPC data channel through test hooks and add a
sendJsonRpc helper that sends a JSON-RPC request over the channel
and resolves via callback with timeout handling. This enables e2e
tests to invoke backend RPC methods directly.

Made-with: Cursor

* refactor(e2e): restructure tests with remote-agent suite

Move device-level e2e tests (config-reset, EDID, HTTPS, HDMI sleep,
LED, mouse, USB attach timing, USB device) into a consolidated
remote-agent suite that runs through a Go-based agent binary. Add a
separate Playwright project for remote-agent tests.

- Remove standalone spec files now covered by ra-all.spec.ts
- Rename login-rate-limit to zz-login-rate-limit so it runs last
  (avoids needing a post-test reboot to clear rate-limit state)
- Reorder welcome-password tests so validation runs first, reusing
  the onboarding state and saving an SSH reset cycle

Made-with: Cursor

* refactor(e2e): clean up test helpers and reduce duplication

Consolidate all test helpers into a single helpers.ts file, removing
the separate ota-helpers.ts. This gives every test file a single import
source and eliminates duplicated code across the test suite.

Key changes:
- Merge ota-helpers.ts into helpers.ts (mock server, binary deployment,
  device config, env var validation, triggerUpdate, withTempSignature)
- Remove duplicated rpc/restartAppViaSSH/waitForDeviceReady functions
  from ra-all.spec.ts in favour of shared imports
- Extract loginAndOpenSettings helper in settings-local-auth tests
- Extract getOTAEnvVars, toPreReleaseVersion, triggerUpdate, and
  withTempSignature to reduce boilerplate across OTA tests
- Remove unused verifyMouseWorks function and dead variables
- Strip redundant JSDoc that just restated type signatures
- Remove duplicated per-project use config from playwright.config.ts
  (already inherited from top-level)
- Convert dynamic imports in sshExec to top-level imports

Made-with: Cursor

* refactor(e2e): move binary deployment into Playwright globalSetup

Replace the shell-script deployment logic with Playwright's
globalSetup/globalTeardown hooks. When BASELINE_BINARY_PATH is set,
globalSetup deploys the binary, resets device config, reboots, and
captures pre-test logs. globalTeardown captures post-test logs.

This keeps the deployment lifecycle inside Playwright where it belongs,
and reduces test_core_e2e.sh to a thin wrapper that sets env vars.

Made-with: Cursor

* fix: retry HID file reopen after USB gadget rebind

After rebinding the DWC3 USB controller, the kernel needs a moment to
create the /dev/hidg* device nodes. The previous code attempted to
reopen the keyboard HID file immediately after rebind, which raced
with the kernel and failed with "no such device or address".

Add a retry loop (up to 10 attempts, 200ms apart) to wait for the
device nodes to appear before reopening the keyboard HID file.

Made-with: Cursor

* fix: harden USB gadget recovery after UDC unbind

Reset stale HID gadget handles after rebind, suppress transient HID-open errors during detach windows, and fall back to full gadget reconfiguration when simple UDC rebind does not restore keyboard HID promptly. Strengthen the remote-agent USB recovery E2E to verify both keyboard and mouse input recover after unbind with retry tolerance for host-side input node churn.

Made-with: Cursor

* refactor: simplify USB HID error handling and reduce hot-path overhead

- Use errors.Is with syscall.Errno instead of string matching in
  IsHIDTemporarilyUnavailableError (robust, zero-alloc)
- Cache USB state in usbReadyForHidReports instead of reading sysfs
  on every HID report
- Extract rpcHidReport wrapper to deduplicate 5 rpc*Report functions
- Fix openWithTimeout goroutine/fd leak on timeout
- Add USBStateNotAttached/USBStateUnknown constants, replace literals
- Deduplicate discoverJetKVMDevices by delegating to listInputDevices

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: run remote-agent e2e tests when JETKVM_REMOTE_HOST is provided

Made-with: Cursor

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:54:20 +01:00
Adam Shiervani 55f02ceab1 Bump version to 0.5.5 2026-03-09 14:11:03 +01:00
Adam Shiervani 8e7b6ce4e3 Fix/ota signature bypass (#1254)
* fix(ota): reject empty signature and require prerelease opt-in for bypass

Two OTA signature verification vulnerabilities:

1. Empty signature bypass: downloadSignature accepted a 0-byte response,
   which caused verifyFile to skip GPG verification entirely via the
   len(signature) > 0 guard. An attacker serving an empty .sig file
   could bypass signature checks on any stable release.

2. Prerelease bypass without opt-in: shouldBypassSignatureCheck only
   checked whether the remote version had a prerelease suffix, not
   whether the device had opted into the dev channel. A compromised
   server could push a version like "99.0.0-dev.1" to any device and
   skip signature verification regardless of include_pre_release setting.

Fixes:
- downloadSignature now returns an error when signature bytes are empty
- shouldBypassSignatureCheck takes includePreRelease param and requires
  it to be true before allowing prerelease bypass

Unit tests added for: empty signature, hash mismatch, non-200 sig
download, valid signature happy path, and prerelease opt-in table tests.

Made-with: Cursor

* test(e2e): add OTA signature edge case and prerelease rejection tests

Add wrong-key signature, empty signature, and prerelease-without-opt-in
E2E tests to catch signature bypass vulnerabilities on real devices.

Made-with: Cursor

* refactor(e2e): use Playwright projects and remove OTA shell scripts

Organize E2E tests into named Playwright projects (core, ota-signed,
ota-prerelease-unsigned, etc.) so each test suite can be run with
--project=<name>. Remove 5 OTA wrapper scripts that were just
boilerplate env-var setup, and inline them into the Makefile via a
shared OTA_ENV macro. Rename z-ota-* specs to ota-* now that ordering
is controlled by project selection, not alphabetical filename sorting.

Made-with: Cursor

* fix(ci): use Go 1.25 for golangci-lint to match build workflow

golangci-lint v2.1.6 (built with Go 1.24) panics when type-checking
code that requires Go 1.25. Align the lint workflow with build.yml
by using go-version: ^1.25.1 instead of oldstable.

Made-with: Cursor
2026-03-09 13:01:42 +01:00
Adam Shiervani f2e592a08d faster builds and test real prerelease ota 2026-03-06 10:45:10 +01:00
Adam Shiervani b4fbc0e26b Check for r2clone keys before update 2026-03-05 18:28:46 +01:00
Adam Shiervani 11b99d59fd Signed Releases (#1188)
* Implement GPG signature verification for OTA updates

- Added GPG signature verification to the OTA update process, ensuring that updates requiring signatures cannot be applied without them.
- Introduced a new GPGVerifier struct to handle fetching and verifying signatures.
- Updated the updateApp and updateSystem methods to check for signature URLs and download signatures as needed.
- Enhanced error handling for missing signatures and verification failures.
- Removed the old release.sh script as its functionality has been integrated into the Makefile for better release management.

* Add tests for GPG signature verification in OTA updates

* Refactor error message for missing GPG signature URL in OTA updates

* Refactor OTA update process to improve signature handling

- Introduced a new method for downloading component signatures, ensuring that updates requiring signatures cannot proceed without them.
- Updated the Makefile to allow E2E tests to optionally include OTA tests based on the SKIP_OTA_E2E variable.
- Enhanced the test_local_update.sh script to support signature file verification and inclusion during tests.
- Improved error handling for missing signature URLs and added context cancellation checks in GPG key fetching.

* Refactor GPG key caching to validate keyring before storing

* Update Makefile to enhance E2E test process with optional OTA signature verification

* Comment out non-working keyservers and update root key fingerprint

* Add Ubunutu keyserver

* Update root key fingerprint for GPG signature verification in OTA updates

* Add signed OTA E2E test and full E2E test suite to Makefile

- Introduced `test_e2e_signed` target for testing signed OTA updates with GPG signature verification.
- Added `test_e2e_full` target to run both regular and signed OTA tests, requiring a signing key fingerprint.
- Enhanced error handling for missing parameters in both test targets.

* Update IP address extraction in test_local_update.sh to exclude all localhost addresses

* Add GPG public key fetching tests with caching and error handling

* Enhance build and testing scripts for signed OTA updates

* Add fingerprint extraction and validation for GPG keys

* Simplify bypass mechanism of OTA signature checks

* Refactor E2E testing and release workflows

* Enhance OTA testing framework and scripts

* Improve local network IP detection in OTA helpers by implementing route-based detection as a primary method, falling back to interface scanning if necessary.

* Add support for unsigned OTA version testing

- Introduced a new script to test unsigned OTA updates with specific version checks.
- Updated Makefile to include the new test script for unsigned OTA.
- Enhanced existing E2E tests to validate version differences and ensure proper OTA behavior.
- Improved error handling for required environment variables in the testing framework.

* Update Makefile to include core E2E tests and enhance dev release validation

- Added `test_core_e2e.sh` script execution to both production and development release workflows.
- Improved user confirmation prompt before proceeding with the dev release.
- Added completion messages to indicate successful test execution and readiness for release.

* Enhance Makefile and testing scripts for improved OTA validation

- Added a new script execution for testing unsigned OTA updates in the Makefile.
- Updated E2E test configurations to exclude specific OTA tests and improve retry logic for video stream dimension retrieval.
- Refactored mouse round-trip tests to remove unnecessary settle time parameters.

* Final release confirmation of prod releases

* Cleanup OTA code: eliminate redundant parsing, TOCTOU, and duplication

- Remove double parseAndValidateKeyring call by threading validated
  keyring through fetchFromSingleKeyserver → fetchFromKeyservers →
  updateMemoryCache
- Extract getKeyring() helper to deduplicate VerifySignature and
  VerifySignatureFromFile preamble
- Replace os.Stat+os.Remove TOCTOU pattern with direct os.Remove
  ignoring os.ErrNotExist in downloadFile
- Remove unnecessary fs.existsSync in mock server handler; check
  signaturePath variable directly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* E2E: fix flaky tests, add unsigned OTA to dev test lane

- Fix mouse roundtrip flakiness by increasing MOUSE_SETTLE_MS (50→150ms)
- Export sshExec from helpers for ota-helpers.ts
- Reduce overly conservative delays (polling, animations, reconnects)
- Add waitForVideoDimensions helper with proper polling
- Improve ensureLocalAuthMode to try known passwords before SSH reset
- Add unsigned specific-version OTA test to `make test_e2e` target
- Build baseline + dev binary with pinned VERSION_DEV to avoid timestamp drift

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove stale dev_release checklist item from PR templates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 18:26:23 +01:00
Adam Shiervani d7963ed4b7 Bump version to 0.5.4 2026-02-07 22:12:01 +01:00
Adam Shiervani 8775dab2fa Bump version to 0.5.3 2026-01-07 19:13:56 +01:00
Adam Shiervani d1cecfe73a Add OTA Update E2E Tests (#1106)
* Implement local update testing framework with Makefile integration and E2E tests

- Added `scripts/test_local_update.sh` for orchestrating local OTA update tests.
- Modified `Makefile` to include a new `test_e2e` target that builds the binary and calls the new script.
- Created `ui/e2e/local-update-flow.spec.ts` for end-to-end testing of the update process.
- Enhanced UI components with `data-testid` attributes for better testability.
- Introduced `getCurrentVersion()` helper function to retrieve the app version from the `/metrics` endpoint.
- Ensured cleanup processes are robust, even on failure or interruption.

* Update Makefile and E2E test scripts for improved OTA testing and version management

- Bump version from 0.5.1 to 0.5.2 in the Makefile.
- Modify `test_e2e` target to use DEVICE_IP from environment or prompt for input.
- Replace `test_release_on_device.sh` with `test_local_update.sh` for consistency in testing.
- Enhance `test_local_update.sh` to include stable version retrieval from GitHub and improve logging.
- Remove deprecated `local-update-flow.spec.ts` and streamline E2E tests for better coverage.
- Refactor helper functions for clarity and maintainability in test scripts.

* Refactor E2E test scripts and Makefile for improved clarity and functionality

- Update `Makefile` to streamline the `test_e2e` target by removing unnecessary dependencies and simplifying the Playwright installation command.
- Enhance `scripts/test_local_update.sh` by cleaning up logging, removing redundant output, and improving the structure for better readability.
- Update E2E test scripts to remove excessive console logging, ensuring a cleaner output during test execution.
- Refactor test steps for better organization and clarity, particularly in the OTA update flow tests.
- Adjust Playwright configuration to enable step printing for better visibility during test runs.

* Fix linting errors
2025-12-29 13:21:34 +01:00
Adam Shiervani 8b18a1ccaf Update Makefile to explicitly pass VERSION_DEV and VERSION to nested make invocations for consistency in build outputs 2025-12-21 12:14:01 +01:00
Adam Shiervani a851e019e0 Fix crash when touchscreen device missing (#1077) 2025-12-18 09:47:55 +01:00
Adam Shiervani 428191b1d2 feat: basic automated e2e test (#1050) 2025-12-10 10:39:24 +01:00
Adam Shiervani 49ed6e78ec chore: enhance release process in Makefile to include previous release notes and create draft releases (#1046) 2025-12-08 15:19:36 +01:00
Adam Shiervani e2ece54e77 Bump version to 0.5.1 2025-12-08 15:12:02 +01:00
Adam Shiervani d89231aeec fix: Improve deployment script (#1043)
* chore: update Makefile for improved build process and add testing commands

* chore: add git checks to dev_release for branch and status validation

* chore: enhance dev_release with gh CLI checks and release creation

* chore: update dev_release to use versioned tags for Git and GitHub releases

* chore: refactor deploy script to use version argument and improve deployment process

* chore: update Makefile to version 0.5.0 and enhance release process with confirmation prompts and version bumping

* chore: enhance release process in Makefile with pre-release checks and user confirmation for production releases

* chore: refactor build process in Makefile to streamline development builds with a dedicated inner target

* chore: simplify build_release target in Makefile by removing frontend dependency

* chore: enable automatic version bumping in Makefile by uncommenting git commands

* chore: add pre-release testing prompts in Makefile for both development and production releases

* chore: update Makefile and test_release_on_device.sh to implement a new testing flow for pre-release validation

* chore: update Makefile to ensure consistent version handling in build and release processes
2025-12-05 16:09:05 +01:00
Siyuan 9c4a9e144f chore: bump version to 0.5.0-dev 2025-11-20 17:38:04 +00:00
Aveline 3fcd5e7def feat: move native to a separate process, again (#964) 2025-11-19 16:02:37 +01: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
Aveline 657a177462 feat: jetkvm native in cGo 2025-09-29 14:09:30 +02:00
Aveline 359778967f chore: remove msgpack from gin dependency (#833) 2025-09-26 08:52:07 +02:00
Siyuan Miao fe77acd5f0 chore: bump to 0.4.8 2025-09-22 12:51:19 +02:00
Siyuan Miao 1ffdca4fd6 build: use immediate assignment for VERSION_DEV and other vars 2025-09-18 15:41:39 +02:00
Siyuan Miao c6dba4d59f chore: bump to 0.4.7 2025-09-18 13:53:08 +02:00
Marc Brooks ca8b06f4cf chore: enhance the gzip and cacheable handling of static files
Add SVG and ICO to cacheable files.
Emit robots.txt directly.
Recognize WOFF2 (font) files as assets (so the get the immutable treatment)
Pre-gzip the entire /static/ directory (not just /static/assets/) and include SVG, ICO, and HTML files
Ensure fonts.css is processed by vite/rollup so that the preload and css reference the same immutable files (which get long-cached with hashes)
Add CircularXXWeb-Black to the preload list as it is used in the hot-path.
Handle system-driven color-scheme changes from dark to light correctly.
2025-09-12 08:41:41 +02:00
Aveline 6202e3cafa chore: serve pre-compressed static files (#793) 2025-09-11 19:17:15 +02:00
Adam Shiervani 8527b1eff1 feat: improve custom jiggler settings and add timezone support (#742)
* feat: add timezone support to jiggler and fix custom settings persistence

- Add timezone field to JigglerConfig with comprehensive IANA timezone list
- Fix custom settings not loading current values
- Remove business hours preset, add as examples in custom settings
- Improve error handling for invalid cron expressions

* fix: format jiggler.go with gofmt

* fix: add embedded timezone data and validation

- Import time/tzdata to embed timezone database in binary
- Add timezone validation in runJigglerCronTab() to gracefully fallback to UTC
- Add timezone to debug logging in rpcSetJigglerConfig
- Fixes 'unknown time zone' errors when system lacks timezone data

* refactor: add timezone field comments from jiggler options

* chore: move tzdata to backend

* refactor: fix JigglerSetting linting

- Adjusted useEffect dependency to include send function for better data fetching
- Modified layout classes for improved responsiveness and consistency
- Cleaned up code formatting for better readability

---------

Co-authored-by: Siyuan Miao <i@xswan.net>
2025-08-19 16:50:42 +02:00
Siyuan Miao bde0a086ab chore: bump to 0.4.7 2025-07-03 19:03:46 +02:00
Siyuan Miao fe127ed41c chore: bump version to 0.4.6 2025-06-25 13:28:09 +02:00
Caedis a1ed28c676 build: allow the versions in the Makefile to be overwritten with ENV variables (#619) 2025-06-16 11:30:57 +02:00
Siyuan Miao 772527849f chore: bump version to 0.4.4 2025-06-13 00:51:09 +02:00
Aveline b822b73a03 chore: use pure Go resolver and remove CGO_ENABLED=0 (#603) 2025-06-12 14:04:51 +02:00
Siyuan Miao 3cc119c646 chore: bump version to 0.4.3 2025-06-12 09:35:34 +02:00
Aveline c494cf26ef chore: disable cgo (#601) 2025-06-12 09:29:31 +02:00
Siyuan Miao 0cee284561 chore: bump version to 0.4.1 2025-05-22 11:17:00 +02:00
Siyuan Miao a60e1a5e98 chore: bump version to 0.4.0 2025-05-20 20:38:00 +02:00
Siyuan Miao 4e90883bf8 build: enable trimpath for both dev and prod releases 2025-05-20 20:28:40 +02:00
Siyuan Miao 354941b54d build: add trimpath to go build command 2025-05-20 20:18:21 +02:00
Aveline 5ba08de566 fix: unit test not returning error when test fails
* fix: unit test not returning error when test fails

* chore: add unit test to smoketest.yml

* fix: make linter happy
2025-05-19 22:51:11 +02:00
Siyuan Miao 17baf1647f chore: append package name to build script 2025-05-16 20:30:41 +02:00
Aveline fea89a0d23 chore: run golang tests 2025-05-16 19:53:01 +02:00