Fix issue where a new client will overwrite the server-stored settings on first sync

This commit is contained in:
Skylar Ittner 2020-01-07 16:47:14 -07:00
parent a93d33d18d
commit 756e1e327a
2 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,7 @@ function logout() {
function () {
localStorage.removeItem('password');
localStorage.removeItem('username');
localStorage.removeItem('lastsync');
restartApplication();
}
);

View File

@ -8,8 +8,13 @@
function gatherSyncData() {
var data = {
localStorage: {},
changed: getStorage("lastchange") == null ? 0 : getStorage("lastchange")
changed: getStorage("lastchange") == null ? 0 : getStorage("lastchange"),
};
if (!inStorage("lastsync")) {
// first time syncing to the server, let's make sure
// the server settings take precedence
data.changed = 1;
}
var allitems = getAllStorage();
for (var i = 0; i < allitems.length; i++) {
var key = allitems[i].key;