lots of web ui work

This commit is contained in:
Kevin Froman 2019-10-11 04:28:43 -05:00
parent f0c72ef1c8
commit e5fc15acc2
16 changed files with 37 additions and 19 deletions

View File

@ -8,3 +8,7 @@
* make forward secrecy compatible with multiple devices * make forward secrecy compatible with multiple devices
* make uptime timer be human meaningful * make uptime timer be human meaningful
* add way to mark key as dead * add way to mark key as dead
* add hashable set password for web ui
* add node online check for web ui
* add edits to circles posts
* use truncated words in mail instead of inputs

View File

@ -23,4 +23,4 @@ def pick_proxy(peer_address):
return 'tor' return 'tor'
elif peer_address.endswith('.i2p'): elif peer_address.endswith('.i2p'):
return 'i2p' return 'i2p'
raise ValueError("Peer address was not string ending with acceptable value") raise ValueError(f"Peer address was not string ending with acceptable value: {peer_address}")

View File

@ -38,7 +38,7 @@ def add_friend(pubkey):
@friends.route('/friends/remove/<pubkey>', methods=['POST']) @friends.route('/friends/remove/<pubkey>', methods=['POST'])
def remove_friend(pubkey): def remove_friend(pubkey):
contactmanager.ContactManager(pubkey).setTrust(0) contactmanager.ContactManager(pubkey).delete_contact()
return redirect(request.referrer + '#' + request.form['token']) return redirect(request.referrer + '#' + request.form['token'])
@friends.route('/friends/setinfo/<pubkey>/<key>', methods=['POST']) @friends.route('/friends/setinfo/<pubkey>/<key>', methods=['POST'])

View File

@ -4,10 +4,13 @@ import onionrblocks
import logger import logger
import coredb import coredb
def _check_remote_node(testmanager):
return
def insert_bin_test(testmanager): def insert_bin_test(testmanager):
data = os.urandom(32) data = os.urandom(32)
b_hash = onionrblocks.insert(data, ) b_hash = onionrblocks.insert(data, )
if not b_hash in coredb.blockmetadb.get_block_list(): if not b_hash in coredb.blockmetadb.get_block_list():
logger.error(str(b_hash) + 'is not in bl') logger.error(str(b_hash) + 'is not in bl')
raise ValueError raise ValueError

View File

@ -40,8 +40,10 @@ class SerializedData:
except AttributeError: except AttributeError:
time.sleep(1) time.sleep(1)
comm_inst = self._too_many.get(communicator.OnionrCommunicatorDaemon, args=(self._too_many,)) comm_inst = self._too_many.get(communicator.OnionrCommunicatorDaemon, args=(self._too_many,))
connected = []
[connected.append(x) for x in comm_inst.onlinePeers if x not in connected]
stats['uptime'] = comm_inst.getUptime() stats['uptime'] = comm_inst.getUptime()
stats['connectedNodes'] = '\n'.join(comm_inst.onlinePeers) stats['connectedNodes'] = '\n'.join(connected)
stats['blockCount'] = len(blockmetadb.get_block_list()) stats['blockCount'] = len(blockmetadb.get_block_list())
stats['blockQueueCount'] = len(comm_inst.blockQueue) stats['blockQueueCount'] = len(comm_inst.blockQueue)
return json.dumps(stats) return json.dumps(stats)

View File

@ -141,7 +141,7 @@ function getBlocks(){
requested = [] // reset requested list requested = [] // reset requested list
setTimeout(function(){ setTimeout(function(){
if (! loadedAny && ch == document.getElementById('feedIDInput').value){ if (! loadedAny && ch == document.getElementById('feedIDInput').value){
PNotify.notice("There are no posts for " + ch + " (yet).") PNotify.notice("There are no posts for " + ch + ". You can be the first!")
} }
}, loadingTimeout) }, loadingTimeout)
} }

View File

@ -31,7 +31,7 @@
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item idLink" href="/"> <a class="navbar-item idLink" href="/">
<img src="/shared/images/favicon.ico" class="navbarLogo"> Onionr <img src="/shared/images/favicon.ico" class="navbarLogo">
</a> </a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
@ -141,7 +141,7 @@
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<span id='loadingBoard'>Loading Circle... <i class="fas fa-yin-yang fa-spin"></i></span> <span id='loadingBoard'><i class="fas fa-yin-yang fa-spin"></i></span>
<div id='feed'> <div id='feed'>
<span id='none'>None yet, try refreshing 😃</span> <span id='none'>None yet, try refreshing 😃</span>
<!--Message Items are appended here based on template--> <!--Message Items are appended here based on template-->

