9740bc64c9
Firmware QEMU Tests (ADR-061) / QEMU Test (edge-tier1) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (full-adr060) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (tdm-3node) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / Swarm Test (ADR-062) (push) Has been skipped
npm packages / tools/ruview-mcp (node 22) (push) Failing after 1s
nvsim-server → ghcr.io / build-and-publish (push) Failing after 1s
ruview-swarm CI guard / tests (full+train) (push) Failing after 2s
Bench Regression Guard / bench compile-verify (--no-run) (push) Failing after 0s
Bench Regression Guard / bench fast-run (informational, non-gating) (push) Has been skipped
Firmware CI / Verify version.txt matches release tag (push) Has been skipped
Dashboard a11y + cross-browser / a11y (push) Failing after 0s
nvsim Dashboard → GitHub Pages / build-and-deploy (push) Failing after 2s
Firmware CI / Build firmware (esp32s3 / 4mb) (push) Failing after 15s
Firmware QEMU Tests (ADR-061) / Build Espressif QEMU (push) Failing after 1s
Firmware QEMU Tests (ADR-061) / Fuzz Testing (ADR-061 Layer 6) (push) Failing after 1s
Continuous Deployment / Pre-deployment Checks (push) Has been skipped
Firmware CI / Build firmware (esp32c6 / c6-4mb) (push) Failing after 15s
Firmware CI / Build firmware (esp32s3 / 8mb) (push) Failing after 15s
Firmware QEMU Tests (ADR-061) / QEMU Test (boundary-max) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (boundary-min) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (default) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / QEMU Test (edge-tier0) (push) Has been skipped
Firmware QEMU Tests (ADR-061) / NVS Matrix Generation (push) Failing after 1s
Security Scanning / Security Policy Compliance (push) Failing after 0s
Security Scanning / Dependency Vulnerability Scan (push) Failing after 0s
Security Scanning / Static Application Security Testing (push) Failing after 1s
Security Scanning / Infrastructure Security Scan (push) Failing after 1s
Security Scanning / Secret Scanning (push) Failing after 1s
npm packages / harness/ruview (node 22) (push) Failing after 17s
Security Scanning / License Compliance Scan (push) Failing after 1s
Security Scanning / Container Security Scan (push) Failing after 4s
three.js demos → GitHub Pages / build-and-deploy (push) Failing after 1s
Verify Pipeline Determinism / Verify Pipeline Determinism (3.11) (push) Failing after 1s
Fix-Marker Regression Guard / Verify fix markers (push) Failing after 1s
ADR-115 MQTT integration tests / mqtt-integration (push) Failing after 1s
npm packages / harness/ruview (node 20) (push) Failing after 1s
npm packages / tools/ruview-mcp (node 20) (push) Failing after 1s
npm packages / tools/ruview-cli (node 20) (push) Failing after 1s
npm packages / tools/ruview-cli (node 22) (push) Failing after 1s
BFLD MQTT Integration / cargo test --features mqtt (live mosquitto) (push) Failing after 29s
ruview-swarm CI guard / build train_marl bin (push) Failing after 2s
ruview-swarm CI guard / clippy (-D warnings, --no-deps) (push) Failing after 3s
ruview-swarm CI guard / tests (ruflo) (push) Failing after 1s
ruview-swarm CI guard / tests (train) (push) Failing after 2s
ruview-swarm CI guard / tests (default) (push) Failing after 2s
Point Cloud Viewer → GitHub Pages / build-and-deploy (push) Failing after 8s
ruview-swarm CI guard / ITAR / publish guard (push) Failing after 0s
wifi-densepose sensing-server → Docker Hub + ghcr.io / build · push · smoke-test (push) Failing after 1s
Continuous Deployment / Deploy to Production (push) Has been cancelled
Continuous Deployment / Rollback Deployment (push) Has been cancelled
Continuous Deployment / Post-deployment Monitoring (push) Has been cancelled
Continuous Deployment / Notify Deployment Status (push) Has been cancelled
Continuous Deployment / Deploy to Staging (push) Has been cancelled
Security Scanning / Security Report (push) Has been cancelled
135 lines
3.7 KiB
JavaScript
135 lines
3.7 KiB
JavaScript
// API Configuration for WiFi-DensePose UI
|
|
|
|
// Auto-detect the backend URL from the page origin so the UI works whether
|
|
// served from Docker (:3000), local dev (:8080), or any other port.
|
|
const _origin = (typeof window !== 'undefined' && window.location && window.location.origin)
|
|
? window.location.origin
|
|
: 'http://localhost:3000';
|
|
|
|
export const API_CONFIG = {
|
|
BASE_URL: _origin,
|
|
API_VERSION: '/api/v1',
|
|
WS_PREFIX: 'ws://',
|
|
WSS_PREFIX: 'wss://',
|
|
|
|
// Mock server configuration (only for testing)
|
|
MOCK_SERVER: {
|
|
ENABLED: false, // Set to true only for testing without backend
|
|
AUTO_DETECT: false, // Disabled — sensing tab uses its own WebSocket on :8765
|
|
},
|
|
|
|
// API Endpoints
|
|
ENDPOINTS: {
|
|
// Root & Info
|
|
ROOT: '/',
|
|
INFO: '/api/v1/info',
|
|
STATUS: '/api/v1/status',
|
|
METRICS: '/api/v1/metrics',
|
|
|
|
// Health
|
|
HEALTH: {
|
|
SYSTEM: '/health/health',
|
|
READY: '/health/ready',
|
|
LIVE: '/health/live',
|
|
METRICS: '/health/metrics',
|
|
VERSION: '/health/version'
|
|
},
|
|
|
|
// Pose
|
|
POSE: {
|
|
CURRENT: '/api/v1/pose/current',
|
|
ANALYZE: '/api/v1/pose/analyze',
|
|
ZONE_OCCUPANCY: '/api/v1/pose/zones/{zone_id}/occupancy',
|
|
ZONES_SUMMARY: '/api/v1/pose/zones/summary',
|
|
HISTORICAL: '/api/v1/pose/historical',
|
|
ACTIVITIES: '/api/v1/pose/activities',
|
|
CALIBRATE: '/api/v1/pose/calibrate',
|
|
CALIBRATION_STATUS: '/api/v1/pose/calibration/status',
|
|
STATS: '/api/v1/pose/stats'
|
|
},
|
|
|
|
// Streaming
|
|
STREAM: {
|
|
STATUS: '/api/v1/stream/status',
|
|
START: '/api/v1/stream/start',
|
|
STOP: '/api/v1/stream/stop',
|
|
CLIENTS: '/api/v1/stream/clients',
|
|
DISCONNECT_CLIENT: '/api/v1/stream/clients/{client_id}',
|
|
BROADCAST: '/api/v1/stream/broadcast',
|
|
METRICS: '/api/v1/stream/metrics',
|
|
// WebSocket endpoints
|
|
WS_POSE: '/api/v1/stream/pose',
|
|
WS_EVENTS: '/api/v1/stream/events'
|
|
},
|
|
|
|
// Development (only in dev mode)
|
|
DEV: {
|
|
CONFIG: '/api/v1/dev/config',
|
|
RESET: '/api/v1/dev/reset'
|
|
}
|
|
},
|
|
|
|
// Default request options
|
|
DEFAULT_HEADERS: {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json'
|
|
},
|
|
|
|
// Rate limiting
|
|
RATE_LIMITS: {
|
|
REQUESTS_PER_MINUTE: 60,
|
|
BURST_LIMIT: 10
|
|
},
|
|
|
|
// WebSocket configuration
|
|
WS_CONFIG: {
|
|
RECONNECT_DELAY: 5000,
|
|
MAX_RECONNECT_ATTEMPTS: 5,
|
|
PING_INTERVAL: 30000,
|
|
MESSAGE_TIMEOUT: 10000
|
|
}
|
|
};
|
|
|
|
// Helper function to build API URLs
|
|
export function buildApiUrl(endpoint, params = {}) {
|
|
let url = `${API_CONFIG.BASE_URL}${endpoint}`;
|
|
|
|
// Replace path parameters
|
|
Object.keys(params).forEach(key => {
|
|
if (url.includes(`{${key}}`)) {
|
|
url = url.replace(`{${key}}`, params[key]);
|
|
delete params[key];
|
|
}
|
|
});
|
|
|
|
// Add query parameters
|
|
const queryParams = new URLSearchParams(params);
|
|
if (queryParams.toString()) {
|
|
url += `?${queryParams.toString()}`;
|
|
}
|
|
|
|
return url;
|
|
}
|
|
|
|
// Helper function to build WebSocket URLs
|
|
export function buildWsUrl(endpoint, params = {}) {
|
|
// Match WebSocket protocol to page protocol: https → wss, http → ws.
|
|
// Previous logic forced wss:// on non-localhost HTTP, breaking LAN/Docker
|
|
// deployments served over plain HTTP. See issue #272.
|
|
const isSecure = window.location.protocol === 'https:';
|
|
const protocol = isSecure
|
|
? API_CONFIG.WSS_PREFIX
|
|
: API_CONFIG.WS_PREFIX;
|
|
|
|
// Derive host from the page origin so it works on any port (Docker :3000, dev :8080, etc.)
|
|
const host = window.location.host;
|
|
let url = `${protocol}${host}${endpoint}`;
|
|
|
|
// Add query parameters
|
|
const queryParams = new URLSearchParams(params);
|
|
if (queryParams.toString()) {
|
|
url += `?${queryParams.toString()}`;
|
|
}
|
|
|
|
return url;
|
|
} |