watch now removes fingerprint, if it no longer works and pulls a new one

This commit is contained in:
Raphael Maenle 2020-05-28 18:27:21 +02:00
parent 1662c81d18
commit 60a337ecbc
2 changed files with 11 additions and 5 deletions

Binary file not shown.

View File

@ -226,7 +226,7 @@ var eventsTimeStamp = 0;
function deleteCallback() {
console.log("done");
console.log("getting new calendar events");
getFileFromServer("userinfo/" + deviceFingerprint.deviceId + "/calendarevents.json", readJSON);
getFileFromServer("device/" + deviceFingerprint.deviceName + "/calendarevents.json", readJSON);
}
console.log("deleting calendarevents");
@ -480,14 +480,20 @@ var eventsTimeStamp = 0;
if(events == null)
return;
/* if device not on server anymore */
if(events.kind == "not found") {
deviceFingerprint = null;
events = null;
deleteFile("devicefingerprint", function() {});
wait_time = SHORT_WAIT;
return;
}
/* if device not registered */
if(events.kind == "unregistered") {
wait_time = SHORT_WAIT;
if(deviceFingerprint === null) {
console.log("no fingerprint to render");
} else {
console.log("rendering text");
renderText(ctxContent, deviceFingerprint.deviceId, center.x, center.y, 20, "FF0000");
renderText(ctxContent, deviceFingerprint.deviceName, center.x, center.y, 20, "FF0000");
}
return;
}