View File

@ -25,7 +25,7 @@
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item idLink" href="/"> <a class="navbar-item idLink" href="/">
<img src="/shared/images/favicon.ico" class="navabarLogo"> Onionr <img src="/shared/images/favicon.ico" class="navabarLogo">
</a> </a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"

View File

@ -23,7 +23,7 @@
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item idLink" href="/"> <a class="navbar-item idLink" href="/">
<img src="/shared/images/favicon.ico" class="navbarLogo"> Onionr <img src="/shared/images/favicon.ico" class="navbarLogo">
</a> </a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"

View File

@ -26,7 +26,7 @@
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item idLink" href="/"> <a class="navbar-item idLink" href="/">
<img src="/shared/images/favicon.ico" class="navbarLogo"> Onionr <img src="/shared/images/favicon.ico" class="navbarLogo">
</a> </a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"

View File

@ -37,4 +37,4 @@
.messageContent{ .messageContent{
padding-top: 1em; padding-top: 1em;
} }

View File

@ -81,7 +81,7 @@
<br> <br>
<i class="icon fas fa-university"></i> <input type="checkbox" name="stateTarget"> <label for="stateTarget">Government (direct target)</label> <i class="icon fas fa-university"></i> <input type="checkbox" name="stateTarget"> <label for="stateTarget">Government (direct target)</label>
<br> <br>
<i class="icon fas fa-binoculars"></i> <input type="checkbox" name="local"> <label for="local">Local area threat (LAN or physical)</label> <i class="icon fas fa-binoculars"></i> <input type="checkbox" name="local"> <label for="local">Physically nearby threat</label>
</div> </div>
<br> <br>
<div class="field"> <div class="field">
@ -91,14 +91,14 @@
<i class="icon fas fa-network-wired"></i> <input checked type="checkbox" name="networkContribution"> <label for="networkContribution">Participating in data storage & sharing</label> <i class="icon fas fa-network-wired"></i> <input checked type="checkbox" name="networkContribution"> <label for="networkContribution">Participating in data storage & sharing</label>
<br> <br>
<i class="icon fas fa-book-open"></i> <input checked type="checkbox" name="networkContributionPlain"> <label for="networkContributionPlain">Storing plaintext data</label> <i class="icon fas fa-book-open"></i> <input checked type="checkbox" name="networkContributionPlain"> <label for="networkContributionPlain">Storing plaintext data</label>
<br>
<i class="icon fas fa-dollar-sign"></i> <input type="checkbox" name="donate"> <label for="donate">Donating the price of a coffee to fund development</label>
</div> </div>
<div class="field"> <div class="field">
<div> <div>
I prefer these words... I want to...
</div> </div>
<select name="userIDWords"> <i class="icon fas fa-user"></i> <input type="checkbox" name="useDeterministic"> <label for="useDeterminisitc">Use a seed to re(generate) an ID</label>
<option value=""></option>
</select>
</div> </div>
<br> <br>
<input type="submit" value="Get Started" class="button is-primary"> <input type="submit" value="Get Started" class="button is-primary">

View File

@ -0,0 +1,8 @@
fetch('/getnewkeys', {
headers: {
"token": webpass
}})
.then((resp) => resp.text()) // Transform the data into text
.then(function(resp) {
keys = keys.split('')
})

View File

@ -36,7 +36,7 @@
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item idLink" href="/"> <a class="navbar-item idLink" href="/">
<img src="/shared/images/favicon.ico" class="navbarLogo"> Onionr <img src="/shared/images/favicon.ico" class="navbarLogo">
</a> </a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"

View File

@ -16,6 +16,8 @@
#connectedNodes{ #connectedNodes{
overflow-y: auto; overflow-y: auto;
max-height: 300px;
} }
#configToggle, #configContent{ #configToggle, #configContent{

View File

@ -18,7 +18,6 @@
*/ */
uptimeDisplay = document.getElementById('uptime') uptimeDisplay = document.getElementById('uptime')
connectedDisplay = document.getElementById('connectedNodes') connectedDisplay = document.getElementById('connectedNodes')
connectedDisplay.style.maxHeight = '300px'
storedBlockDisplay = document.getElementById('storedBlocks') storedBlockDisplay = document.getElementById('storedBlocks')
queuedBlockDisplay = document.getElementById('blockQueue') queuedBlockDisplay = document.getElementById('blockQueue')
lastIncoming = document.getElementById('lastIncoming') lastIncoming = document.getElementById('lastIncoming')