mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
50_SSChatBot: contrib 1.0.0
git-svn-id: https://svn.fhem.de/fhem/trunk@20673 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
52c8a2982a
commit
152c6fef8f
@ -1530,14 +1530,28 @@ sub SSChatBot_CGI() {
|
||||
}
|
||||
|
||||
# check ob angegebenes SSChatBot Device definiert, wenn ja Kontext auf botname setzen
|
||||
$name = $h->{botname};
|
||||
$name = $h->{botname}; # das SSChatBot Device
|
||||
return ( "text/plain; charset=utf-8", "No SSChatBot device for webhook \"/outchat\" exists" ) unless (IsDevice($name, 'SSChatBot'));
|
||||
$hash = $defs{$name};
|
||||
$hash = $defs{$name}; # hash des SSChatBot Devices
|
||||
|
||||
if (!defined($h->{token})) {
|
||||
Log3($name, 5, "$name - received insufficient data:\n".Dumper($args));
|
||||
return ("text/plain; charset=utf-8", "Insufficient data");
|
||||
}
|
||||
|
||||
# CSRF Token check
|
||||
my $FWdev = $hash->{FW}; # das FHEMWEB Device für SSChatBot Device -> ist das empfangene Device
|
||||
my $FWhash = $defs{$FWdev};
|
||||
my $want = $FWhash->{CSRFTOKEN};
|
||||
$want = $want?$want:"none";
|
||||
my $supplied = $h->{fwcsrf};
|
||||
if($want eq "none" || $want ne $supplied) {
|
||||
Log3 ($FW_wname, 2, "$FW_wname - WARNING - FHEMWEB CSRF error for client \"$FWdev\": ".
|
||||
"received $supplied token is not $want. ".
|
||||
"For details see the csrfToken FHEMWEB attribute. ".
|
||||
"The csrfToken must be identical to the token in OUTDEF of $name device.");
|
||||
return ("text/plain; charset=utf-8", "400 Bad Request");
|
||||
}
|
||||
|
||||
Log3($name, 4, "$name - ####################################################");
|
||||
Log3($name, 4, "$name - ### start Chat operation Receive ");
|
||||
|
Loading…
x
Reference in New Issue
Block a user