diff --git a/definitions/en_CA.js b/definitions/en_CA.js index a89f86b2..6c32d521 100644 --- a/definitions/en_CA.js +++ b/definitions/en_CA.js @@ -1846,6 +1846,73 @@ module.exports = function(s,config,lang){ }, ] }, + "Timelapse Watermark": { + "id": "monSectionRecordingWatermark", + "name": lang['Recording Watermark'], + "color": "red", + isAdvanced: true, + "section-class": "h_rec_ti_input h_rec_ti_1", + "isSection": true, + "info": [ + { + "name": "detail=record_timelapse_watermark", + "field": lang.Enabled, + "description": "An image that is burned onto the frames of the recorded video.", + "default": "0", + "example": "", + "fieldType": "select", + "selector": "h_wat_timelapse", + "possible": [ + { + "name": "No", + "value": "0" + }, + { + "name": "Yes", + "value": "1" + } + ] + }, + { + hidden: true, + "name": "detail=record_timelapse_watermark_location", + "field": lang['Image Location'], + "description": "Image Location that will be used as Watermark.", + "default": "0", + "example": "/usr/share/watermark.logo", + "form-group-class": "h_wat_timelapse_input h_wat_timelapse_1", + "possible": "" + }, + { + hidden: true, + "name": "detail=record_timelapse_watermark_position", + "field": lang['Image Position'], + "description": "An image that is burned onto the frames of the recorded video.", + "default": "0", + "example": "", + "fieldType": "select", + "form-group-class": "h_wat_timelapse_input h_wat_timelapse_1", + "possible": [ + { + "name": lang["Top Right"], + "value": "tr" + }, + { + "name": lang["Top Left"], + "value": "tl" + }, + { + "name": lang["Bottom Right"], + "value": "br" + }, + { + "name": lang["Bottom Left"], + "value": "bl" + } + ] + }, + ] + }, "Custom": { "name": "Custom", "color": "navy", @@ -1962,6 +2029,32 @@ module.exports = function(s,config,lang){ } ] }, + { + "name": "detail=detector_http_api", + "field": lang["Allow API Trigger"], + "description": "Do you want to allow HTTP triggers to this camera?", + "default": "1", + "example": "", + "fieldType": "select", + "possible": [ + { + "name": `${lang.Always} (${lang.Default})`, + "value": "1" + }, + { + "name": lang[`When Detector is On`], + "value": "2" + }, + { + "name": lang[`When Detector is Off`], + "value": "3" + }, + { + "name": lang.Never, + "value": "0" + } + ] + }, { hidden: true, "name": "detail=detector_send_frames", diff --git a/languages/en_CA.json b/languages/en_CA.json index 20d34341..362518ba 100644 --- a/languages/en_CA.json +++ b/languages/en_CA.json @@ -35,6 +35,11 @@ "Input Settings": "Input Settings", "Connection": "Connection", "Video Set": "Video Set", + "Allow API Trigger": "Allow API Trigger", + "When Detector is Off": "When Detector is Off", + "When Detector is On": "When Detector is On", + "Always": "Always", + "Never": "Never", "API": "API", "ONVIF": "ONVIF", "FFprobe": "Probe", @@ -378,6 +383,7 @@ "Recording": "Recording", "Recording Timestamp": "Recording Timestamp", "Recording Watermark": "Recording Watermark", + "Timelapse Watermark": "Timelapse Watermark", "Region Editor": "Region Editor", "Detector Filters": "Detector Filters", "Filter for Objects only": "Filter for Objects only", @@ -723,6 +729,7 @@ "No Group with this key exists": "No Group with this key exists", "Success": "Success", "Trigger Successful": "Trigger Successful", + "Trigger Blocked": "Trigger Blocked", "No such file": "No such file", "h265BrowserText1": "If you are trying to play an H.265 file, you may need to download it and open it in another application like VLC.", "modifyVideoText1": "Method doesn't exist. Check to make sure that the last value of the URL is not blank.", diff --git a/libs/webServerPaths.js b/libs/webServerPaths.js index 7250fbe0..2531f114 100644 --- a/libs/webServerPaths.js +++ b/libs/webServerPaths.js @@ -1660,8 +1660,8 @@ module.exports = function(s,config,lang,app,io){ */ app.get(config.webPaths.apiPrefix+':auth/motion/:ke/:id', function (req,res){ s.auth(req.params,function(user){ - var endData = { - + var end = function(endData){ + res.end(s.prettyPrint(endData)) } if(req.query.data){ try{ @@ -1682,8 +1682,45 @@ module.exports = function(s,config,lang,app,io){ res.end(user.lang['No Group with this key exists']) return } + if(!s.group[d.ke].rawMonitorConfigurations[d.id]){ + res.end(user.lang['No Group with this key exists']) + return + } + var details = s.group[d.ke].rawMonitorConfigurations[d.id].details + var detectorHttpApi = details.detector_http_api + var detectorOn = (details.detector_http_api === '1') + switch(detectorHttpApi){ + case'0': + end({ + ok: false, + msg: user.lang['Trigger Blocked'] + }) + return + break; + case'2': + if(!detectorOn){ + end({ + ok: false, + msg: user.lang['Trigger Blocked'] + }) + return + } + break; + case'2': + if(detectorOn){ + end({ + ok: false, + msg: user.lang['Trigger Blocked'] + }) + return + } + break; + } s.triggerEvent(d) - res.end(user.lang['Trigger Successful']) + end({ + ok: true, + msg: user.lang['Trigger Successful'] + }) },res,req) }) /**