This commit is contained in:
legop3
2026-07-10 23:20:09 -04:00
parent ee393adc8e
commit d777e3a48e
27 changed files with 1363 additions and 162 deletions
@@ -7,6 +7,7 @@ const { getMode, MODES } = require('../modeManager');
const { isAdmin, isLockdownAdmin, getRole } = require('../roleService');
const videoSessions = require('../videoSessions');
const roverManager = require('../roverManager');
const ptzCameraService = require('../ptzCameraService');
const { loadConfig } = require('../../helpers/configLoader');
const { getSocketIp, isLocalNetwork } = require('../../helpers/ipResolver');
@@ -34,6 +35,8 @@ function buildWhepUrlForSource(source) {
const segments = [];
if (source.type === 'room') {
segments.push('room', encodeURIComponent(source.id));
} else if (source.type === 'ptz') {
segments.push('ptz', encodeURIComponent(source.id));
} else {
segments.push(encodeURIComponent(source.id));
}
@@ -81,6 +84,9 @@ function normalizeRequest(payload = {}) {
if (payload.roomCameraId) {
return { type: 'room', id: String(payload.roomCameraId) };
}
if (payload.ptzCameraId || payload.type === 'ptz') {
return { type: 'ptz', id: String(payload.ptzCameraId || payload.id || ptzCameraService.PTZ_CAMERA_ID) };
}
return null;
}
@@ -109,6 +115,13 @@ io.on('connection', (socket) => {
}
} else if (target.type === 'room') {
throw new Error('Room cameras now use the snapshot feed');
} else if (target.type === 'ptz') {
if (target.id !== ptzCameraService.PTZ_CAMERA_ID) {
throw new Error('Unknown PTZ camera');
}
if (!ptzCameraService.canRequestLiveVideo(socket)) {
throw new Error('Not authorized for PTZ video');
}
} else {
throw new Error('Unsupported video source');
}