2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

01_FHEMWEB.js: avoid converting of csrf to Float.

fhemweb.js: avoid JS-Error if Websocket does not work (Forum #64541)


git-svn-id: https://svn.fhem.de/fhem/trunk@13103 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-01-16 09:01:48 +00:00
parent ede2dc252f
commit 466e83b58f
2 changed files with 3 additions and 1 deletions

View File

@ -275,7 +275,7 @@ FW_Define($$)
InternalTimer(1, sub(){ InternalTimer(1, sub(){
if($featurelevel >= 5.8 && !AttrVal($name, "csrfToken", undef)) { if($featurelevel >= 5.8 && !AttrVal($name, "csrfToken", undef)) {
my ($x,$y) = gettimeofday(); my ($x,$y) = gettimeofday();
$hash->{CSRFTOKEN} = rand($y)*rand($x); $hash->{CSRFTOKEN} = "fhem_".(rand($y)*rand($x));
} }
}, $hash, 0); }, $hash, 0);

View File

@ -41,6 +41,8 @@ consUpdate(evt)
new_content = consConn.responseText.substring(consLastIndex, len); new_content = consConn.responseText.substring(consLastIndex, len);
consLastIndex = len; consLastIndex = len;
} }
if(new_content == undefined || new_content.length == 0)
return;
log("Console Rcvd: "+new_content); log("Console Rcvd: "+new_content);
if(new_content.indexOf('<') != 0) if(new_content.indexOf('<') != 0)
new_content = new_content.replace(/ /g, "&nbsp;"); new_content = new_content.replace(/ /g, "&nbsp;");