Merge branch 'crypto' of https://github.com/beardog108/Onionr into crypto
This commit is contained in:
commit
36d9ebd4f1
6 changed files with 94 additions and 23 deletions
|
@ -34,7 +34,7 @@ except ImportError:
|
|||
|
||||
ONIONR_TAGLINE = 'Anonymous P2P Platform - GPLv3 - https://Onionr.VoidNet.Tech'
|
||||
ONIONR_VERSION = '0.0.0' # for debugging and stuff
|
||||
API_VERSION = '1' # increments of 1; only change when something fundemental about how the API works changes. This way other nodes knows how to communicate without learning too much information about you.
|
||||
API_VERSION = '2' # increments of 1; only change when something fundemental about how the API works changes. This way other nodes knows how to communicate without learning too much information about you.
|
||||
|
||||
class Onionr:
|
||||
def __init__(self):
|
||||
|
@ -179,6 +179,7 @@ class Onionr:
|
|||
'add-addr': self.addAddress,
|
||||
'addaddr': self.addAddress,
|
||||
'addaddress': self.addAddress,
|
||||
'addfile': self.addFile,
|
||||
|
||||
'introduce': self.onionrCore.introduceNode,
|
||||
'connect': self.addAddress
|
||||
|
@ -200,6 +201,7 @@ class Onionr:
|
|||
'add-msg': 'Broadcasts a message to the Onionr network',
|
||||
'pm': 'Adds a private message to block',
|
||||
'get-pms': 'Shows private messages sent to you',
|
||||
'addfile': 'Create an Onionr block from a file',
|
||||
'introduce': 'Introduce your node to the public Onionr network (DAEMON MUST BE RUNNING)',
|
||||
}
|
||||
|
||||
|
@ -373,7 +375,7 @@ class Onionr:
|
|||
addedHash = self.onionrCore.setData(messageToAdd)
|
||||
self.onionrCore.addToBlockDB(addedHash, selfInsert=True)
|
||||
self.onionrCore.setBlockType(addedHash, 'txt')
|
||||
|
||||
logger.info("inserted your message as block: " + addedHash)
|
||||
return
|
||||
|
||||
def getPMs(self):
|
||||
|
@ -557,8 +559,23 @@ class Onionr:
|
|||
retVal = ''
|
||||
try:
|
||||
with open('./data/hs/hostname', 'r') as hostname:
|
||||
retval = retVal.read()
|
||||
retVal = hostname.read()
|
||||
except FileNotFoundError:
|
||||
return retVal
|
||||
|
||||
def addFile(self):
|
||||
'''command to add a file to the onionr network'''
|
||||
if len(sys.argv) >= 2:
|
||||
newFile = sys.argv[2]
|
||||
logger.info('Attempting to add file...')
|
||||
try:
|
||||
with open(newFile, 'r') as new:
|
||||
new = new.read()
|
||||
except FileNotFoundError:
|
||||
logger.warn('That file does not exist. Improper path?')
|
||||
else:
|
||||
print(new)
|
||||
self.onionrCore.insertBlock(new, header='bin')
|
||||
|
||||
|
||||
Onionr()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue