refactoring, work on friends ui, bug fixes and whitepaper work

This commit is contained in:
Kevin Froman 2019-03-09 00:37:57 -06:00
parent 1562848999
commit 137d6f39dd
12 changed files with 96 additions and 14 deletions

View file

@ -156,7 +156,7 @@ class Onionr:
with open('static-data/header.txt', 'rb') as file:
# only to stdout, not file or log or anything
sys.stderr.write(file.read().decode().replace('P', logger.colors.fg.pink).replace('W', logger.colors.reset + logger.colors.bold).replace('G', logger.colors.fg.green).replace('\n', logger.colors.reset + '\n').replace('B', logger.colors.bold).replace('A', '%s' % API_VERSION).replace('V', ONIONR_VERSION))
logger.info(logger.colors.fg.lightgreen + '-> ' + str(message) + logger.colors.reset + logger.colors.fg.lightgreen + ' <-\n')
logger.info(logger.colors.fg.lightgreen + '-> ' + str(message) + logger.colors.reset + logger.colors.fg.lightgreen + ' <-\n', sensitive=True)
def doExport(self, bHash):
exportDir = self.dataDir + 'block-export/'

View file

@ -122,7 +122,6 @@ def get_commands(onionr_inst):
'importblocks': onionr_inst.onionrUtils.importNewBlocks,
'introduce': onionr_inst.onionrCore.introduceNode,
'connect': onionr_inst.addAddress,
'pex': onionr_inst.doPEX,
'getpassword': onionr_inst.printWebPassword,

View file

@ -1,3 +1,23 @@
'''
Onionr - P2P Anonymous Storage Network
launch the api server and communicator
'''
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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 os, time, sys, platform, sqlite3
from threading import Thread
import onionr, api, logger, communicator

View file

@ -1,6 +1,22 @@
import sys
import logger
'''
Onionr - P2P Anonymous Storage Network
add keys (transport and pubkey)
'''
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
def add_peer(o_inst):
try:
newPeer = sys.argv[2]
@ -25,7 +41,7 @@ def add_address(o_inst):
pass
else:
logger.info("Adding address: " + logger.colors.underline + newAddress)
if self.onionrCore.addAddress(newAddress):
if o_inst.onionrCore.addAddress(newAddress):
logger.info("Successfully added address.")
else:
logger.warn("Unable to add address.")

View file

@ -1,3 +1,23 @@
'''
Onionr - P2P Anonymous Storage Network
plugin CLI commands
'''
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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, onionrplugins as plugins

View file

@ -415,12 +415,14 @@ class OnionrUtils:
This function is intended to scan for new blocks ON THE DISK and import them
'''
blockList = self._core.getBlockList()
exist = False
if scanDir == '':
scanDir = self._core.blockDataLocation
if not scanDir.endswith('/'):
scanDir += '/'
for block in glob.glob(scanDir + "*.dat"):
if block.replace(scanDir, '').replace('.dat', '') not in blockList:
exist = True
logger.info('Found new block on dist %s' % block)
with open(block, 'rb') as newBlock:
block = block.replace(scanDir, '').replace('.dat', '')
@ -430,6 +432,8 @@ class OnionrUtils:
self._core._utils.processBlockMetadata(block)
else:
logger.warn('Failed to verify hash for %s' % block)
if not exist:
print('No blocks found to import')
def progressBar(self, value = 0, endvalue = 100, width = None):
'''

View file

@ -72,6 +72,9 @@ fetch('/friends/list', {
entry.appendChild(removeButton)
entry.appendChild(nameText)
friendListDisplay.appendChild(entry)
entry.onclick = (function(entry, nameText, peer) {return function() {
overlay('friendInfo')
};})(entry, nameText, peer);
}
// If friend delete buttons are pressed

View file

@ -11,6 +11,12 @@
<link rel='stylesheet' href='/friends/style.css'>
</head>
<body>
<div id="friendInfo" class='overlay'>
<div class='overlayContent'>
<button id='defriend' class='warnBtn'>Unfriend</button>
<label>Public Key <input id='friendPubkey' type='text' readonly></label>
</div>
</div>
<div class='content'>
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
<span class='logoText'>Onionr Web Control Panel</span>

View file

@ -23,4 +23,14 @@ form label{
#friendList button{
display: inline;
margin-right: 10px;
}
#friendInfo .overlayContent{
padding: 1em;
text-align: center;
}
#defriend{
display: block;
margin-left: 50%;
margin-bottom: 1em;
}