work on friends ui and bug fixes
This commit is contained in:
parent
137d6f39dd
commit
4fb01bac0e
@ -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)
|
||||
|
@ -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
|
||||
|
||||
@ -86,4 +90,8 @@ fetch('/friends/list', {
|
||||
removeFriend(friendKey)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
document.getElementById('defriend').onclick = function(){
|
||||
removeFriend(document.getElementById('friendPubkey').value)
|
||||
}
|
@ -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'>
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user