Skip to content

Commit 51e68cf

Browse files
matteiusclaude
andcommitted
chore: clean up legacy motion-recording debris (#374)
Followup on 878d3f3, which removed the separate "Motion Recording (ONVIF)" section from the stream config modal in favor of the unified AI Detection path (detection_model=onvif). That commit left a trail of orphans that were still showing up to users on v0.33.2 and causing "why are there two places to enable this?" confusion (titro in #374 before upgrading). Strictly a sweep — no functional change. - en.json + pt-BR.json: drop 19 translation keys that no longer resolve to any t() call: motionRecordingOnvif, enableOnvifMotionRecording, onvifMotionRecordingHelp, pre/postEventBufferSeconds/Help, maxFileDuration*, retentionPeriod*, recordingQuality, triggerTestMotionEvent, motionConfigSaveFailed, and the five streams.testMotionEvent*/errorTriggeringTestMotion strings that were only used by the dead triggerTestMotionEvent handler. - api_handlers_streams_get.c: stop emitting the `motion_config` field (the comment already called it "obsolete"; it was always null and nothing consumed it). - StreamsView.jsx: drop the two dead `const motion = data.motion_config || null` lines (unused local) and the `triggerTestMotionEvent` async handler that was wired to a button the modal no longer renders. - StreamConfigModal.jsx: drop the `onTestMotion` prop it never read. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8bb8e74 commit 51e68cf

5 files changed

Lines changed: 0 additions & 72 deletions

File tree

src/web/api_handlers_streams_get.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,6 @@ void handle_get_stream_full(const http_request_t *req, http_response_t *res) {
580580
}
581581
cJSON_AddItemToObject(response, "stream", stream_obj);
582582

583-
// Add obsolete motion config
584-
cJSON_AddNullToObject(response, "motion_config");
585-
586583
char *json_str = cJSON_PrintUnformatted(response);
587584
if (!json_str) {
588585
cJSON_Delete(response);

web/js/components/preact/StreamConfigModal.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ export function StreamConfigModal({
287287
onInputChange,
288288
onThresholdChange,
289289
onTestConnection,
290-
onTestMotion,
291290
onSave,
292291
onClose,
293292
onRefreshModels,

web/js/components/preact/StreamsView.jsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -641,33 +641,6 @@ export function StreamsView() {
641641
});
642642
};
643643

644-
// Trigger a simulated ONVIF motion event for the current stream
645-
const triggerTestMotionEvent = async () => {
646-
if (!currentStream?.name) {
647-
showStatusMessage(t('streams.setStreamNameAndSaveBeforeTestingMotion'), 'error', 5000);
648-
return;
649-
}
650-
if (!currentStream?.isOnvif) {
651-
showStatusMessage(t('streams.enableOnvifCameraFirst'), 'error', 5000);
652-
return;
653-
}
654-
try {
655-
// Now fire the test motion event
656-
const data = await fetchJSON(`/api/motion/test/${encodeURIComponent(currentStream.name)}`, {
657-
method: 'POST',
658-
timeout: 15000
659-
});
660-
if (data?.success) {
661-
showStatusMessage(t('streams.testMotionEventTriggeredSuccessfully'), 'success', 3000);
662-
} else {
663-
showStatusMessage(t('streams.testMotionEventFailed', { message: data?.message || t('common.unknown') }), 'error', 5000);
664-
}
665-
} catch (err) {
666-
showStatusMessage(t('streams.errorTriggeringTestMotion', { message: err.message }), 'error', 5000);
667-
}
668-
};
669-
670-
671644
// Open delete modal
672645
const openDeleteModal = (stream) => {
673646
setStreamToDelete(stream);
@@ -746,7 +719,6 @@ export function StreamsView() {
746719
staleTime: 0 // Always fetch fresh when opening modal
747720
});
748721
const stream = data.stream || {};
749-
const motion = data.motion_config || null;
750722

751723
setCurrentStream({
752724
...stream,
@@ -825,7 +797,6 @@ export function StreamsView() {
825797
staleTime: 0
826798
});
827799
const stream = data.stream || {};
828-
const motion = data.motion_config || null;
829800

830801
setCurrentStream({
831802
...stream,
@@ -1530,7 +1501,6 @@ export function StreamsView() {
15301501
onInputChange={handleInputChange}
15311502
onThresholdChange={handleThresholdChange}
15321503
onTestConnection={testStreamConnection}
1533-
onTestMotion={triggerTestMotionEvent}
15341504
onSave={handleSubmit}
15351505
onClose={closeModal}
15361506
onRefreshModels={loadDetectionModels}

web/public/locales/en.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -854,20 +854,7 @@
854854
"streamsConfig.zoneTipDrawPolygons": "Draw polygons by clicking points on the image",
855855
"streamsConfig.zoneTipIgnoreAreas": "Use zones to ignore areas like trees, roads, or sky",
856856
"streamsConfig.zoneTipMultipleZones": "Multiple zones can be configured for different areas",
857-
"streamsConfig.motionRecordingOnvif": "Motion Recording (ONVIF)",
858857
"streamsConfig.onvifOnly": "ONVIF Only",
859-
"streamsConfig.enableOnvifMotionRecording": "Enable ONVIF Motion Recording",
860-
"streamsConfig.onvifMotionRecordingHelp": "Record when the camera's built-in motion detection triggers. Uses ONVIF events from the camera.",
861-
"streamsConfig.preEventBufferSeconds": "Pre-Event Buffer (seconds)",
862-
"streamsConfig.preEventBufferHelp": "Video before motion event (0-30s)",
863-
"streamsConfig.postEventBufferSeconds": "Post-Event Buffer (seconds)",
864-
"streamsConfig.postEventBufferHelp": "Continue recording after motion (0-60s)",
865-
"streamsConfig.maxFileDurationSeconds": "Max File Duration (seconds)",
866-
"streamsConfig.maxFileDurationHelp": "Max duration per file (60-3600s)",
867-
"streamsConfig.retentionPeriodDays": "Retention Period (days)",
868-
"streamsConfig.retentionPeriodHelp": "Auto-delete after N days (1-365)",
869-
"streamsConfig.recordingQuality": "Recording Quality",
870-
"streamsConfig.triggerTestMotionEvent": "Trigger Test Motion Event",
871858
"streamsConfig.enablePtzControl": "Enable PTZ Control",
872859
"streamsConfig.enablePtzControlHelp": "Enable pan-tilt-zoom controls for this camera via ONVIF PTZ protocol",
873860
"streamsConfig.maxPanX": "Max Pan (X)",
@@ -910,12 +897,6 @@
910897
"streamsConfig.noRecording": "No recording",
911898
"streamsConfig.recordingActive": "Recording active",
912899
"streamsConfig.clickHeadersOrDragCells": "Click headers or drag cells",
913-
"streams.motionConfigSaveFailed": "Motion config save failed: {message}",
914-
"streams.setStreamNameAndSaveBeforeTestingMotion": "Please set a stream name and save before testing motion.",
915-
"streams.enableOnvifCameraFirst": "Enable \"ONVIF Camera\" in Basic Settings first.",
916-
"streams.testMotionEventTriggeredSuccessfully": "Test motion event triggered successfully.",
917-
"streams.testMotionEventFailed": "Test motion event failed: {message}",
918-
"streams.errorTriggeringTestMotion": "Error triggering test motion: {message}",
919900
"streams.errorLoadingStreamDetails": "Error loading stream details: {message}",
920901
"streams.errorDiscoveringOnvifDevices": "Error discovering ONVIF devices: {message}",
921902
"streams.errorLoadingDeviceProfiles": "Error loading device profiles: {message}",

web/public/locales/pt-BR.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -808,20 +808,7 @@
808808
"streamsConfig.zoneTipDrawPolygons": "Desenhe polígonos clicando em pontos na imagem",
809809
"streamsConfig.zoneTipIgnoreAreas": "Use zonas para ignorar áreas como árvores, estradas ou céu",
810810
"streamsConfig.zoneTipMultipleZones": "Múltiplas zonas podem ser configuradas para áreas diferentes",
811-
"streamsConfig.motionRecordingOnvif": "Gravação por movimento (ONVIF)",
812811
"streamsConfig.onvifOnly": "Somente ONVIF",
813-
"streamsConfig.enableOnvifMotionRecording": "Ativar gravação por movimento ONVIF",
814-
"streamsConfig.onvifMotionRecordingHelp": "Grave quando a detecção de movimento embutida da câmera for acionada. Usa eventos ONVIF da câmera.",
815-
"streamsConfig.preEventBufferSeconds": "Buffer pré-evento (segundos)",
816-
"streamsConfig.preEventBufferHelp": "Vídeo antes do evento de movimento (0-30s)",
817-
"streamsConfig.postEventBufferSeconds": "Buffer pós-evento (segundos)",
818-
"streamsConfig.postEventBufferHelp": "Continuar gravando após o movimento (0-60s)",
819-
"streamsConfig.maxFileDurationSeconds": "Duração máxima do arquivo (segundos)",
820-
"streamsConfig.maxFileDurationHelp": "Duração máxima por arquivo (60-3600s)",
821-
"streamsConfig.retentionPeriodDays": "Período de retenção (dias)",
822-
"streamsConfig.retentionPeriodHelp": "Excluir automaticamente após N dias (1-365)",
823-
"streamsConfig.recordingQuality": "Qualidade da gravação",
824-
"streamsConfig.triggerTestMotionEvent": "Acionar evento de movimento de teste",
825812
"streamsConfig.enablePtzControl": "Ativar controle PTZ",
826813
"streamsConfig.enablePtzControlHelp": "Ativa controles de pan-tilt-zoom para esta câmera via protocolo PTZ ONVIF",
827814
"streamsConfig.maxPanX": "Pan máximo (X)",
@@ -864,12 +851,6 @@
864851
"streamsConfig.noRecording": "Sem gravação",
865852
"streamsConfig.recordingActive": "Gravação ativa",
866853
"streamsConfig.clickHeadersOrDragCells": "Clique nos cabeçalhos ou arraste as células",
867-
"streams.motionConfigSaveFailed": "Falha ao salvar a configuração de movimento: {message}",
868-
"streams.setStreamNameAndSaveBeforeTestingMotion": "Defina um nome para o stream e salve antes de testar o movimento.",
869-
"streams.enableOnvifCameraFirst": "Ative \"Câmera ONVIF\" nas configurações básicas primeiro.",
870-
"streams.testMotionEventTriggeredSuccessfully": "Evento de movimento de teste acionado com sucesso.",
871-
"streams.testMotionEventFailed": "Falha no evento de movimento de teste: {message}",
872-
"streams.errorTriggeringTestMotion": "Erro ao acionar o movimento de teste: {message}",
873854
"streams.errorLoadingStreamDetails": "Erro ao carregar os detalhes do stream: {message}",
874855
"streams.errorDiscoveringOnvifDevices": "Erro ao descobrir dispositivos ONVIF: {message}",
875856
"streams.errorLoadingDeviceProfiles": "Erro ao carregar perfis do dispositivo: {message}",

0 commit comments

Comments
 (0)