add check ammad_id for security reasion
This commit is contained in:
parent
270c72ef47
commit
ae14e66616
@ -74,8 +74,8 @@ eval "use Encode qw(encode encode_utf8);1" or $missingModul .= "Encode ";
|
|||||||
eval "use JSON;1" or $missingModul .= "JSON ";
|
eval "use JSON;1" or $missingModul .= "JSON ";
|
||||||
|
|
||||||
|
|
||||||
my $modulversion = "4.1.99.26";
|
my $modulversion = "4.1.99.30";
|
||||||
my $flowsetversion = "4.1.99.3";
|
my $flowsetversion = "4.1.99.5";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -255,11 +255,18 @@ sub AMADCommBridge_Write($@) {
|
|||||||
|
|
||||||
Log3 $name, 4, "AMADCommBridge ($name) - AMADCommBridge_Write Path: $path";
|
Log3 $name, 4, "AMADCommBridge ($name) - AMADCommBridge_Write Path: $path";
|
||||||
|
|
||||||
|
|
||||||
|
if($remoteServer ne 'Automagic' and $path =~ /\?/) {
|
||||||
|
$path .= "&amad_id=$amad_id";
|
||||||
|
} elsif($remoteServer ne 'Automagic') {
|
||||||
|
$path .= "?amad_id=$amad_id";
|
||||||
|
}
|
||||||
|
|
||||||
return readingsSingleUpdate($dhash,'lastSetCommand',$path,1)
|
return readingsSingleUpdate($dhash,'lastSetCommand',$path,1)
|
||||||
if( $remoteServer eq 'other' );
|
if( $remoteServer eq 'other' );
|
||||||
|
|
||||||
|
$param = { url => "http://" . $uri . $path, timeout => 15, hash => $hash, amad_id => $amad_id, method => $method, header => $header . "\r\namadid: $amad_id", doTrigger => 1, callback => \&AMADCommBridge_ErrorHandling } if($remoteServer eq 'Automagic');
|
||||||
|
|
||||||
$param = { url => "http://" . $uri . $path, timeout => 15, hash => $hash, amad_id => $amad_id, method => $method, header => $header, doTrigger => 1, callback => \&AMADCommBridge_ErrorHandling } if($remoteServer eq 'Automagic');
|
|
||||||
|
|
||||||
$param = { url => "http://" . $uri . "/",
|
$param = { url => "http://" . $uri . "/",
|
||||||
data => "{\"message\":\"AMAD=:=$path\", \"sender\":\"AMAD\", \"ttl\":60, \"communication_base_params\":{\"type\":\"Message\", \"fallback\":false, \"via\":\"Wifi\"},\"version\":\"1.62\"}",
|
data => "{\"message\":\"AMAD=:=$path\", \"sender\":\"AMAD\", \"ttl\":60, \"communication_base_params\":{\"type\":\"Message\", \"fallback\":false, \"via\":\"Wifi\"},\"version\":\"1.62\"}",
|
||||||
@ -268,6 +275,7 @@ sub AMADCommBridge_Write($@) {
|
|||||||
doTrigger => 1, callback => \&AMADCommBridge_ErrorHandling
|
doTrigger => 1, callback => \&AMADCommBridge_ErrorHandling
|
||||||
} if($remoteServer eq 'Autoremote');
|
} if($remoteServer eq 'Autoremote');
|
||||||
|
|
||||||
|
|
||||||
$param = { url => "http://" . $uri . "/",
|
$param = { url => "http://" . $uri . "/",
|
||||||
data => "device=AMAD&cmd=".urlEncode($path),
|
data => "device=AMAD&cmd=".urlEncode($path),
|
||||||
timeout => 15, hash => $hash, amad_id => $amad_id, method => $method,
|
timeout => 15, hash => $hash, amad_id => $amad_id, method => $method,
|
||||||
@ -276,6 +284,7 @@ sub AMADCommBridge_Write($@) {
|
|||||||
} if($remoteServer eq 'TNES');
|
} if($remoteServer eq 'TNES');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my $logtext = "AMADCommBridge ($name) - Send with remoteServer: $remoteServer URL: $param->{url}, HEADER: $param->{header}, METHOD: $method";
|
my $logtext = "AMADCommBridge ($name) - Send with remoteServer: $remoteServer URL: $param->{url}, HEADER: $param->{header}, METHOD: $method";
|
||||||
$logtext .= ", DATA: $param->{data}" if( $remoteServer ne 'Automagic' );
|
$logtext .= ", DATA: $param->{data}" if( $remoteServer ne 'Automagic' );
|
||||||
Log3 $name, 5, "$logtext";
|
Log3 $name, 5, "$logtext";
|
||||||
|
@ -59,7 +59,7 @@ eval "use JSON;1" or $missingModul .= "JSON ";
|
|||||||
|
|
||||||
|
|
||||||
my $modulversion = "4.1.99.30";
|
my $modulversion = "4.1.99.30";
|
||||||
my $flowsetversion = "4.1.99.3";
|
my $flowsetversion = "4.1.99.5";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ sub AMADDevice_statusRequest($) {
|
|||||||
my $fhemCtlMode = AttrVal($hash->{IODev}->{NAME},'fhemControlMode','none' );
|
my $fhemCtlMode = AttrVal($hash->{IODev}->{NAME},'fhemControlMode','none' );
|
||||||
my $bport = $hash->{IODev}->{PORT};
|
my $bport = $hash->{IODev}->{PORT};
|
||||||
|
|
||||||
$header .= "\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState\r\namadid: $amad_id\r\nfhemctlmode: $fhemCtlMode";
|
$header .= "\r\nfhemip: $fhemip\r\nfhemdevice: $name\r\nactivetask: $activetask\r\napssid: $apssid\r\nbport: $bport\r\nuserflowstate: $userFlowState\r\nfhemctlmode: $fhemCtlMode";
|
||||||
|
|
||||||
$method = "GET" if( AttrVal($name,'remoteServer','Automagic') eq 'Automagic' );
|
$method = "GET" if( AttrVal($name,'remoteServer','Automagic') eq 'Automagic' );
|
||||||
$method = "POST" if (AttrVal($name,'remoteServer','Automagic') ne 'Automagic' );
|
$method = "POST" if (AttrVal($name,'remoteServer','Automagic') ne 'Automagic' );
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user