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