bug fixes, 2 additional features
- Fixed bug: (updated stdop floCloudAPI to v2.0.2e): incorrect cloud inactive error. - Fixed bug: error occured during adding new members for a group. - Added rmChat: removes the chat. - Added clearChat: clears all messages of the chat.
This commit is contained in:
parent
d543be4939
commit
7fdcdf6462
58
index.html
58
index.html
@ -1093,7 +1093,8 @@
|
|||||||
adminID: "FMRsefPydWznGWneLqi4ABeQAJeFvtS3aQ",
|
adminID: "FMRsefPydWznGWneLqi4ABeQAJeFvtS3aQ",
|
||||||
pubKeys: {},
|
pubKeys: {},
|
||||||
contacts: {},
|
contacts: {},
|
||||||
appendix: {}
|
appendix: {},
|
||||||
|
expiredKeys: {}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="onLoadStartUp">
|
<script id="onLoadStartUp">
|
||||||
@ -1379,6 +1380,7 @@
|
|||||||
function renderDirectUI(data) {
|
function renderDirectUI(data) {
|
||||||
renderMessages(data.messages, {updateChatCard: true});
|
renderMessages(data.messages, {updateChatCard: true});
|
||||||
renderMailList(data.mails)
|
renderMailList(data.mails)
|
||||||
|
//let order = Object.keys(data.messages).map(a => a.split('_')).sort((a, b) => a[0] - b[0]).map(a => a[1])
|
||||||
if(Object.keys(data.messages).length){
|
if(Object.keys(data.messages).length){
|
||||||
document.title = `New message(s)`
|
document.title = `New message(s)`
|
||||||
}
|
}
|
||||||
@ -10271,7 +10273,7 @@ Bitcoin.Util = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="floCloudAPI" version="2.0.2c">
|
<script id="floCloudAPI" version="2.0.2e">
|
||||||
/* FLO Cloud operations to send/request application data*/
|
/* FLO Cloud operations to send/request application data*/
|
||||||
const floCloudAPI = {
|
const floCloudAPI = {
|
||||||
|
|
||||||
@ -10415,13 +10417,13 @@ Bitcoin.Util = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
inactive: [],
|
inactive: new Set(),
|
||||||
connect(snID) {
|
connect(snID) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!(snID in floGlobals.supernodes))
|
if (!(snID in floGlobals.supernodes))
|
||||||
return reject(`${snID} is not a supernode`)
|
return reject(`${snID} is not a supernode`)
|
||||||
let inactive = this.inactive
|
let inactive = this.inactive
|
||||||
if (inactive.includes(snID))
|
if (inactive.has(snID))
|
||||||
return reject(`${snID} is not active`)
|
return reject(`${snID} is not active`)
|
||||||
var wsConn = new WebSocket("wss://" + floGlobals.supernodes[snID].uri + "/ws");
|
var wsConn = new WebSocket("wss://" + floGlobals.supernodes[snID].uri + "/ws");
|
||||||
wsConn.onmessage = (evt) => {
|
wsConn.onmessage = (evt) => {
|
||||||
@ -10429,12 +10431,12 @@ Bitcoin.Util = {
|
|||||||
resolve(wsConn)
|
resolve(wsConn)
|
||||||
else if (evt.data == '$-') {
|
else if (evt.data == '$-') {
|
||||||
wsConn.close();
|
wsConn.close();
|
||||||
inactive.push(snID)
|
inactive.add(snID)
|
||||||
reject(`${snID} is not active`)
|
reject(`${snID} is not active`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wsConn.onerror = evt => {
|
wsConn.onerror = evt => {
|
||||||
inactive.push(snID)
|
inactive.add(snID)
|
||||||
reject(`${snID} is unavailable`)
|
reject(`${snID} is unavailable`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -10442,7 +10444,7 @@ Bitcoin.Util = {
|
|||||||
|
|
||||||
connectActive(snID, reverse = false) {
|
connectActive(snID, reverse = false) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (this.inactive.length === this.kBucket.SNCO.length)
|
if (this.inactive.size === this.kBucket.SNCO.length)
|
||||||
return reject('Cloud offline')
|
return reject('Cloud offline')
|
||||||
if (!(snID in floGlobals.supernodes))
|
if (!(snID in floGlobals.supernodes))
|
||||||
snID = this.kBucket.closestNode(snID);
|
snID = this.kBucket.closestNode(snID);
|
||||||
@ -10814,7 +10816,7 @@ Bitcoin.Util = {
|
|||||||
}
|
}
|
||||||
delete options.callback;
|
delete options.callback;
|
||||||
}
|
}
|
||||||
this.requestApplicationData(objectName, options).then(data).then(dataSet => {
|
this.requestApplicationData(objectName, options).then(dataSet => {
|
||||||
this.util.updateObject(dataSet)
|
this.util.updateObject(dataSet)
|
||||||
delete options.comment;
|
delete options.comment;
|
||||||
options.lowerVectorClock = floGlobals.lastVC[objectName] + 1
|
options.lowerVectorClock = floGlobals.lastVC[objectName] + 1
|
||||||
@ -10836,6 +10838,19 @@ Bitcoin.Util = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
closeRequest: function(requestID) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let conn = this.util.liveRequest[requestID]
|
||||||
|
if (!conn)
|
||||||
|
return reject('Request not found')
|
||||||
|
conn.onclose = evt => {
|
||||||
|
delete this.util.liveRequest[requestID]
|
||||||
|
resolve('Request connection closed')
|
||||||
|
}
|
||||||
|
conn.close()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
//reset or initialize an object and send it to cloud
|
//reset or initialize an object and send it to cloud
|
||||||
resetObjectData: function(objectName, options = {}) {
|
resetObjectData: function(objectName, options = {}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -11822,7 +11837,7 @@ Bitcoin.Util = {
|
|||||||
let newInfo = {
|
let newInfo = {
|
||||||
...floGlobals.groups[groupID]
|
...floGlobals.groups[groupID]
|
||||||
}
|
}
|
||||||
newInfo.eKey = this.encrypt(newInfo.eKey)
|
newInfo.eKey = utilFn.encrypt(newInfo.eKey)
|
||||||
compactIDB.writeData("groups", newInfo, groupID)
|
compactIDB.writeData("groups", newInfo, groupID)
|
||||||
}
|
}
|
||||||
utilFn.UIcallback(newInbox)
|
utilFn.UIcallback(newInbox)
|
||||||
@ -12130,6 +12145,31 @@ Bitcoin.Util = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
rmChat(chatID) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
compactIDB.removeData("chats", chatID)
|
||||||
|
.then(result => resolve("Chat removed"))
|
||||||
|
.catch(error => reject(error))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
clearChat(chatID) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let options = {
|
||||||
|
lowerKey: `${chatID}|`,
|
||||||
|
upperKey: `${chatID}||`
|
||||||
|
}
|
||||||
|
compactIDB.searchData("messages", options).then(result => {
|
||||||
|
let promises = []
|
||||||
|
for (let i in result)
|
||||||
|
promises.push(compactIDB.removeData("messages", i))
|
||||||
|
Promise.all(promises)
|
||||||
|
.then(result => resolve("Chat cleared"))
|
||||||
|
.catch(error => reject(error))
|
||||||
|
}).catch(error => reject(error))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
getChat(chatID) {
|
getChat(chatID) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let options = {
|
let options = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user