From a69cb17e474d5e7e304aee3abc11dfeb78ac6479 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 18 Aug 2019 00:27:33 -0500 Subject: [PATCH] fixed inserted blocks not having default expire in meta db work on chat --- onionr/onionrblocks/insert.py | 6 ++++++ onionr/static-data/default_config.json | 2 +- onionr/static-data/www/chat/index.html | 6 ++++-- onionr/static-data/www/chat/js/main.js | 8 +++++--- onionr/static-data/www/chat/js/message-feed.js | 9 +++++---- onionr/static-data/www/chat/js/messages.js | 17 +++++++++++------ 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/onionr/onionrblocks/insert.py b/onionr/onionrblocks/insert.py index 68be1360..79d212d2 100644 --- a/onionr/onionrblocks/insert.py +++ b/onionr/onionrblocks/insert.py @@ -136,6 +136,12 @@ def insert_block(data, header='txt', sign=False, encryptType='', symKey='', asym else: pass coredb.blockmetadb.add.add_to_block_DB(retData, selfInsert=True, dataSaved=True) + + if expire is None: + coredb.blockmetadb.update_block_info(retData, 'expire', createTime + onionrvalues.DEFAULT_EXPIRE) + else: + coredb.blockmetadb.update_block_info(retData, 'expire', expire) + blockmetadata.process_block_metadata(retData) if retData != False: diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index 99d2a19c..565b5f59 100755 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -50,7 +50,7 @@ "verbosity" : "default", "file": { - "output": false, + "output": true, "path": "output.log" }, diff --git a/onionr/static-data/www/chat/index.html b/onionr/static-data/www/chat/index.html index 03731997..2a790be7 100755 --- a/onionr/static-data/www/chat/index.html +++ b/onionr/static-data/www/chat/index.html @@ -15,7 +15,7 @@ - + @@ -86,7 +86,9 @@
-
+
+ +
diff --git a/onionr/static-data/www/chat/js/main.js b/onionr/static-data/www/chat/js/main.js index 7e918956..17d24d53 100755 --- a/onionr/static-data/www/chat/js/main.js +++ b/onionr/static-data/www/chat/js/main.js @@ -25,11 +25,13 @@ function createConvoList(){ for (friend in friendList){ let convoEntry = document.createElement('li') let connectStatus = document.createElement('span') - - if (! firstConvoLoad){ + connectStatus.classList.add("connectStatus") + if (firstConvoLoad){ + connectStatus.innerText = " ⌛" + } + else{ connectStatus.innerText = " X" connectStatus.style.color = "red" - connectStatus.classList.add("connectStatus") console.log(direct_connections) if (direct_connections.hasOwnProperty(friend)){ connectStatus.innerText = " ✅" diff --git a/onionr/static-data/www/chat/js/message-feed.js b/onionr/static-data/www/chat/js/message-feed.js index 8bdeef5a..9926bf31 100644 --- a/onionr/static-data/www/chat/js/message-feed.js +++ b/onionr/static-data/www/chat/js/message-feed.js @@ -16,9 +16,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -let MessageCache = class { - constructor(user) { - this.user = user - this.cache = [] // array of Messages + +let showMessages = function(){ + let feeds = document.getElementsByClassName("chatFeed") + for (x=0; x < feeds.length; x++){ + } } \ No newline at end of file diff --git a/onionr/static-data/www/chat/js/messages.js b/onionr/static-data/www/chat/js/messages.js index 1d1d5451..41329b7b 100644 --- a/onionr/static-data/www/chat/js/messages.js +++ b/onionr/static-data/www/chat/js/messages.js @@ -16,11 +16,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ - +chatMessages = [] let Message = class { - constructor(text, to, time){ - this.text = text // string - this.to = to // bool. False = not outgoing - this.time = time // epoch int + constructor(text, peer, outgoing){ + this.text = text // raw message string + this.peer = peer // peer by public key + this.outgoing = outgoing // boolean. false = outgoing message + this.time = new Date().toISOString() + //this.tempIdentifier = Math.floor(Math.random() * 100000000000000000); + chatMessages.push(this) } -} \ No newline at end of file +} + +//let addMessage = function(){} \ No newline at end of file