From 4fb01bac0efe54cf7de220baa8cdbd82860e3036 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 9 Mar 2019 12:01:57 -0600 Subject: [PATCH] work on friends ui and bug fixes --- onionr/onionrcommands/keyadders.py | 6 ++++-- onionr/static-data/www/friends/friends.js | 14 +++++++++++--- onionr/static-data/www/friends/index.html | 3 ++- onionr/static-data/www/friends/style.css | 11 ++++++++--- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/onionr/onionrcommands/keyadders.py b/onionr/onionrcommands/keyadders.py index 48374fb9..d52b81f9 100644 --- a/onionr/onionrcommands/keyadders.py +++ b/onionr/onionrcommands/keyadders.py @@ -17,10 +17,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' +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) diff --git a/onionr/static-data/www/friends/friends.js b/onionr/static-data/www/friends/friends.js index 71f20f98..cbefae4d 100755 --- a/onionr/static-data/www/friends/friends.js +++ b/onionr/static-data/www/friends/friends.js @@ -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) } } - }) \ No newline at end of file + }) + + document.getElementById('defriend').onclick = function(){ + removeFriend(document.getElementById('friendPubkey').value) + } \ No newline at end of file diff --git a/onionr/static-data/www/friends/index.html b/onionr/static-data/www/friends/index.html index ebcbff7e..8ddd77f9 100755 --- a/onionr/static-data/www/friends/index.html +++ b/onionr/static-data/www/friends/index.html @@ -13,8 +13,9 @@
+
Name:
+ -
diff --git a/onionr/static-data/www/friends/style.css b/onionr/static-data/www/friends/style.css index 46affdd9..34bf64db 100755 --- a/onionr/static-data/www/friends/style.css +++ b/onionr/static-data/www/friends/style.css @@ -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; } \ No newline at end of file