[feat](trx-frontend-http): virtual channel manager and picker UI

Add client-side virtual channel support (Phase 1 — metadata only):

- vchan.rs: ClientChannelManager keyed by rig_id; tracks per-session
  channel subscriptions and broadcasts list changes via change_tx
- server.rs: instantiate Arc<ClientChannelManager> and expose as app_data
- api.rs: wire ClientChannelManager into /events SSE (session UUID,
  init_rig, update_primary, channel change stream, session cleanup on
  disconnect); add channel CRUD routes:
    GET/POST /channels/{rig_id}
    DELETE   /channels/{rig_id}/{channel_id}
    POST     /channels/{rig_id}/{channel_id}/subscribe
    PUT      /channels/{rig_id}/{channel_id}/freq|mode
- auth.rs: classify /channels/ prefix as Read access
- plugins/vchan.js: channel picker with +/× buttons, subscribe on click,
  SDR-only (shown when filter_controls capability is set)
- app.js: handle SSE `session` and `channels` events, call
  vchanApplyCapabilities from applyCapabilities
- index.html: #vchan-row div + <script src="/vchan.js">
- style.css: .vchan-picker pill styles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-11 07:00:22 +01:00
parent dda5ec17bb
commit e5aa74a1b6
11 changed files with 816 additions and 8 deletions
@@ -303,6 +303,7 @@ function applyCapabilities(caps) {
sdrSquelchSupported = false;
}
updateSdrSquelchControlVisibility();
if (typeof vchanApplyCapabilities === "function") vchanApplyCapabilities(caps);
}
const freqEl = document.getElementById("freq");
@@ -2738,6 +2739,12 @@ function connect() {
es.addEventListener("ping", () => {
lastEventAt = Date.now();
});
es.addEventListener("session", evt => {
if (typeof vchanHandleSession === "function") vchanHandleSession(evt.data);
});
es.addEventListener("channels", evt => {
if (typeof vchanHandleChannels === "function") vchanHandleChannels(evt.data);
});
es.onerror = () => {
// Check if this is an auth error by looking at readyState
if (es.readyState === EventSource.CLOSED) {