Merge branch 'storageareas' of github.com:connortechnology/ZoneMinder into storageareas
This commit is contained in:
commit
29140a3012
|
@ -66,39 +66,37 @@ sub open {
|
|||
# Extract the username/password host/port from ControlAddress
|
||||
#
|
||||
my ($user,$pass,$host,$port);
|
||||
if( $self->{Monitor}{ControlAddress} =~ /^([^:]+):([^@]+)@(.+)/ ) { # user:pass@host...
|
||||
if ( $self->{Monitor}{ControlAddress} =~ /^([^:]+):([^@]+)@(.+)/ ) { # user:pass@host...
|
||||
$user = $1;
|
||||
$pass = $2;
|
||||
$host = $3;
|
||||
}
|
||||
elsif( $self->{Monitor}{ControlAddress} =~ /^([^@]+)@(.+)/ ) { # user@host...
|
||||
} elsif ( $self->{Monitor}{ControlAddress} =~ /^([^@]+)@(.+)/ ) { # user@host...
|
||||
$user = $1;
|
||||
$host = $2;
|
||||
}
|
||||
else { # Just a host
|
||||
} else { # Just a host
|
||||
$host = $self->{Monitor}{ControlAddress};
|
||||
}
|
||||
# Check if it is a host and port or just a host
|
||||
if( $host =~ /([^:]+):(.+)/ ) {
|
||||
if ( $host =~ /([^:]+):(.+)/ ) {
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$port = 80;
|
||||
}
|
||||
# Save the credentials
|
||||
if( defined($user) ) {
|
||||
$self->{UA}->credentials( "$host:$port", $self->{Monitor}{ControlDevice}, $user, $pass );
|
||||
if ( defined($user) ) {
|
||||
$self->{UA}->credentials("$host:$port", $self->{Monitor}{ControlDevice}, $user, $pass);
|
||||
}
|
||||
# Save the base url
|
||||
$self->{BaseURL} = "http://$host:$port";
|
||||
}
|
||||
|
||||
sub PutCmd {
|
||||
my $self = shift;
|
||||
my $cmd = shift;
|
||||
my $content = shift;
|
||||
my $req = HTTP::Request->new(PUT => "$self->{BaseURL}/$cmd");
|
||||
if(defined($content)) {
|
||||
if ( defined($content) ) {
|
||||
$req->content_type("application/x-www-form-urlencoded; charset=UTF-8");
|
||||
$req->content('<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $content);
|
||||
}
|
||||
|
@ -111,45 +109,44 @@ sub PutCmd {
|
|||
# just gives up. Because of this I try the request again and it should
|
||||
# succeed the second time if the credentials are correct.
|
||||
#
|
||||
if($res->code == 401) {
|
||||
if ( $res->code == 401 ) {
|
||||
$res = $self->{UA}->request($req);
|
||||
unless( $res->is_success ) {
|
||||
#
|
||||
# It has failed authentication. The odds are
|
||||
# that the user has set some paramater incorrectly
|
||||
# that the user has set some parameter incorrectly
|
||||
# so check the realm against the ControlDevice
|
||||
# entry and send a message if different
|
||||
#
|
||||
my $auth = $res->headers->www_authenticate;
|
||||
foreach (split(/\s*,\s*/,$auth)) {
|
||||
if( $_ =~ /^realm\s*=\s*"([^"]+)"/i ) {
|
||||
if( $self->{Monitor}{ControlDevice} ne $1 ) {
|
||||
Info "Control Device appears to be incorrect.";
|
||||
Info "Control Device should be set to \"$1\".";
|
||||
Info "Control Device currently set to \"$self->{Monitor}{ControlDevice}\".";
|
||||
if ( $_ =~ /^realm\s*=\s*"([^"]+)"/i ) {
|
||||
if ( $self->{Monitor}{ControlDevice} ne $1 ) {
|
||||
Warning("Control Device appears to be incorrect.
|
||||
Control Device should be set to \"$1\".
|
||||
Control Device currently set to \"$self->{Monitor}{ControlDevice}\".");
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
# Check for username/password
|
||||
#
|
||||
if( $self->{Monitor}{ControlAddress} =~ /.+:(.+)@.+/ ) {
|
||||
Info "Check username/password is correct";
|
||||
if ( $self->{Monitor}{ControlAddress} =~ /.+:(.+)@.+/ ) {
|
||||
Info("Check username/password is correct");
|
||||
} elsif ( $self->{Monitor}{ControlAddress} =~ /^[^:]+@.+/ ) {
|
||||
Info "No password in Control Address. Should there be one?";
|
||||
Info("No password in Control Address. Should there be one?");
|
||||
} elsif ( $self->{Monitor}{ControlAddress} =~ /^:.+@.+/ ) {
|
||||
Info "Password but no username in Control Address.";
|
||||
Info("Password but no username in Control Address.");
|
||||
} else {
|
||||
Info "Missing username and password in Control Address.";
|
||||
Info("Missing username and password in Control Address.");
|
||||
}
|
||||
Fatal $res->status_line;
|
||||
Fatal($res->status_line);
|
||||
}
|
||||
} else {
|
||||
Fatal($res->status_line);
|
||||
}
|
||||
else {
|
||||
Fatal $res->status_line;
|
||||
}
|
||||
}
|
||||
}
|
||||
} # end unless res->is_success
|
||||
} # end sub putCmd
|
||||
#
|
||||
# The move continuous functions all call moveVector
|
||||
# with the direction to move in. This includes zoom
|
||||
|
@ -386,4 +383,4 @@ sub reset {
|
|||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
|
|
@ -302,7 +302,7 @@ sub run {
|
|||
if ( ! ( $secs_count % 60 ) ) {
|
||||
Debug("Connecting");
|
||||
while ( (!$zm_terminate) and !($dbh and $dbh->ping()) ) {
|
||||
Warning("Not connected to db ($dbh). Reconnecting");
|
||||
Warning("Not connected to db ($dbh) ping(".$dbh->ping().". Reconnecting");
|
||||
$dbh = zmDbConnect();
|
||||
}
|
||||
my @cpuload = CpuLoad();
|
||||
|
|
|
@ -69,7 +69,7 @@ Event::Event(
|
|||
untimedEvent = true;
|
||||
start_time = now;
|
||||
} else if ( start_time.tv_sec > now.tv_sec ) {
|
||||
Error("StartTime in the future %d.%d > $d.%d",
|
||||
Error("StartTime in the future %d.%d > %d.%d",
|
||||
start_time.tv_sec, start_time.tv_usec, now.tv_sec, now.tv_usec
|
||||
);
|
||||
start_time = now;
|
||||
|
|
|
@ -1,49 +1,3 @@
|
|||
#header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#menuControls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#menuControls div {
|
||||
margin: 0 0 0 1em;
|
||||
}
|
||||
|
||||
#imageFeed{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#monitorStatus {
|
||||
margin: 4px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#monitorStatus #enableDisableAlarms {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#monitorStatus #forceCancelAlarm {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#monitorStatus #monitorState {
|
||||
}
|
||||
|
||||
#dvrControls {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#dvrControls input {
|
||||
height: 20px;
|
||||
width: 28px;
|
||||
padding-bottom: 3px;
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
#dvrControls input[disabled] {
|
||||
color: #aaaaaa;
|
||||
|
@ -61,45 +15,12 @@
|
|||
border: 1px solid red;
|
||||
}
|
||||
|
||||
#replayStatus {
|
||||
margin: 3px 0 2px;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#replayStatus > span {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#events {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
#eventList {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#eventList thead td {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#eventList th, #eventList td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
span.alarm {
|
||||
color: #DC143C;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.alert {
|
||||
color: #FF8C00;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#eventList tr.recent {
|
||||
|
|
Loading…
Reference in New Issue