Bug fixes
- Fixed various bugs - Fixed: Backup-restore button not working - Adding *.tmp* to git-ignore
This commit is contained in:
parent
ccded713a6
commit
fe483ab172
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.tmp*
|
||||||
@ -866,7 +866,7 @@
|
|||||||
<p>Select backup file with extension '.json'. Which was downloaded when backup was performed.
|
<p>Select backup file with extension '.json'. Which was downloaded when backup was performed.
|
||||||
</p>
|
</p>
|
||||||
<label class="select-file">
|
<label class="select-file">
|
||||||
<sm-button>Select File</sm-button>
|
<sm-button onclick="document.getElementById('restore_data').click()">Select File</sm-button>
|
||||||
<input type="file" id="restore_data" accept=".json" />
|
<input type="file" id="restore_data" accept=".json" />
|
||||||
</label>
|
</label>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -32,16 +32,16 @@
|
|||||||
const _loaded = {};
|
const _loaded = {};
|
||||||
Object.defineProperties(messenger, {
|
Object.defineProperties(messenger, {
|
||||||
chats: {
|
chats: {
|
||||||
get: _loaded.chats
|
get: () => _loaded.chats
|
||||||
},
|
},
|
||||||
groups: {
|
groups: {
|
||||||
get: _loaded.groups
|
get: () => _loaded.groups
|
||||||
},
|
},
|
||||||
blocked: {
|
blocked: {
|
||||||
get: _loaded.blocked
|
get: () => _loaded.blocked
|
||||||
},
|
},
|
||||||
marked: {
|
marked: {
|
||||||
get: _loaded.marked
|
get: () => _loaded.marked
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -49,11 +49,11 @@
|
|||||||
messenger.conn = {};
|
messenger.conn = {};
|
||||||
Object.defineProperties(messenger.conn, {
|
Object.defineProperties(messenger.conn, {
|
||||||
direct: {
|
direct: {
|
||||||
get: directConnID
|
get: () => directConnID
|
||||||
},
|
},
|
||||||
group: {
|
group: {
|
||||||
get: Object.assign({}, groupConnID),
|
get: () => Object.assign({}, groupConnID),
|
||||||
value: g_id => groupConnID[g_id]
|
// value: g_id => groupConnID[g_id]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -117,7 +117,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function requestGroupInbox(groupID) {
|
function requestGroupInbox(groupID) {
|
||||||
console.debug(UI);
|
|
||||||
if (groupConnID[groupID]) { //close existing request connection (if any)
|
if (groupConnID[groupID]) { //close existing request connection (if any)
|
||||||
floCloudAPI.closeRequest(groupConnID[groupID]);
|
floCloudAPI.closeRequest(groupConnID[groupID]);
|
||||||
delete groupConnID[groupID];
|
delete groupConnID[groupID];
|
||||||
@ -143,7 +142,7 @@
|
|||||||
let k = _loaded.groups[groupID].eKey;
|
let k = _loaded.groups[groupID].eKey;
|
||||||
if (expiredKeys[groupID]) {
|
if (expiredKeys[groupID]) {
|
||||||
var ex = Object.keys(expiredKeys[groupID]).sort()
|
var ex = Object.keys(expiredKeys[groupID]).sort()
|
||||||
while (ex.lenght && vc > ex[0]) ex.shift()
|
while (ex.length && vc > ex[0]) ex.shift()
|
||||||
if (ex.length)
|
if (ex.length)
|
||||||
k = expiredKeys[groupID][ex.shift()]
|
k = expiredKeys[groupID][ex.shift()]
|
||||||
}
|
}
|
||||||
@ -182,7 +181,6 @@
|
|||||||
if (data.message)
|
if (data.message)
|
||||||
data.message = decrypt(data.message);
|
data.message = decrypt(data.message);
|
||||||
newInbox.messages[vc] = data;
|
newInbox.messages[vc] = data;
|
||||||
console.log(data)
|
|
||||||
if (data.sender !== myFloID)
|
if (data.sender !== myFloID)
|
||||||
addMark(data.groupID, "unread")
|
addMark(data.groupID, "unread")
|
||||||
if (!_loaded.appendix[`lastReceived_${groupID}`] ||
|
if (!_loaded.appendix[`lastReceived_${groupID}`] ||
|
||||||
@ -313,7 +311,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const requestDirectInbox = function() {
|
const requestDirectInbox = function() {
|
||||||
if (directInboxConn) { //close existing request connection (if any)
|
if (directConnID) { //close existing request connection (if any)
|
||||||
floCloudAPI.closeRequest(directConnID);
|
floCloudAPI.closeRequest(directConnID);
|
||||||
directConnID = undefined;
|
directConnID = undefined;
|
||||||
}
|
}
|
||||||
@ -326,7 +324,6 @@
|
|||||||
newgroups: [],
|
newgroups: [],
|
||||||
keyrevoke: []
|
keyrevoke: []
|
||||||
}
|
}
|
||||||
console.debug("Check if key is vc", dataSet);
|
|
||||||
for (let vc in dataSet) {
|
for (let vc in dataSet) {
|
||||||
try {
|
try {
|
||||||
//store the pubKey if not stored already
|
//store the pubKey if not stored already
|
||||||
@ -403,8 +400,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error !== "blocked-user")
|
//if (error !== "blocked-user")
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
if (_loaded.appendix.lastReceived < vc)
|
if (_loaded.appendix.lastReceived < vc)
|
||||||
_loaded.appendix.lastReceived = vc;
|
_loaded.appendix.lastReceived = vc;
|
||||||
@ -620,7 +617,7 @@
|
|||||||
for (let m in data.messages)
|
for (let m in data.messages)
|
||||||
if (data.messages[m].message)
|
if (data.messages[m].message)
|
||||||
data.messages[m].message = encrypt(data.messages[m].message)
|
data.messages[m].message = encrypt(data.messages[m].message)
|
||||||
for (let m in data.mail)
|
for (let m in data.mails)
|
||||||
data.mails[m].content = encrypt(data.mails[m].content)
|
data.mails[m].content = encrypt(data.mails[m].content)
|
||||||
for (let k in data.gkeys)
|
for (let k in data.gkeys)
|
||||||
data.gkeys[k] = encrypt(data.gkeys[k])
|
data.gkeys[k] = encrypt(data.gkeys[k])
|
||||||
@ -748,6 +745,7 @@
|
|||||||
let groupInfo = _loaded.groups[groupID]
|
let groupInfo = _loaded.groups[groupID]
|
||||||
if (myFloID !== groupInfo.admin)
|
if (myFloID !== groupInfo.admin)
|
||||||
return reject("Access denied: Admin only!")
|
return reject("Access denied: Admin only!")
|
||||||
|
let k = groupInfo.eKey;
|
||||||
//send groupInfo to new newMem
|
//send groupInfo to new newMem
|
||||||
groupInfo = JSON.stringify(groupInfo)
|
groupInfo = JSON.stringify(groupInfo)
|
||||||
let promises = newMem.map(m => sendRaw(groupInfo, m, "CREATE_GROUP", true));
|
let promises = newMem.map(m => sendRaw(groupInfo, m, "CREATE_GROUP", true));
|
||||||
@ -759,8 +757,7 @@
|
|||||||
success.push(newMem[i])
|
success.push(newMem[i])
|
||||||
else if (results[i].status === "rejected")
|
else if (results[i].status === "rejected")
|
||||||
failed.push(newMem[i])
|
failed.push(newMem[i])
|
||||||
console.log(success.join("|"))
|
let message = encrypt(success.join("|"), k)
|
||||||
let message = encrypt(success.join("|"), groupInfo.eKey)
|
|
||||||
sendRaw(message, groupID, "ADD_MEMBERS", false, note)
|
sendRaw(message, groupID, "ADD_MEMBERS", false, note)
|
||||||
.then(r => resolve(`Members added: ${success}`))
|
.then(r => resolve(`Members added: ${success}`))
|
||||||
.catch(e => reject(e))
|
.catch(e => reject(e))
|
||||||
@ -846,11 +843,13 @@
|
|||||||
_loaded.blocked = new Set(Object.keys(data.blocked));
|
_loaded.blocked = new Set(Object.keys(data.blocked));
|
||||||
//call UI render functions
|
//call UI render functions
|
||||||
UI.chats(getChatOrder());
|
UI.chats(getChatOrder());
|
||||||
UI.mails(data.mail);
|
UI.mails(data.mails);
|
||||||
UI.marked(data.marked);
|
UI.marked(data.marked);
|
||||||
//request data from cloud
|
//request data from cloud
|
||||||
requestDirectInbox();
|
requestDirectInbox();
|
||||||
data.groups.map(g => requestGroupInbox(g))
|
for (let g in data.groups)
|
||||||
|
if (data.groups[g].disabled !== true)
|
||||||
|
requestGroupInbox(g);
|
||||||
resolve("Messenger initiated");
|
resolve("Messenger initiated");
|
||||||
}).catch(error => reject(error));
|
}).catch(error => reject(error));
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user