work on UI friends manager

This commit is contained in:
Kevin Froman 2019-02-21 19:55:13 -06:00
parent 4f39c5792a
commit 30a2ae8d06
7 changed files with 43 additions and 21 deletions

View file

@ -34,6 +34,6 @@ def on_init(api, data = None):
# Doing this makes it so that the other functions can access the api object
# by simply referencing the variable `pluginapi`.
pluginapi = api
ui = OnionrCLIUI(api)
ui = OnionrContactManager(api)
#api.commands.register('interactive', ui.start)
return

View file

@ -19,3 +19,25 @@
friendListDisplay = document.getElementById('friendList')
fetch('/friends/list', {
headers: {
"token": webpass
}})
.then((resp) => resp.json()) // Transform the data into json
.then(function(resp) {
var keys = [];
for(var k in resp) keys.push(k);
console.log(keys)
for (var i = 0; i < keys.length; i++){
friendListDisplay.innerText = ''
var peer = keys[i]
var name = resp[keys[i]]['name']
if (name === null || name === ''){
name = 'Anonymous'
}
var entry = document.createElement('div')
entry.style.paddingTop = '8px'
entry.innerText = name + ' - ' + peer
friendListDisplay.appendChild(entry)
}
})

View file

@ -10,11 +10,6 @@
<link rel='stylesheet' href='/friends/style.css'>
</head>
<body>
<div id="shutdownNotice" class='overlay'>
<div>
<p>Your node will shutdown. Thank you for using Onionr.</p>
</div>
</div>
<div class='content'>
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
<span class='logoText'>Onionr Web Control Panel</span>
@ -24,7 +19,8 @@
<label>Set Alias: <input type='text' name='addAlias' placeholder='what to call them' required></label>
<input type='submit' value='Add Friend'>
</form>
<div id='friendList'></div>
<h2>Friend List:</h2>
<div id='friendList'>None Yet :(</div>
</div>
<script src='/shared/misc.js'></script>
<script src='/friends/friends.js'></script>