updated dockerfile, fixed bug in showing name in mail
parent
c0c0f838b6
commit
f4cc1a6f8f
|
@ -4,7 +4,7 @@ FROM ubuntu:bionic
|
||||||
ENV HOME /root
|
ENV HOME /root
|
||||||
|
|
||||||
#Install needed packages
|
#Install needed packages
|
||||||
RUN apt update && apt install -y python3 python3-dev python3-pip tor locales nano
|
RUN apt update && apt install -y python3 python3-dev python3-pip tor locales nano sqlite3
|
||||||
|
|
||||||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
||||||
locale-gen
|
locale-gen
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import onionrblockapi, logger
|
import onionrblockapi, logger, onionrexceptions
|
||||||
class OnionrUser:
|
class OnionrUser:
|
||||||
def __init__(self, coreInst, publicKey):
|
def __init__(self, coreInst, publicKey):
|
||||||
self.trust = 0
|
self.trust = 0
|
||||||
|
@ -69,5 +69,8 @@ class OnionrUser:
|
||||||
if block.verifySig():
|
if block.verifySig():
|
||||||
newName = block.getMetadata('name')
|
newName = block.getMetadata('name')
|
||||||
if newName.isalnum():
|
if newName.isalnum():
|
||||||
logger.info('%s is now using the name %s.' % (self.publicKey, newName))
|
logger.info('%s is now using the name %s.' % (self.publicKey, self._core._utils.escapeAnsi(newName)))
|
||||||
self._core.setPeerInfo(self.publicKey, 'name', newName)
|
self._core.setPeerInfo(self.publicKey, 'name', newName)
|
||||||
|
print("DEBUG PLS")
|
||||||
|
else:
|
||||||
|
raise onionrexceptions.InvalidPubkey
|
|
@ -95,7 +95,10 @@ class OnionrUtils:
|
||||||
except IndexError:
|
except IndexError:
|
||||||
logger.warn('No pow token')
|
logger.warn('No pow token')
|
||||||
continue
|
continue
|
||||||
value = base64.b64decode(key[1])
|
try:
|
||||||
|
value = base64.b64decode(key[1])
|
||||||
|
except binascii.Error:
|
||||||
|
continue
|
||||||
hashedKey = self._core._crypto.blake2bHash(key[0])
|
hashedKey = self._core._crypto.blake2bHash(key[0])
|
||||||
powHash = self._core._crypto.blake2bHash(value + hashedKey)
|
powHash = self._core._crypto.blake2bHash(value + hashedKey)
|
||||||
try:
|
try:
|
||||||
|
@ -264,8 +267,7 @@ class OnionrUtils:
|
||||||
if myBlock.isEncrypted:
|
if myBlock.isEncrypted:
|
||||||
myBlock.decrypt()
|
myBlock.decrypt()
|
||||||
blockType = myBlock.getMetadata('type') # we would use myBlock.getType() here, but it is bugged with encrypted blocks
|
blockType = myBlock.getMetadata('type') # we would use myBlock.getType() here, but it is bugged with encrypted blocks
|
||||||
signer = myBlock.signer
|
signer = self.bytesToStr(myBlock.signer)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if len(blockType) <= 10:
|
if len(blockType) <= 10:
|
||||||
self._core.updateBlockInfo(blockHash, 'dataType', blockType)
|
self._core.updateBlockInfo(blockHash, 'dataType', blockType)
|
||||||
|
@ -282,7 +284,7 @@ class OnionrUtils:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self._core.setPeerInfo(signer, 'name', peerName)
|
self._core.setPeerInfo(signer, 'name', peerName)
|
||||||
logger.info('%s is now using the name %s.' % (signer, peerName))
|
logger.info('%s is now using the name %s.' % (signer, self.escapeAnsi(peerName)))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class OnionrCLIUI:
|
||||||
self.myCore = apiInst.get_core()
|
self.myCore = apiInst.get_core()
|
||||||
return
|
return
|
||||||
def start(self):
|
def start(self):
|
||||||
name = input("Enter your name")
|
name = input("Enter your name: ")
|
||||||
self.myCore.insertBlock("userInfo-" + str(uuid.uuid1()), sign=True, header='userInfo', meta={'name': name})
|
self.myCore.insertBlock("userInfo-" + str(uuid.uuid1()), sign=True, header='userInfo', meta={'name': name})
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,14 @@ class OnionrMail:
|
||||||
blockCount += 1
|
blockCount += 1
|
||||||
pmBlockMap[blockCount] = blockHash
|
pmBlockMap[blockCount] = blockHash
|
||||||
|
|
||||||
block = Block(blockHash, core=self.myCore)
|
block = pmBlocks[blockHash]
|
||||||
senderKey = block.getMetadata('signer')
|
senderKey = block.signer
|
||||||
senderDisplay = onionrusers.OnionrUser(self.myCore, senderKey)
|
try:
|
||||||
|
senderKey = senderKey.decode()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
print("DEBUG:", senderKey)
|
||||||
|
senderDisplay = onionrusers.OnionrUser(self.myCore, senderKey).getName()
|
||||||
if senderDisplay == 'anonymous':
|
if senderDisplay == 'anonymous':
|
||||||
senderDisplay = senderKey
|
senderDisplay = senderKey
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue