* ui: migrate from Create React App to Vite
react-scripts 5 is unmaintained and pins vulnerable versions of
webpack-dev-server, webpack-dev-middleware, postcss 7 and svgo.
- build and dev server: Vite 8 with @vitejs/plugin-react
- tests: Vitest 4 with jsdom (jest.* -> vi.*; mocked default exports
now return { default })
- index.html moves to ui/ and loads src/index.jsx as a module
- REACT_APP_ENVIRONMENT is replaced by import.meta.env.PROD/MODE, and
REACT_APP_AGENT_API_PORT is renamed to VITE_AGENT_API_PORT
- bundled output goes to static/ so it does not mix with public/assets
- package.json is not "type": "module": that would switch CommonJS
interop to Node semantics and break default imports such as
@giantmachines/redux-websocket
- sass 1.54 -> 1.108 (Vite needs the modern compiler API); sass-loader
removed
- requires Node >= 20.19
`yarn build` still writes to machinery/www, so the Dockerfile and CI
workflow are unchanged.
Clears the remaining 9 react-scripts Dependabot alerts. Five alerts for
svgo 1 and decode-uri-component 0.2 remain; they come from build-tool
dependencies of @kerberos-io/ui and are not part of the bundle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ui: vendor @kerberos-io/ui 1.77.1 to clear the last Dependabot alerts
@kerberos-io/ui 1.77.1 moves its build tools (@svgr/webpack,
svg-react-loader, sass-loader, Storybook, Rollup plugins) out of its
runtime dependencies. Those pulled svgo 1 and decode-uri-component 0.2
into the agent's lockfile.
1.77.1 is tagged on GitHub but was never published to npm, so install
it from a tarball built from kerberos-io/ui@ae1faa7 (tag v1.77.1) and
committed under ui/vendor. Compared with the published 1.77.0 the
exports are identical; the only code change is the bundled uuid (8 -> 11).
The Dockerfile copies ui/vendor before `yarn --frozen-lockfile`.
ui/vendor/README.md records the checksum and how to switch back to the
registry once a fixed version is published.
Clears the remaining 5 Dependabot alerts (svgo, decode-uri-component).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ui: install @kerberos-io/ui 1.77.1 from its GitHub release
Replace the vendored tarball with the one attached to the kerberos-io/ui
v1.77.1 GitHub release, as uug-ai/factory already does. That tarball is
built by the ui repo's release workflow and ships with a .sha256 file
(e9f94f44...); yarn.lock pins it by hash.
Its JS is identical to the locally built tarball, and its CSS differs
only in selector order within @extend-generated rules.
This removes ui/vendor and the extra COPY line in the Dockerfile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ui: address lint findings in the Vite migration
- vite.config.mjs: disable import/no-unresolved; eslint-plugin-import 2.x
cannot resolve packages that only define "exports" (vite, plugin-react)
- ui/README.md: turn the scripts table into a list to keep lines short
- README.md: wrap the edited UI paragraph
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
golang:1.26-trixie now resolves to Go 1.26.11, which rejects C archives
that contain LLVM bitcode:
disallowed LTO section ".llvmbc" in #cgo LDFLAGS:
.../moq-go-ffi@v0.3.7/moq/lib/linux_arm64/libmoq_ffi.a
Every moq-go-ffi v0.3.x release ships such archives, so `go build -tags moq`
fails in the Docker build on amd64 and arm64. There is no opt-out. Only
moq-ffi v0.4.27+ (module moq.dev/moq-ffi, used by moq.dev/moq v0.7) is clean,
which needs a migration of the MoQ code.
Pin the build image to golang:1.26.10-trixie and set GOTOOLCHAIN=go1.26.10
in the devcontainer, where verify-moq-devcontainer.sh builds with -tags moq.
The Go CI workflow builds without the moq tag and stays on 1.26.x.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- MQTT verify: accept rtsp_transport in the verify payload and fall back
to the configured transport, like the RTSP url already does, so unsaved
transport choices can be verified from Kerberos Hub.
- RTSPS + forced UDP: fail fast with a clear error when the camera does
not offer SRTP, instead of every SETUP failing with "unable to setup
secure UDP" (which Connect only logs). "auto" already picks TCP here.
- Backchannel: always use TCP. gortsplib's auto fallback only triggers
when no packets are received, which never happens on a send-only
backchannel, and talk-back over UDP is not validated on hardware.
- UDP read buffer: request 4 MiB, capped at net.core.rmem_max, because
gortsplib fails the SETUP when it cannot get the exact size requested.
- Logging: route gortsplib's transport-switch messages through the
structured logger and log the negotiated transport per stream.
- README: document the transport options and their caveats.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
machinery (Go):
- google.golang.org/grpc 1.72.1 -> 1.83.2 (incl. critical :path authz bypass)
- go.opentelemetry.io/otel/* 1.36.0 -> 1.47.0
- go.mongodb.org/mongo-driver 1.17.3 -> 1.17.7
- github.com/klauspost/compress 1.16.7 -> 1.20.2
- github.com/eclipse/paho.mqtt.golang 1.5.0 -> 1.5.1 (govulncheck)
- golang.org/x/net 0.57.0 -> 0.62.0 (govulncheck)
otel 1.47 and x/net 0.62 require Go 1.26, so the build image,
devcontainer and CI move from 1.25 to 1.26.
ui:
- axios 0.21.4 -> 0.33.0 (stays on the 0.x API)
- drop unused i18next-http-backend (app uses i18next-xhr-backend)
- replace uuidv4 with uuid 11
- refresh vulnerable transitive packages to the newest in-range versions
and add resolutions for @tootallnate/once, serialize-javascript, uuid
- refresh @babel/compat-data and helper-compilation-targets so the newer
browserslist targets are recognised by the build
Remaining alerts (webpack-dev-server 4, webpack-dev-middleware 5,
postcss 7, svgo 1, decode-uri-component 0.2) are pinned by
react-scripts 5 and only affect the dev server and build tooling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runTusUpload also serves direct Kerberos Vault uploads. A 429 from a vault
now keeps the existing in-cycle retries instead of ending the attempt, so it
does not advance the vault's retry budget or secondary-storage failover
early, and it never sets the Hub upload pause. Hub uploads still stop at
once and pause until Retry-After (review feedback).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kerberos Hub will answer a recording upload with 429 Too Many Requests and
Retry-After (start of the next day or month in the organisation's
timezone) when the organisation is over its upload limit. Until now the
agent kept the recording and retried every 5 seconds all night.
- A shared, mutex-guarded upload pause (upload_pause.go) holds the
deadline. Retry-After is parsed in both RFC 9110 forms (delay-seconds
and HTTP-date, the latter measured against the response Date header).
Values are clamped to [5 s, 32 days]; a 429 without a usable
Retry-After backs off exponentially from 5 s up to 15 minutes.
- The tus path (create, HEAD, PATCH) and the legacy HEAD/POST on
/storage/upload report 429; the tus loop stops retrying on 429 and
keeps its resume state.
- HandleUpload waits for the pause before touching the queue again.
Recordings and markers stay on disk; the order is unchanged.
- One log line when the pause starts and one when Hub accepts uploads
again. Heartbeats, live view and MQTT are untouched; other status codes
and older Hub versions behave as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Accumulate gated and discarded sample durations, including previously queued skips, and advance Pion's clock without filler packets before the recovery IDR. Verify exact outgoing RTP timestamp deltas for PLI, FIR, reconnects, and queue overflow.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Gate each video viewer on a fresh IDR after transport connection or recovery, translate viewer PLI/FIR into rate-limited RTSP PLI requests, and preserve keyframe metadata through sample buffering. Add transport, lifecycle, concurrency, and source-routing regressions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The agent hard-coded TCP (interleaved) for every camera connection, so
cameras and networks that only work well over UDP could not be used and
there was no way to let the client negotiate the transport.
Add an optional capture.ipcamera.rtsp_transport setting, also available
as AGENT_CAPTURE_IPCAMERA_RTSP_TRANSPORT, with these values:
- tcp (default, also used when unset): unchanged behaviour
- udp: force RTP over UDP
- auto: let gortsplib try UDP first and fall back to TCP
Unknown values log a warning and fall back to TCP so a typo cannot break
an existing deployment. The setting is applied to the main, sub and
backchannel clients and to both camera verification paths (HTTP and
MQTT). The Settings page gets a transport dropdown next to the RTSP URLs
and the verify request forwards the selected value, so unsaved choices
can be tested. The README documents the new variable.
Tests cover the transport-to-protocol mapping and the environment
override.
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Avoid dereferencing the nil client returned when Hub credentials are absent. Log the disabled worker and cover enabled, disabled, and offline configurations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Encoders and NVRs expose several media profiles per video input, so
always using the first profile drives the camera on channel 1. Add a
1-based onvif_channel setting (config file, configmap, MongoDB, env var
AGENT_CAPTURE_IPCAMERA_ONVIF_CHANNEL, and onvif_credentials in the HTTP
API). The channel is resolved by grouping GetProfiles results by video
source; 0/unset keeps the existing first-profile behaviour.
PTZ, zoom, presets, position and focus now use the configured channel,
and the Hub heartbeat reads presets from it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep successful upload creation sessions usable when the optional response body is interrupted, while still requiring Location. Preserve the latest failure across retries and add regression coverage and documentation.
Include up to 4 KiB of server error responses and retain the latest failure cause when retries are exhausted. Add coverage for Hub and Vault creation failures and document provider troubleshooting and the temporary ordinary-upload workaround.
Backfill missing S3 checkpoint descriptions from validated legacy filenames while preserving checkpoint values, timestamp, and device key. Skip recordings deleted during directory scans while continuing to report other errors. Add regression coverage and document the metadata fallback.
Store new recordings in UTC date directories with stable timestamp-device filenames, moving recording attributes into upload checkpoints. Use checkpoint metadata for S3 keys and HTTP/tus uploads, rejecting invalid S3 checkpoints instead of silently falling back.
Support flat and dated layouts across listing, playback, uploads, cleanup, and decryption while retaining legacy filename compatibility.
Use the filename's recording timestamp to build username/yyyy/mm/dd object keys, keeping retries consistent across midnight. Reject malformed filenames and timestamps, add date-layout coverage, and document compatibility with historical objects.
Add "focus" and "autofocus" ONVIF actions, sent through navigate-ptz in
the same shape as zoom:
{"action":"focus","payload":{"focus":0.5}} positive = near, -1..1
{"action":"autofocus","payload":{}}
Focus goes through the ONVIF imaging service and is handled before the
PTZ configuration lookup, so it also works on fixed cameras with a
motorised lens. A focus nudge switches the camera to MANUAL focus;
autofocus hands control back.
Cameras differ in which focus moves they support, so the move type is
picked from GetMoveOptions: a continuous move for 500 ms then stop (as
ContinuousZoom), else a relative step, else an absolute step from the
current lens position (Axis only supports absolute moves).
Autofocus toggles MANUAL -> AUTO to force a fresh focus cycle. It
reports an error when the camera does not advertise AUTO, or accepts
AUTO but keeps reporting MANUAL (seen on Dahua).
The imaging requests carry only the focus fields, because the onvif
library's request types serialise every field. Some Axis firmware
rejects a SetImagingSettings that only carries Focus, so that request is
retried once with the current brightness. Rejected requests include the
camera's SOAP fault reason in the error.
Also add POST /api/camera/onvif/focus, mirroring /api/camera/onvif/zoom.
Hub: needs an adjustable focus step. How far one nudge moves the lens
differs a lot between cameras: one full-speed nudge crossed the whole
focus range on an Avigilon, while three barely moved another camera.
The agent uses the focus value (-1..1) as the speed / step size, so Hub
should let users set it (e.g. a focus step or speed control) instead of
sending a fixed value.
Tested against Axis, Dahua, Avigilon and two other ONVIF cameras.
Use port 8082 for UI development endpoints, VS Code debugging, and devcontainer forwarding. Allow overriding the UI API port with REACT_APP_AGENT_API_PORT and document the matching backend setup.
Require Hub and persistence verification URIs to match the saved configuration and reject redirects to prevent credential leakage. Add regression tests for unsaved URIs and cross-host redirects.
Check upload authorization without uploading a test video. Guard against missing S3 configuration, strip credentials on cross-host redirects, and clarify rejection errors. Add coverage for HEAD requests and status-specific messages.
Drop dependent H264/H265 frames after RTP gaps or decode errors until random access restores the reference chain. Detect H264 frame_num gaps and evict complete GOPs so lagging queue readers resume at keyframes. Add regression coverage.
Reduce the build job's contents permission to read and remove DockerHub authentication, since pull request builds only need to build the image locally.
v1.2.3 includes:
- kerberos-io/onvif#13: send WS-Security first in "both" auth mode, so
authenticated calls work again on WS-Security-only cameras.
- kerberos-io/onvif#14: register DeviceIO endpoints listed only in
GetServices, declare the tmd namespace, and marshal Unsubscribe as
wsnt:Unsubscribe.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Digital inputs and relay outputs were never reported for cameras that
accept the pull-point subscription but reject the pulls:
- PullMessages and Unsubscribe are now sent with WS-Addressing Action and
To headers. Some devices identify the subscription from wsa:To rather
than the request URL, and reject requests without it as NotAuthorized.
- The heartbeat now queries the relay outputs and digital inputs directly
whenever the subscriptions produce no I/O events, not only when no
subscription could be created. Pulls that fail, and devices that never
publish the initial I/O state, previously left the I/O list empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the old AbsolutePanTiltMoveFake logic, which zoomed out and then moved one axis at a time with fixed speeds, with a new MoveToPosition implementation.
The new flow:
- Tries a native AbsoluteMove when the camera advertises absolute position spaces.
- Polls the position to confirm the move, with overall and no-progress timeouts.
- Falls back to a closed-loop ContinuousMove that drives pan, tilt and zoom at the same time. Velocity is proportional to the remaining error, clamped between min and max limits.
- Always stops the camera after a failed or finished move and returns combined errors instead of dropping them.
- Validates the target (NaN/Inf) and rejects incomplete position responses.
AbsolutePanTiltMoveFake is kept as a continuous-only wrapper. AbsolutePanTiltMove and GetPTZFunctionsFromDevice now guard against an empty PTZConfiguration. Movement failures are now logged at error level.
Adds unit tests that use a fake PTZ client to cover the native path, the fallback paths, timeouts, stop cleanup and XML encoding of combined ContinuousMove velocities.
- Reject JSON null values and every Upload-* header.
- Reject tabs and all other control characters in values.
- Preserve configured header name casing on the wire.
- Strip custom headers, their manifest, Upload-Metadata and Vault
credentials on cross-host redirects for legacy and tus uploads.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>