(data)
| 213 | } |
| 214 | |
| 215 | function Threadfin(data) { |
| 216 | if (webSockets == false) { |
| 217 | alert("Your browser does not support WebSockets"); |
| 218 | return; |
| 219 | } else { |
| 220 | if (data["cmd"] != "getLog") { |
| 221 | showLoadingScreen(true) |
| 222 | } |
| 223 | } |
| 224 | delete undo["epgMapping"]; |
| 225 | |
| 226 | var protocolWS |
| 227 | switch (window.location.protocol) { |
| 228 | case "http:": protocolWS = "ws://"; break; |
| 229 | case "https:": protocolWS = "wss://"; break; |
| 230 | } |
| 231 | |
| 232 | |
| 233 | var ws = new WebSocket(protocolWS + window.location.hostname + ":" + window.location.port + "/data/" + "?Token=" + getCookie("Token")); |
| 234 | ws.onopen = function () { |
| 235 | console.log(data) |
| 236 | ws.send(JSON.stringify(data)); |
| 237 | } |
| 238 | |
| 239 | ws.onmessage = function (e) { |
| 240 | var response = JSON.parse(e.data); |
| 241 | console.log(response); |
| 242 | |
| 243 | if (response.hasOwnProperty("clientInfo")) { |
| 244 | createClintInfo(response["clientInfo"]); |
| 245 | } |
| 246 | |
| 247 | if (response.hasOwnProperty("log")) { |
| 248 | createClintInfo(response["log"]); |
| 249 | } |
| 250 | |
| 251 | if (response.hasOwnProperty("status")) { |
| 252 | if (response["status"] == false) { |
| 253 | alert(response["err"]) |
| 254 | if (response.hasOwnProperty("reload")) { |
| 255 | location.reload(); |
| 256 | } |
| 257 | //checkErr(response) |
| 258 | console.log(response); |
| 259 | updateThreadfinStatus(response); |
| 260 | setTimeout(function () { showLoadingScreen(false); }, 300); |
| 261 | |
| 262 | return |
| 263 | } |
| 264 | |
| 265 | updateThreadfinStatus(response) |
| 266 | |
| 267 | //console.log(data["cmd"]); |
| 268 | switch (data["cmd"]) { |
| 269 | case "saveUserData": createMenu(); break; |
| 270 | case "saveNewUser": createMenu(); break; |
| 271 | case "saveFilesXMLTV": //createMenu(); break; |
| 272 | case "saveFilesM3U": //createMenu(); return; break; |
no test coverage detected