work on friends and mail UI

This commit is contained in:
Kevin Froman 2019-03-04 13:03:35 -06:00
parent 4798308ccd
commit 45221291fa
5 changed files with 14 additions and 19 deletions

View File

@ -844,9 +844,9 @@ class Onionr:
# count stats
'div2' : True,
'Known Peers Count' : str(len(self.onionrCore.listPeers()) - 1),
'Enabled Plugins Count' : str(len(config.get('plugins.enabled', list()))) + ' / ' + str(len(os.listdir(self.dataDir + 'plugins/'))),
'Known Blocks Count' : str(totalBlocks),
'Known Peers' : str(len(self.onionrCore.listPeers()) - 1),
'Enabled Plugins' : str(len(config.get('plugins.enabled', list()))) + ' / ' + str(len(os.listdir(self.dataDir + 'plugins/'))),
'Stored Blocks' : str(totalBlocks),
'Percent Blocks Signed' : str(round(100 * signedBlocks / max(totalBlocks, 1), 2)) + '%'
}

View File

@ -52,12 +52,7 @@ def list_sentbox():
deleted = []
for x in range(len(sentbox_list_copy)):
if sentbox_list_copy[x]['hash'] in deleted:
x -= 1
sentbox_list.pop(x)
'''
hash_list = []
for x in sentbox_list:
hash_list.append({x['hash'])
return ','.join(hash_list)
'''
return json.dumps(sentbox_list)

View File

@ -33,8 +33,9 @@ addForm.onsubmit = function(){
headers: {
"token": webpass
}}).then(function(data) {
if (alias.value.trim().length > 0){
post_to_url('/friends/setinfo/' + friend.value + '/name', {'data': alias.value, 'token': webpass})
post_to_url('/friends/setinfo/' + friend.value + '/name', {'data': alias.value, 'token': webpass})
}
})

View File

@ -18,7 +18,7 @@
<a href='/' class='idLink'>Home</a>
<h2>Friend Manager</h2>
<form id='addFriend' action='/' method='POST'>
<label>Friend ID: <input type='text' name='addKey' placeholder='public key/ID' required></label>
<label>Friend ID: <input type='text' name='addKey' placeholder='public key/ID' minlength="56" maxlength="56" required></label>
<label>Set Alias: <input type='text' name='data' placeholder='what to call them'></label>
<input type='submit' value='Add Friend' class='successBtn'>
</form>

View File

@ -57,8 +57,9 @@ function openThread(bHash, sender, date, sigBool, pubkey){
sigEl.classList.remove('danger')
}
else{
sigMsg = 'Bad/no ' + sigMsg + ' (message could be fake)'
sigMsg = 'Bad/no ' + sigMsg + ' (message could be impersonating someone)'
sigEl.classList.add('danger')
replyBtn.style.display = 'none'
}
sigEl.innerText = sigMsg
overlay('messageDisplay')
@ -72,7 +73,6 @@ function setActiveTab(tabName){
switch(tabName){
case 'inbox':
refreshPms()
getInbox()
break
case 'sentbox':
getSentbox()
@ -112,13 +112,12 @@ function loadInboxEntries(bHash){
var humanDate = new Date(0)
var metadata = resp['metadata']
humanDate.setUTCSeconds(resp['meta']['time'])
validSig.style.display = 'none'
if (resp['meta']['signer'] != ''){
senderInput.value = httpGet('/friends/getinfo/' + resp['meta']['signer'] + '/name')
}
if (resp['meta']['validSig']){
validSig.innerText = 'Signature Validity: Good'
}
else{
if (! resp['meta']['validSig']){
validSig.style.display = 'inline'
validSig.innerText = 'Signature Validity: Bad'
validSig.style.color = 'red'
}
@ -145,9 +144,9 @@ function loadInboxEntries(bHash){
entry.appendChild(deleteBtn)
entry.appendChild(bHashDisplay)
entry.appendChild(senderInput)
entry.appendChild(validSig)
entry.appendChild(subjectLine)
entry.appendChild(dateStr)
entry.appendChild(validSig)
entry.classList.add('threadEntry')
entry.onclick = function(event){
@ -246,6 +245,7 @@ fetch('/mail/getinbox', {
.then((resp) => resp.text()) // Transform the data into json
.then(function(data) {
pms = data.split(',')
getInbox()
})
}
@ -310,5 +310,4 @@ fetch('/friends/list', {
//alert(resp[keys[i]]['name'])
}
})
setActiveTab('inbox')