work on friends ui and bug fixes
parent
137d6f39dd
commit
4fb01bac0e
|
@ -17,10 +17,12 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
|
import sys
|
||||||
|
import logger
|
||||||
def add_peer(o_inst):
|
def add_peer(o_inst):
|
||||||
try:
|
try:
|
||||||
newPeer = sys.argv[2]
|
newPeer = sys.argv[2]
|
||||||
except:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if o_inst.onionrUtils.hasKey(newPeer):
|
if o_inst.onionrUtils.hasKey(newPeer):
|
||||||
|
@ -37,7 +39,7 @@ def add_address(o_inst):
|
||||||
try:
|
try:
|
||||||
newAddress = sys.argv[2]
|
newAddress = sys.argv[2]
|
||||||
newAddress = newAddress.replace('http:', '').replace('/', '')
|
newAddress = newAddress.replace('http:', '').replace('/', '')
|
||||||
except:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
logger.info("Adding address: " + logger.colors.underline + newAddress)
|
logger.info("Adding address: " + logger.colors.underline + newAddress)
|
||||||
|
|
|
@ -33,7 +33,6 @@ addForm.onsubmit = function(){
|
||||||
headers: {
|
headers: {
|
||||||
"token": webpass
|
"token": webpass
|
||||||
}}).then(function(data) {
|
}}).then(function(data) {
|
||||||
|
|
||||||
if (alias.value.trim().length > 0){
|
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})
|
||||||
}
|
}
|
||||||
|
@ -73,8 +72,13 @@ fetch('/friends/list', {
|
||||||
entry.appendChild(nameText)
|
entry.appendChild(nameText)
|
||||||
friendListDisplay.appendChild(entry)
|
friendListDisplay.appendChild(entry)
|
||||||
entry.onclick = (function(entry, nameText, peer) {return function() {
|
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')
|
overlay('friendInfo')
|
||||||
};})(entry, nameText, peer);
|
};})(entry, nameText.value, peer);
|
||||||
}
|
}
|
||||||
// If friend delete buttons are pressed
|
// If friend delete buttons are pressed
|
||||||
|
|
||||||
|
@ -87,3 +91,7 @@ fetch('/friends/list', {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
document.getElementById('defriend').onclick = function(){
|
||||||
|
removeFriend(document.getElementById('friendPubkey').value)
|
||||||
|
}
|
|
@ -13,8 +13,9 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="friendInfo" class='overlay'>
|
<div id="friendInfo" class='overlay'>
|
||||||
<div class='overlayContent'>
|
<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>
|
<button id='defriend' class='warnBtn'>Unfriend</button>
|
||||||
<label>Public Key <input id='friendPubkey' type='text' readonly></label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='content'>
|
<div class='content'>
|
||||||
|
|
|
@ -26,11 +26,16 @@ form label{
|
||||||
}
|
}
|
||||||
|
|
||||||
#friendInfo .overlayContent{
|
#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;
|
padding: 1em;
|
||||||
text-align: center;
|
margin: 1em;
|
||||||
}
|
}
|
||||||
#defriend{
|
#defriend{
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: 50%;
|
margin-top: 1em;
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue