Merge branch 'issue-200' into 'dev'

Issue 200 solved

See merge request Shinobi-Systems/Shinobi!222
install-with-shinobicctv-user-instead-of-root
Moe 2020-08-11 19:36:15 +00:00
commit 4ed8063c6a
2 changed files with 20 additions and 11 deletions

View File

@ -1,5 +1,6 @@
var os = require('os');
var exec = require('child_process').exec;
var request = require('request')
module.exports = function(s,config,lang,app,io){
const moveLock = {}
const startMove = async function(options,callback){
@ -195,14 +196,14 @@ module.exports = function(s,config,lang,app,io){
}else{
const controlUrlStopTimeout = parseInt(monitorConfig.details.control_url_stop_timeout) || 1000
var stopCamera = function(){
var stopURL = controlBaseUrl + monitorConfig.details[`control_url_${options.direction}_stop`]
var options = s.cameraControlOptionsFromUrl(stopURL,monitorConfig)
var requestOptions = {
let stopURL = controlBaseUrl + monitorConfig.details[`control_url_${options.direction}_stop`]
let controlOptions = s.cameraControlOptionsFromUrl(stopURL,monitorConfig)
let requestOptions = {
url : stopURL,
method : options.method,
method : controlOptions.method,
auth : {
user : options.username,
pass : options.password
user : controlOptions.username,
pass : controlOptions.password
}
}
if(monitorConfig.details.control_digest_auth === '1'){
@ -221,12 +222,14 @@ module.exports = function(s,config,lang,app,io){
if(options.direction === 'stopMove'){
stopCamera()
}else{
var requestOptions = {
let controlURL = controlBaseUrl + monitorConfig.details[`control_url_${options.direction}`]
let controlOptions = s.cameraControlOptionsFromUrl(controlURL,monitorConfig)
let requestOptions = {
url: controlURL,
method: controlURLOptions.method,
method: controlOptions.method,
auth: {
user: controlURLOptions.username,
pass: controlURLOptions.password
user: controlOptions.username,
pass: controlOptions.password
}
}
if(monitorConfig.details.control_digest_auth === '1'){
@ -257,4 +260,4 @@ module.exports = function(s,config,lang,app,io){
startMove: startMove,
stopMove: stopMove,
}
}
}

View File

@ -1716,6 +1716,12 @@ module.exports = function(s,config,lang,app,io){
res.setHeader('Content-Type', 'application/json');
s.auth(req.params,function(user){
s.cameraControl(req.params,function(msg){
let d = {
id: req.params.id,
ke: req.params.ke,
direction: req.params.direction,
details: s.parseJSON(req.query.data)
}
s.userLog(d,msg)
res.end(s.prettyPrint(msg))
});