2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 20:24:36 +00:00

70_ZoneMinder: introduced attribute usePublicUrlForZmWeb

git-svn-id: https://svn.fhem.de/fhem/trunk@17637 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar 2018-10-28 21:01:38 +00:00
parent 7354291b4e
commit 68d0555608
2 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 70_ZoneMinder: introduced Attribute usePublicUrlForZmWeb
- bugfix 98_SmarterCoffee: fix fhem crash bug
- feature: 88_HMCCU: client device update optimized
- bugfix: 89_FULLY: fixed version check bug

View File

@ -53,7 +53,7 @@ sub ZoneMinder_Initialize {
$hash->{WriteFn} = "ZoneMinder_Write";
$hash->{ReadyFn} = "ZoneMinder_Ready";
$hash->{AttrList} = "loginInterval publicAddress webConsoleContext " . $readingFnAttributes;
$hash->{AttrList} = "usePublicUrlForZmWeb:0,1 loginInterval publicAddress webConsoleContext " . $readingFnAttributes;
$hash->{MatchList} = { "1:ZM_Monitor" => "^.*" };
Log3 '', 3, "ZoneMinder - Initialize done ...";
@ -146,9 +146,10 @@ sub ZoneMinder_getPublicAddress {
# is built by using web-url, and adding /api
sub ZoneMinder_getZmApiUrl {
my ($hash) = @_;
my $name = $hash->{NAME};
#use private LAN for API access for a start
my $zmWebUrl = ZoneMinder_getZmWebUrl($hash, 0);
my $usePublicUrlForZmWeb = AttrVal($name, 'usePublicUrlForZmWeb', 0);
my $zmWebUrl = ZoneMinder_getZmWebUrl($hash, $usePublicUrlForZmWeb);
return "$zmWebUrl/api";
}
@ -159,7 +160,8 @@ sub ZoneMinder_API_Login {
my $username = urlEncode($hash->{helper}{ZM_USERNAME});
my $password = urlEncode($hash->{helper}{ZM_PASSWORD});
my $zmWebUrl = ZoneMinder_getZmWebUrl($hash);
my $usePublicUrlForZmWeb = AttrVal($name, 'usePublicUrlForZmWeb', 0);
my $zmWebUrl = ZoneMinder_getZmWebUrl($hash, $usePublicUrlForZmWeb);
my $loginUrl = "$zmWebUrl/index.php?username=$username&password=$password&action=login&view=console";
Log3 $name, 4, "ZoneMinder ($name) - loginUrl: $loginUrl";