work on friends ui and bug fixes

master
Kevin Froman 2019-03-09 12:01:57 -06:00
parent 137d6f39dd
commit 4fb01bac0e
4 changed files with 25 additions and 9 deletions

View File

@ -17,10 +17,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import sys
import logger
def add_peer(o_inst):
try:
newPeer = sys.argv[2]
except:
except IndexError:
pass
else:
if o_inst.onionrUtils.hasKey(newPeer):
@ -37,7 +39,7 @@ def add_address(o_inst):
try:
newAddress = sys.argv[2]
newAddress = newAddress.replace('http:', '').replace('/', '')
except:
except IndexError:
pass
else:
logger.info("Adding address: " + logger.colors.underline + newAddress)

View File

@ -33,7 +33,6 @@ 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})
}
@ -73,8 +72,13 @@ fetch('/friends/list', {
entry.appendChild(nameText)
friendListDisplay.appendChild(entry)
entry.onclick = (function(entry, nameText, peer) {return function() {
if (nameText.length == 0){
nameText = 'Anonymous'
}
document.getElementById('friendPubkey').value = peer
document.getElementById('friendName').innerText = nameText
overlay('friendInfo')
};})(entry, nameText, peer);
};})(entry, nameText.value, peer);
}
// If friend delete buttons are pressed
@ -87,3 +91,7 @@ fetch('/friends/list', {
}
}
})
document.getElementById('defriend').onclick = function(){
removeFriend(document.getElementById('friendPubkey').value)
}

View File

@ -13,8 +13,9 @@
<body>
<div id="friendInfo" class='overlay'>
<div class='overlayContent'>
<div>Name: <span id='friendName'></span></div>
<label>Public Key: <input id='friendPubkey' type='text' readonly></label>
<button id='defriend' class='warnBtn'>Unfriend</button>
<label>Public Key <input id='friendPubkey' type='text' readonly></label>
</div>
</div>
<div class='content'>

View File

@ -26,11 +26,16 @@ form label{
}
#friendInfo .overlayContent{
background-color: lightgray;
border: 3px solid black;
border-radius: 3px;
color: black;
font-family: Verdana, Geneva, Tahoma, sans-serif;
min-height: 100%;
padding: 1em;
text-align: center;
margin: 1em;
}
#defriend{
display: block;
margin-left: 50%;
margin-bottom: 1em;
margin-top: 1em;
}